diff --git a/server/src/uds/REST/methods/cache.py b/server/src/uds/REST/methods/cache.py index ae9140378..781597bb0 100644 --- a/server/src/uds/REST/methods/cache.py +++ b/server/src/uds/REST/methods/cache.py @@ -44,7 +44,7 @@ logger = logging.getLogger(__name__) class Cache(Handler): authenticated = True - needs_staff = True + needs_admin = True def get(self): ''' diff --git a/server/src/uds/static/adm/js/gui-d-config.coffee b/server/src/uds/static/adm/js/gui-d-config.coffee index 6d487d161..27132560c 100644 --- a/server/src/uds/static/adm/js/gui-d-config.coffee +++ b/server/src/uds/static/adm/js/gui-d-config.coffee @@ -1,6 +1,10 @@ gui.configuration = new BasicGuiElement("Clear cache") gui.configuration.link = -> "use strict" + + if api.config.admin is false + return + api.templates.get "configuration", (tmpl) -> api.configuration.overview ((data) -> gui.doLog data diff --git a/server/src/uds/static/adm/js/gui-d-gallery.coffee b/server/src/uds/static/adm/js/gui-d-gallery.coffee index a126ef5b7..1e2703bb0 100644 --- a/server/src/uds/static/adm/js/gui-d-gallery.coffee +++ b/server/src/uds/static/adm/js/gui-d-gallery.coffee @@ -2,6 +2,9 @@ gui.gallery = new GuiElement(api.gallery, "imgal") gui.gallery.link = -> "use strict" + if api.config.admin is false + return + newEditImageFnc = (forEdit) -> realFnc = (value, refreshFnc) -> api.templates.get "new_image", (tmpl) -> diff --git a/server/src/uds/static/adm/js/gui-definition.coffee b/server/src/uds/static/adm/js/gui-definition.coffee index 884c9e171..4210d0ca6 100644 --- a/server/src/uds/static/adm/js/gui-definition.coffee +++ b/server/src/uds/static/adm/js/gui-definition.coffee @@ -6,6 +6,10 @@ gui.clear_cache = new BasicGuiElement("Flush cache") gui.clear_cache.link = -> "use strict" + + if api.config.admin is false + return + api.getJson "cache/flush", success: -> gui.launchModal gettext("Cache"), gettext("Cache has been flushed"), diff --git a/server/src/uds/templates/uds/admin/index.html b/server/src/uds/templates/uds/admin/index.html index 541640a72..39217bc47 100644 --- a/server/src/uds/templates/uds/admin/index.html +++ b/server/src/uds/templates/uds/admin/index.html @@ -37,7 +37,7 @@
- {% block menu %}{% include 'uds/admin/snippets/navbar.html' %}{% endblock %} + {% block menu %}{% include 'uds/admin/snippets/navbar.html' with admin=request.user.is_admin %}{% endblock %}
@@ -151,7 +151,9 @@ {% js_template 'services_pool' %} {% js_template 'configuration' %} {% js_template 'gallery' %} - {% js_template 'permissions'} + {% js_template 'permissions' %} + {% js_template 'permissions_add' %} + {% js_template 'request_failed' %} diff --git a/server/src/uds/templates/uds/admin/snippets/navbar.html b/server/src/uds/templates/uds/admin/snippets/navbar.html index 40edee4ac..2203f62f7 100644 --- a/server/src/uds/templates/uds/admin/snippets/navbar.html +++ b/server/src/uds/templates/uds/admin/snippets/navbar.html @@ -20,6 +20,7 @@
  • Os Managers
  • {% trans 'Connectivity' %}
  • {% trans 'Service Pools' %}
  • + {% if admin %} + {% endif %}