From: Michael Tremer Date: Sun, 18 Nov 2018 15:01:17 +0000 (+0000) Subject: people: Hide various things from users that are not staff X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71a3109c9c36a46256ab28293757fc9d00e6fb08;p=ipfire.org.git people: Hide various things from users that are not staff Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index 0fafce5c..a1b6ee21 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -363,9 +363,17 @@ class Account(Object): def is_admin(self): return "wheel" in self.groups - def is_talk_enabled(self): - return "sipUser" in self.classes or "sipRoutingObject" in self.classes \ - or self.telephone_numbers or self.address + def is_staff(self): + return "staff" in self.groups + + def has_shell(self): + return "posixAccount" in self.classes + + def has_mail(self): + return "postfixMailUser" in self.classes + + def has_sip(self): + return "sipUser" in self.classes or "sipRoutingObject" in self.classes def can_be_managed_by(self, account): """ diff --git a/src/templates/base.html b/src/templates/base.html index 767d2f42..793a9124 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -152,7 +152,7 @@ aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation"> - + + + {% end %}
{{ _("Telephone") }} @@ -75,16 +76,18 @@ -
- + {% if account.has_sip() %} +
+ - + - - {{ _("All calls will be forwarded to this phone number or SIP URI") }} - -
+ + {{ _("All calls will be forwarded to this phone number or SIP URI") }} + +
+ {% end %}
diff --git a/src/web/people.py b/src/web/people.py index c5f18f5b..e47a82d4 100644 --- a/src/web/people.py +++ b/src/web/people.py @@ -231,6 +231,10 @@ class SIPHandler(auth.CacheMixin, base.BaseHandler): class UsersHandler(auth.CacheMixin, base.BaseHandler): @tornado.web.authenticated def get(self): + # Only staff can see other users + if not self.current_user.is_staff(): + raise tornado.web.HTTPError(403) + self.render("people/users.html")