diff --git a/core/models.py b/core/models.py index 3be2ea91..1d1d4266 100644 --- a/core/models.py +++ b/core/models.py @@ -415,11 +415,14 @@ class User(AbstractBaseUser): ) @cached_property - def can_read_subscription(self): + def can_read_subscription_history(self): + if self.is_root or self.is_board_member: + return True + from club.models import Club for club in Club.objects.filter( - id__in=settings.SITH_CAN_READ_SUBSCRIPTIONS + id__in=settings.SITH_CAN_READ_SUBSCRIPTION_HISTORY ).all(): if club.has_rights_in_club(self): return True @@ -703,7 +706,7 @@ class AnonymousUser(AuthAnonymousUser): return False @property - def can_read_subscription(self): + def can_read_subscription_history(self): return False @property diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja index 82430041..b2e834e9 100644 --- a/core/templates/core/user_detail.jinja +++ b/core/templates/core/user_detail.jinja @@ -145,7 +145,7 @@ {% endif %} {% endif %} - {% if profile.was_subscribed and (user == profile or user.is_root or user.is_board_member or user.can_read_subscription)%} + {% if profile.was_subscribed and (user == profile or user.can_read_subscription_history)%}
{% trans %}Subscription history{% endtrans %}
diff --git a/sith/settings.py b/sith/settings.py index da1b9670..74331540 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -472,9 +472,13 @@ SITH_PRODUCT_SUBSCRIPTION_ONE_SEMESTER = 1 SITH_PRODUCT_SUBSCRIPTION_TWO_SEMESTERS = 2 SITH_PRODUCTTYPE_SUBSCRIPTION = 2 +# Defines which club lets its member the ability to make subscriptions +# Elements of this list are club's id SITH_CAN_CREATE_SUBSCRIPTIONS = [1] -SITH_CAN_READ_SUBSCRIPTIONS = [85] +# Defines which clubs lets its members the ability to see users subscription history +# Elements of this list are club's id +SITH_CAN_READ_SUBSCRIPTION_HISTORY = [] # Number of weeks before the end of a subscription when the subscriber can resubscribe SITH_SUBSCRIPTION_END = 10