From 830c15a585c339b2b9ce35030035312f5fa4c88a Mon Sep 17 00:00:00 2001 From: Skia Date: Wed, 10 Aug 2016 14:48:18 +0200 Subject: [PATCH] Better right handling in files --- core/models.py | 27 ++++++++++++++++----------- core/templates/core/base.jinja | 9 +++++++-- core/templates/core/file.jinja | 14 -------------- core/templates/core/file_detail.jinja | 2 ++ core/templates/core/file_list.jinja | 2 ++ core/views/__init__.py | 2 +- core/views/files.py | 8 ++++---- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/core/models.py b/core/models.py index 63442c1f..02aa9e09 100644 --- a/core/models.py +++ b/core/models.py @@ -137,17 +137,22 @@ class User(AbstractBaseUser): return False else: return False - if group_name[-6:] == settings.SITH_BOARD_SUFFIX: - if 'club' in settings.INSTALLED_APPS: - from club.models import Club - name = group_name[:-6] - c = Club.objects.filter(unix_name=name).first() - mem = c.get_membership_for(self) - if mem: - return mem.role >= 2 - return False - else: - return False + if group_name[-len(settings.SITH_BOARD_SUFFIX):] == settings.SITH_BOARD_SUFFIX: + from club.models import Club + name = group_name[:-len(settings.SITH_BOARD_SUFFIX)] + c = Club.objects.filter(unix_name=name).first() + mem = c.get_membership_for(self) + if mem: + return mem.role > settings.SITH_MAXIMUM_FREE_ROLE + return False + if group_name[-len(settings.SITH_MEMBER_SUFFIX):] == settings.SITH_MEMBER_SUFFIX: + from club.models import Club + name = group_name[:-len(settings.SITH_MEMBER_SUFFIX)] + c = Club.objects.filter(unix_name=name).first() + mem = c.get_membership_for(self) + if mem: + return True + return False if group_name == settings.SITH_GROUPS['root']['name'] and self.is_superuser: return True return self.groups.filter(name=group_name).exists() diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index f5830be6..eaf51cf4 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -13,6 +13,7 @@ {% block header %} + {% if not popup %}
@@ -25,8 +26,12 @@ {% trans %}Logout{% endtrans %} {% endif %}
+ {% else %} +
{{ user.get_display_name() }}
+ {% endif %} {% endblock %} {% block nav %} + {% if not popup %} + {% endif %} {% endblock %}
@@ -59,8 +65,7 @@