mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
Selected club members can now see subscriptions
This commit is contained in:
parent
50e04164a2
commit
71c5456225
@ -414,6 +414,17 @@ class User(AbstractBaseUser):
|
|||||||
.has_rights_in_club(self)
|
.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
|
@cached_property
|
||||||
def can_create_subscription(self):
|
def can_create_subscription(self):
|
||||||
from club.models import Club
|
from club.models import Club
|
||||||
@ -691,6 +702,10 @@ class AnonymousUser(AuthAnonymousUser):
|
|||||||
def can_create_subscription(self):
|
def can_create_subscription(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def can_read_subscription(self):
|
||||||
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def was_subscribed(self):
|
def was_subscribed(self):
|
||||||
return False
|
return False
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% 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)%}
|
||||||
<div id="drop_subscriptions">
|
<div id="drop_subscriptions">
|
||||||
<h5>{% trans %}Subscription history{% endtrans %}</h5>
|
<h5>{% trans %}Subscription history{% endtrans %}</h5>
|
||||||
<table>
|
<table>
|
||||||
|
@ -474,6 +474,8 @@ SITH_PRODUCTTYPE_SUBSCRIPTION = 2
|
|||||||
|
|
||||||
SITH_CAN_CREATE_SUBSCRIPTIONS = [1]
|
SITH_CAN_CREATE_SUBSCRIPTIONS = [1]
|
||||||
|
|
||||||
|
SITH_CAN_READ_SUBSCRIPTIONS = [85]
|
||||||
|
|
||||||
# Number of weeks before the end of a subscription when the subscriber can resubscribe
|
# Number of weeks before the end of a subscription when the subscriber can resubscribe
|
||||||
SITH_SUBSCRIPTION_END = 10
|
SITH_SUBSCRIPTION_END = 10
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user