-
Notifications
You must be signed in to change notification settings - Fork 22
Add invitations
query
#16
Add invitations
query
#16
Conversation
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
Still a draft because I need to add the appropriate permission migration in the authorization plugin. |
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
This is ready for review, but I think I'm missing something on the way object-specific permissions work. It would make sense to restrict this query to:
As it stands, I'm not sure it accomplishes this. If I pass a random shop ID (which doesn't exist as I only have one shop set up), it doesn't throw a permission error... But isn't it supposed to? |
Signed-off-by: Loan Laux <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See one big inline comment.
Regarding the invitations role, I think it would be best (at least for now) to use
await context.validatePermissions("reaction:legacy:groups", "manage:accounts", { shopId });
That is what we check before allowing you to create an invite in inviteShopMember
, so it makes sense that the same permission would let you see invitations? In the long run we might want something more like invitations
with read/write variations, but I'd go with simple solution for now.
Also the system manager global group already has manage:accounts
permission, so it should work to do the same change with null
shopId.
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
Signed-off-by: Loan Laux <[email protected]>
d3b31f7
to
6ef13b5
Compare
🎉 This PR is included in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #13
Impact: major
Type: feature
Test with api-plugin-authorization-simple#14
Test with api-utils#33
Issue
This plugin needs an
invitations
query to list all staff member invites, with paginated results and only allowed to admins.Solution
Create an
invitations
query using a MongoDB aggregate, which also enables querying for the invitation's shop, the account who sent the invite and the groups the person was invited to. Example:Breaking changes
None.
Testing
invitations
.