@abtnode/constant
Advanced tools
Comparing version
75
index.js
@@ -21,3 +21,10 @@ const NODE_SERVICES = Object.freeze({ | ||
CERTIFICATE: 'certificate', | ||
BLOCKLET: 'blocklet', | ||
// blocklet user or sdk. must start with 'blocklet- | ||
BLOCKLET_OWNER: 'blocklet-owner', | ||
BLOCKLET_ADMIN: 'blocklet-admin', | ||
BLOCKLET_MEMBER: 'blocklet-member', | ||
BLOCKLET_SDK: 'blocklet-sdk', | ||
// external user | ||
EXTERNAL_BLOCKLET_CONTROLLER: 'external-blocklet-controller', | ||
@@ -27,6 +34,15 @@ EXTERNAL_BLOCKLETS_MANAGER: 'external-blocklets-manager', | ||
const isBlockletRole = (role) => | ||
role && | ||
[ | ||
SERVER_ROLES.BLOCKLET_OWNER, | ||
SERVER_ROLES.BLOCKLET_ADMIN, | ||
SERVER_ROLES.BLOCKLET_MEMBER, | ||
SERVER_ROLES.BLOCKLET_SDK, | ||
].includes(role); | ||
const AUTH_CERT_TYPE = { | ||
USER: 'user', | ||
OWNERSHIP_NFT: 'ownership_nft', | ||
BLOCKLET: 'blocklet', | ||
BLOCKLET_USER: 'blocklet_user', | ||
BLOCKLET_CONTROLLER: 'blocklet_controller', | ||
@@ -78,7 +94,18 @@ }; | ||
{ | ||
name: SERVER_ROLES.BLOCKLET, | ||
title: 'Blocklet', | ||
// passport: true, // TODO enable this when we support access key for manage single blocklet | ||
name: SERVER_ROLES.BLOCKLET_OWNER, | ||
title: 'Blocklet Owner', | ||
}, | ||
{ | ||
name: SERVER_ROLES.BLOCKLET_ADMIN, | ||
title: 'Blocklet Admin', | ||
}, | ||
{ | ||
name: SERVER_ROLES.BLOCKLET_MEMBER, | ||
title: 'Blocklet Member', | ||
}, | ||
{ | ||
name: SERVER_ROLES.BLOCKLET_SDK, | ||
title: 'Blocklet SDK', | ||
}, | ||
{ | ||
name: SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER, | ||
@@ -135,11 +162,7 @@ title: 'External Blocklet Controller', | ||
{ | ||
name: 'manage_blocklet', | ||
description: 'Manage a single blocklet', | ||
}, | ||
{ | ||
name: 'query_blocklet', | ||
name: 'query_blockets', | ||
description: 'View store and installed blocklets, including blocklet runtime configuration, domains and urls', | ||
}, | ||
{ | ||
name: 'mutate_blocklet', | ||
name: 'mutate_blockets', | ||
description: 'Perform state changing actions on blocklets, such as install/upgrade/config/start/stop/remove', | ||
@@ -179,6 +202,14 @@ }, | ||
}, | ||
{ | ||
name: 'query_blocklet', | ||
description: 'View a blocklet, including blocklet runtime configuration, domains and urls', | ||
}, | ||
{ | ||
name: 'mutate_blocklet', | ||
description: 'Perform state changing actions on a blocklet, such as upgrade/config/start/stop', | ||
}, | ||
]), | ||
grants: Object.freeze({ | ||
[SERVER_ROLES.GUEST]: [ | ||
'query_blocklet', | ||
'query_blockets', | ||
'query_router', | ||
@@ -194,3 +225,3 @@ 'query_webhook', | ||
SERVER_ROLES.GUEST, | ||
'mutate_blocklet', | ||
'mutate_blockets', | ||
'mutate_router', | ||
@@ -209,10 +240,14 @@ 'mutate_notification', | ||
[SERVER_ROLES.OWNER]: [ROLES.ADMIN], | ||
[SERVER_ROLES.CI]: ['query_blocklet', 'mutate_blocklet'], | ||
[SERVER_ROLES.CI]: ['query_blockets', 'mutate_blockets'], | ||
[SERVER_ROLES.CERTIFICATE]: ['query_certificate', 'mutate_certificate'], | ||
[SERVER_ROLES.BLOCKLET]: ['query_team', 'mutate_team', 'manage_blocklet'], | ||
[SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER]: ['query_blocklet', 'mutate_blocklet'], | ||
[SERVER_ROLES.EXTERNAL_BLOCKLETS_MANAGER]: ['query_blocklet', 'mutate_blocklet'], | ||
// for backwards compatibility | ||
[NODE_SERVICES.AUTH_SERVICE]: ['query_team', 'mutate_team'], | ||
// blocklet app or blocklet user | ||
[SERVER_ROLES.BLOCKLET_SDK]: ['query_team', 'mutate_team'], | ||
[SERVER_ROLES.BLOCKLET_OWNER]: [SERVER_ROLES.BLOCKLET_ADMIN], | ||
[SERVER_ROLES.BLOCKLET_ADMIN]: [SERVER_ROLES.BLOCKLET_MEMBER, 'mutate_team', 'mutate_blocklet'], | ||
[SERVER_ROLES.BLOCKLET_MEMBER]: ['query_team', 'query_blocklet'], | ||
// external user | ||
[SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER]: ['query_blockets', 'mutate_blockets'], | ||
[SERVER_ROLES.EXTERNAL_BLOCKLETS_MANAGER]: ['query_blockets', 'mutate_blockets'], | ||
}), | ||
@@ -342,2 +377,3 @@ }; | ||
DEFAULT_DAEMON_PORT: 8089, | ||
MAX_NGINX_WORKER_CONNECTIONS: 10240, | ||
@@ -366,2 +402,3 @@ BLOCKLET_PROXY_PATH_PREFIX: '/.blocklet/proxy', | ||
SERVER_ROLES, | ||
isBlockletRole, | ||
AUTH_CERT_TYPE, | ||
@@ -368,0 +405,0 @@ RBAC_CONFIG, |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "1.8.34", | ||
"version": "1.8.35", | ||
"description": "ABT Node constants", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "c5fbb8e57493db62f212217cfde1980c82f00297" | ||
"gitHead": "dd89e7a61dc8cff64302608ad5ab6545dd903daa" | ||
} |
12789
8.5%384
9.4%