Skip to content

Commit

Permalink
fix: admin dev pass
Browse files Browse the repository at this point in the history
  • Loading branch information
DaKingKong committed Dec 18, 2024
1 parent cb23741 commit b6d8ecf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ DATABASE_URL=sqlite://./db.sqlite
TEST_CRM_CLIENT_ID=
TEST_CRM_CLIENT_SECRET=
TEST_CRM_TOKEN_URI=
TEST_CRM_REDIRECT_URI=https://ringcentral.github.io/ringcentral-embeddable/redirect.html
TEST_CRM_REDIRECT_URI=https://ringcentral.github.io/ringcentral-embeddable/redirect.html


# Admin
ADMIN_EXTENSION_ID_DEV_PASS_LIST=1234567890
4 changes: 3 additions & 1 deletion serverless-deploy/sample.env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ TEST_CRM_CLIENT_SECRET:
TEST_CRM_ACCESS_TOKEN_URI:
TEST_CRM_REDIRECT_URI:

DATABASE_URL:
DATABASE_URL:

ADMIN_EXTENSION_ID_DEV_PASS_LIST:
2 changes: 1 addition & 1 deletion src/core/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function validateAdminRole({ rcAccessToken }) {
},
});
return {
isValidated: !!rcExtensionResponse.data?.permissions?.admin?.enabled || rcExtensionResponse.data.name === 'Da Kong' || rcExtensionResponse.data.name === 'Embbnux Ji',
isValidated: !!rcExtensionResponse.data?.permissions?.admin?.enabled || (!!process.env.ADMIN_EXTENSION_ID_DEV_PASS_LIST && process.env.ADMIN_EXTENSION_ID_DEV_PASS_LIST.split(',').includes(rcExtensionResponse.data.id.toString())),
rcAccountId: rcExtensionResponse.data.account.id
};
}
Expand Down

0 comments on commit b6d8ecf

Please sign in to comment.