mirror of
https://github.com/ae-utbm/sith.git
synced 2026-11-20 16:09:54 +00:00
Proposition V1
This commit is contained in:
1 parent
bfa5fa45b8
commit
fc961f6511
36 files changed
+1984
No files matched your search
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from club.models import Club
|
||||
from core.models import User
|
||||
from stock.models import Stock
|
||||
|
||||
|
||||
def can_be_edited_by(user: User, club: Club):
|
||||
return user.groups.contains(club.stock_group) or user.is_root
|
||||
|
||||
|
||||
def can_be_view_by(user: User, club: Club, stock: Stock):
|
||||
return can_be_edited_by(user, club) or (
|
||||
stock.can_be_view_by_board and user.is_in_group(pk=club.stock_group)
|
||||
)
|
||||
Reference in new issue
Block a user