mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 19:14:30 +00:00
Merge branch 'sli' into 'master'
Hided launderette slots and tokens for non authorized users and added is_office and is_launderette See merge request !8
This commit is contained in:
commit
4749c45c97
@ -231,6 +231,16 @@ class User(AbstractBaseUser):
|
|||||||
def is_root(self):
|
def is_root(self):
|
||||||
return self.is_superuser or self.groups.filter(name=settings.SITH_GROUPS['root']['name']).exists()
|
return self.is_superuser or self.groups.filter(name=settings.SITH_GROUPS['root']['name']).exists()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_board_member(self):
|
||||||
|
from club.models import Club
|
||||||
|
return Club.objects.filter(unix_name=settings.SITH_MAIN_CLUB['unix_name']).first().get_membership_for(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_launderette_manager(self):
|
||||||
|
from club.models import Club
|
||||||
|
return Club.objects.filter(unix_name=settings.SITH_LAUNDERETTE_MANAGER['unix_name']).first().get_membership_for(self)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
create = False
|
create = False
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
@ -55,14 +55,16 @@
|
|||||||
{# if the user is member of a club, he can view the subscription state #}
|
{# if the user is member of a club, he can view the subscription state #}
|
||||||
<p>
|
<p>
|
||||||
{% if get_subscriber(profile).is_subscribed() %}
|
{% if get_subscriber(profile).is_subscribed() %}
|
||||||
|
{% if user == profile or user.is_root or user.is_board_member %}
|
||||||
{% trans subscription_end=get_subscriber(profile).subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}<br/>
|
{% trans subscription_end=get_subscriber(profile).subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}<br/>
|
||||||
{% if user == profile or user.is_root %}
|
|
||||||
{% trans %}Account number: {% endtrans %}{{ profile.customer.account_id }}<br/>
|
{% trans %}Account number: {% endtrans %}{{ profile.customer.account_id }}<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user == profile or user.is_root or user.is_board_member or user.is_launderette_manager %}
|
||||||
{# Shows tokens bought by the user #}
|
{# Shows tokens bought by the user #}
|
||||||
{{ show_tokens(profile) }}
|
{{ show_tokens(profile) }}
|
||||||
{# Shows slots took by the user #}
|
{# Shows slots took by the user #}
|
||||||
{{ show_slots(profile) }}
|
{{ show_slots(profile) }}
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans %}Not subscribed{% endtrans %}
|
{% trans %}Not subscribed{% endtrans %}
|
||||||
{% if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) %}
|
{% if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) %}
|
||||||
|
Loading…
Reference in New Issue
Block a user