From 8b77efbfabfb3d65b0400e123025c02346454214 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 3 Mar 2011 14:59:04 -0600 Subject: Template fine-grained permissioning Rather than use user.is_authenticated, rely on certain permissions being set for the user. This allows us to open up the developer side and not assume everyone is a package maintainer. Allow all logged-in users to still view todo lists, but don't show the complete/incomplete links (only the text) unless they are allowed to mess with todo lists. Signed-off-by: Dan McGee --- templates/packages/details.html | 4 ++-- templates/packages/search.html | 6 +++--- templates/todolists/view.html | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/templates/packages/details.html b/templates/packages/details.html index ea5e528c..f73e9d7c 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -26,7 +26,7 @@ title="Testing package details for {{ tp.pkgname }}">{{ tp.pkgver }}-{{ tp.pkgrel }} in testing {% endif %}{% endwith %} - {% if user.is_authenticated %} + {% if perms.main.change_package %}
  • Click here to unflag
  • Click here to unflag all split packages
  • {% endif %} @@ -40,7 +40,7 @@
  • Download From Mirror
  • - {% if user.is_authenticated %} + {% if perms.main.change_package %}
    {% csrf_token %}

    {% if user in pkg.maintainers %} diff --git a/templates/packages/search.html b/templates/packages/search.html index 4a779aa0..dad05ffa 100644 --- a/templates/packages/search.html +++ b/templates/packages/search.html @@ -71,7 +71,7 @@ - {% if user.is_authenticated %} + {% if perms.main.change_package %} {% endif %} - {% if user.is_authenticated %} + {% if perms.main.change_package %} {% endif %} @@ -134,7 +134,7 @@ {% endif %} - {% if user.is_authenticated %} + {% if perms.main.change_package %}

    {{ pkg.pkg.repo.name|capfirst }}

    {% endfor %} -- cgit v1.2.3-55-g3dc8
      {% for pkg in package_list %}
    {{ pkg.arch.name }}{{ pkg.pkg.maintainers|join:', ' }} + {% if perms.main.change_todolistpkg %} {% if pkg.complete %} Complete @@ -45,6 +46,9 @@ Incomplete {% endif %} + {% else %} + {% if pkg.complete %}Complete{% else %}Incomplete{% endif %} + {% endif %}