src/templates/people/calls.html \
src/templates/people/index.html \
src/templates/people/passwd.html \
- src/templates/people/registrations.html \
src/templates/people/search.html \
+ src/templates/people/sip.html \
src/templates/people/user.html \
src/templates/people/user-edit.html \
src/templates/people/users.html
{% if account.sip_channels %}
- <a class="text-warning" href="/users/{{ account.uid }}/registrations">
+ <a class="text-warning" href="/users/{{ account.uid }}/sip">
{{ _("On The Phone") }} ({{ len(account.sip_registrations) }})
</a>
{% elif account.sip_registrations %}
- <a class="text-success" href="/users/{{ account.uid }}/registrations">
+ <a class="text-success" href="/users/{{ account.uid }}/sip">
{{ _("Online") }} ({{ len(account.sip_registrations) }})
</a>
{% else %}
(r"/users/(\w+)/calls(?:/(\d{4}-\d{2}-\d{2}))?", people.CallsHandler),
(r"/users/(\w+)/edit", people.UserEditHandler),
(r"/users/(\w+)/passwd", people.UserPasswdHandler),
- (r"/users/(\w+)/registrations", people.RegistrationsHandler),
+ (r"/users/(\w+)/sip", people.SIPHandler),
] + authentication_handlers)
# ipfire.org
self.render("people/call.html", call=call)
-class RegistrationsHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self, uid):
- # Get own account
- if self.current_user.uid == uid:
- account = self.current_user
-
- # Admins can access all other users, too
- elif self.current_user.is_admin():
- account = self.backend.accounts.get_by_uid(uid)
- if not account:
- raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
-
- # Otherwise, no access is permitted
- else:
- raise tornado.web.HTTPError(403)
-
- self.render("people/registrations.html", account=account)
-
-
class SearchHandler(base.BaseHandler):
@tornado.web.authenticated
def get(self):
self.render("people/search.html", q=q, accounts=accounts)
+class SIPHandler(base.BaseHandler):
+ @tornado.web.authenticated
+ def get(self, uid):
+ account = self.backend.accounts.get_by_uid(uid)
+ if not account:
+ raise tornado.web.HTTPError(404, "Could not find account %s" % uid)
+
+ # Check for permissions
+ if not account.can_be_managed_by(self.current_user):
+ raise tornado.web.HTTPError(403, "%s cannot manage %s" % (self.current_user, account))
+
+ self.render("people/sip.html", account=account)
+
+
class UsersHandler(base.BaseHandler):
@tornado.web.authenticated
def get(self):