diff --git a/core/models.py b/core/models.py index 61f0f3c1..3be2ea91 100644 --- a/core/models.py +++ b/core/models.py @@ -414,6 +414,17 @@ class User(AbstractBaseUser): .has_rights_in_club(self) ) + @cached_property + def can_read_subscription(self): + from club.models import Club + + for club in Club.objects.filter( + id__in=settings.SITH_CAN_READ_SUBSCRIPTIONS + ).all(): + if club.has_rights_in_club(self): + return True + return False + @cached_property def can_create_subscription(self): from club.models import Club @@ -691,6 +702,10 @@ class AnonymousUser(AuthAnonymousUser): def can_create_subscription(self): return False + @property + def can_read_subscription(self): + return False + @property def was_subscribed(self): return False diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja index b3159303..82430041 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)%} + {% if profile.was_subscribed and (user == profile or user.is_root or user.is_board_member or user.can_read_subscription)%}
{% trans %}Subscription history{% endtrans %}
diff --git a/sith/settings.py b/sith/settings.py index 61005a72..da1b9670 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -474,6 +474,8 @@ SITH_PRODUCTTYPE_SUBSCRIPTION = 2 SITH_CAN_CREATE_SUBSCRIPTIONS = [1] +SITH_CAN_READ_SUBSCRIPTIONS = [85] + # Number of weeks before the end of a subscription when the subscriber can resubscribe SITH_SUBSCRIPTION_END = 10