# 308 To share info message

* adds needs-to-be-shared info message on entries which are only shared with the current user
This commit is contained in:
2023-03-07 07:17:08 +01:00
parent 4d3831f30b
commit f22b45b82b
9 changed files with 212 additions and 119 deletions

View File

@@ -516,6 +516,24 @@ class ShareableObjectMixin(models.Model):
is_shared = directly_shared or team_shared
return is_shared
def is_only_shared_with(self, user):
""" Sharing check
Checks whether a given user is the only shared user for this object.
There should be no shared teams as well.
Args:
user ():
Returns:
"""
has_shared_teams = self.shared_teams.exists()
shared_users = self.shared_users
is_only_shared_user = user in shared_users and shared_users.count() == 1
return not has_shared_teams and is_only_shared_user
def share_with_team(self, team):
""" Adds team to list of shared access teans

View File

@@ -23,6 +23,7 @@ RECORDED_BLOCKS_EDIT = _("Entry is recorded. To edit data, the entry first needs
DATA_UNSHARED = _("This data is not shared with you")
DATA_UNSHARED_EXPLANATION = _("Remember: This data has not been shared with you, yet. This means you can only read but can not edit or perform any actions like running a check or recording.")
DATA_SHARE_SET = _("Share settings updated")
DO_NOT_FORGET_TO_SHARE = _("Do not forget to share your entry! Currently you are the only one having shared access.")
# FILES
FILE_TYPE_UNSUPPORTED = _("Unsupported file type")