Implement permissions for POD project (client)
Context
There is a need to implement the appropriate permissions of POD project in order to comply with the rules provided here
Proposal
Design
Implementation (if applicable)
Based on the use of currentUser
and more specifically the resolved teams
attribute of that object all the rules defined in the spreadsheet provided in the Context section should be implemented.
- create helper functions that could be reused in many places of the UI that should answer to questions like
isOwner
,isCollaborator
,hasEditAccess
,isAdmin
, etc. - modify this by adding the
members
property in theteams
attribute e.g.
members {
id
user {
id
}
status
}
- the above helpers should accept params like
bookId
(bookId
will help on figuring out the specific book's team in theteams
array ofcurrentUser
) and in combination with current user's id (which will help figuring out the specific user inteam.members
) then a true or false response should be returned based on the value ofstatus