-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update "Get target subjects by respondent" endpoint to include …
…`teamMemberCanViewData` property (M2-8464) (#1702) This PR updates the structure of the subjects being returned by the "Get target subjects by respondent" endpoint. Each subject now includes a `teamMemberCanViewData` property, which indicates whether the logged-in admin user calling the endpoint can view the data of that particular subject.
- Loading branch information
1 parent
80d54be
commit adbe344
Showing
4 changed files
with
208 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import uuid | ||
|
||
from apps.applets.domain import UserAppletAccess | ||
from apps.workspaces.crud.applet_access import AppletAccessCRUD | ||
|
||
__all__ = ["AppletAccessService"] | ||
|
||
|
||
class AppletAccessService: | ||
def __init__(self, session): | ||
self.session = session | ||
|
||
async def get_priority_access(self, applet_id: uuid.UUID, user_id: uuid.UUID) -> UserAppletAccess | None: | ||
""" | ||
Get the user's access to an applet with the most permissions. Returns accesses in this order: | ||
1. Owner | ||
2. Manager | ||
3. Coordinator | ||
4. Editor | ||
5. Reviewer | ||
6. Respondent | ||
:param applet_id: | ||
:param user_id: | ||
:return: | ||
""" | ||
schema = await AppletAccessCRUD(self.session).get_priority_access(applet_id, user_id) | ||
if not schema: | ||
return None | ||
|
||
return UserAppletAccess.from_orm(schema) |