#31 API Share
* adds support for GET and PUT of sharing users for all data types (compensation is shared via intervention)
This commit is contained in:
@@ -245,6 +245,29 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin):
|
||||
# Compensations inherit their shared state from the interventions
|
||||
return self.intervention.is_shared_with(user)
|
||||
|
||||
def share_with(self, user: User):
|
||||
""" Adds user to list of shared access users
|
||||
|
||||
Args:
|
||||
user (User): The user to be added to the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if not self.intervention.is_shared_with(user):
|
||||
self.intervention.users.add(user)
|
||||
|
||||
def share_with_list(self, user_list: list):
|
||||
""" Sets the list of shared access users
|
||||
|
||||
Args:
|
||||
user_list (list): The users to be added to the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self.intervention.users.set(user_list)
|
||||
|
||||
@property
|
||||
def shared_users(self) -> QuerySet:
|
||||
""" Shortcut for fetching the users which have shared access on this object
|
||||
|
||||
Reference in New Issue
Block a user