Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🔒 Update manager privileges
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Jul 31, 2019
1 parent 66c4854 commit 3a4d48c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "staart-manager",
"version": "1.0.111",
"version": "1.0.112",
"main": "index.js",
"repository": "[email protected]:AnandChowdhary/staart.git",
"author": "Anand Chowdhary <[email protected]>",
Expand Down Expand Up @@ -135,5 +135,5 @@
"setup"
],
"snyk": true,
"staart-version": "1.0.111"
"staart-version": "1.0.112"
}
18 changes: 14 additions & 4 deletions src/helpers/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,26 @@ const canUserOrganization = async (
// An organization admin can do anything too
if (membership.role == MembershipRole.ADMIN) allowed = true;

// An organization manager can do anything but delete
// An organization manager can do some things
if (
membership.role == MembershipRole.MANAGER &&
action != Authorizations.DELETE &&
action != Authorizations.DELETE_SECURE &&
action != OrgScopes.DELETE_ORG &&
action != OrgScopes.DELETE_ORG_API_KEYS &&
action != OrgScopes.DELETE_ORG_DOMAINS &&
action != OrgScopes.READ_ORG_BILLING &&
action != OrgScopes.UPDATE_ORG_BILLING &&
action != OrgScopes.READ_ORG_SUBSCRIPTIONS &&
action != OrgScopes.UPDATE_ORG_SUBSCRIPTIONS &&
action != OrgScopes.CREATE_ORG_SUBSCRIPTIONS &&
action != OrgScopes.READ_ORG_INVOICES &&
action != OrgScopes.READ_ORG_PLANS &&
action != OrgScopes.READ_ORG_SOURCES &&
action != OrgScopes.UPDATE_ORG_SOURCES &&
action != OrgScopes.DELETE_ORG_SOURCES &&
action != OrgScopes.DELETE_ORG_WEBHOOKS
action != OrgScopes.CREATE_ORG_SOURCES &&
action != OrgScopes.CREATE_ORG_WEBHOOKS &&
action != OrgScopes.DELETE_ORG_WEBHOOKS &&
action != OrgScopes.UPDATE_ORG_WEBHOOKS
)
allowed = true;

Expand Down

0 comments on commit 3a4d48c

Please sign in to comment.