first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
import type { Scope } from '@/types.ee';
|
||||
|
||||
import type { PermissionsRecord } from '../get-resource-permissions.ee';
|
||||
import { getResourcePermissions } from '../get-resource-permissions.ee';
|
||||
|
||||
describe('permissions', () => {
|
||||
it('getResourcePermissions for empty scopes', () => {
|
||||
expect(getResourcePermissions()).toEqual({
|
||||
aiAssistant: {},
|
||||
annotationTag: {},
|
||||
auditLogs: {},
|
||||
banner: {},
|
||||
community: {},
|
||||
communityPackage: {},
|
||||
credential: {},
|
||||
externalSecretsProvider: {},
|
||||
externalSecret: {},
|
||||
eventBusDestination: {},
|
||||
execution: {},
|
||||
ldap: {},
|
||||
license: {},
|
||||
logStreaming: {},
|
||||
oidc: {},
|
||||
orchestration: {},
|
||||
project: {},
|
||||
saml: {},
|
||||
provisioning: {},
|
||||
securityAudit: {},
|
||||
securitySettings: {},
|
||||
sourceControl: {},
|
||||
tag: {},
|
||||
user: {},
|
||||
variable: {},
|
||||
projectVariable: {},
|
||||
workersView: {},
|
||||
workflow: {},
|
||||
workflowTags: {},
|
||||
folder: {},
|
||||
insights: {},
|
||||
dataTable: {},
|
||||
mcp: {},
|
||||
mcpApiKey: {},
|
||||
role: {},
|
||||
chatHub: {},
|
||||
chatHubAgent: {},
|
||||
breakingChanges: {},
|
||||
apiKey: {},
|
||||
credentialResolver: {},
|
||||
});
|
||||
});
|
||||
it('getResourcePermissions', () => {
|
||||
const scopes: Scope[] = [
|
||||
'credential:create',
|
||||
'credential:delete',
|
||||
'credential:list',
|
||||
'credential:move',
|
||||
'credential:read',
|
||||
'credential:share',
|
||||
'credential:update',
|
||||
'eventBusDestination:list',
|
||||
'eventBusDestination:test',
|
||||
'project:list',
|
||||
'project:read',
|
||||
'tag:create',
|
||||
'tag:list',
|
||||
'tag:read',
|
||||
'tag:update',
|
||||
'user:list',
|
||||
'variable:list',
|
||||
'variable:read',
|
||||
'projectVariable:list',
|
||||
'projectVariable:read',
|
||||
'workflow:create',
|
||||
'workflow:delete',
|
||||
'workflow:execute',
|
||||
'workflow:list',
|
||||
'workflow:move',
|
||||
'workflow:read',
|
||||
'workflow:share',
|
||||
'workflow:update',
|
||||
'folder:create',
|
||||
'insights:list',
|
||||
'breakingChanges:list',
|
||||
'apiKey:manage',
|
||||
];
|
||||
|
||||
const permissionRecord: PermissionsRecord = {
|
||||
aiAssistant: {},
|
||||
annotationTag: {},
|
||||
auditLogs: {},
|
||||
banner: {},
|
||||
community: {},
|
||||
communityPackage: {},
|
||||
credential: {
|
||||
create: true,
|
||||
delete: true,
|
||||
list: true,
|
||||
move: true,
|
||||
read: true,
|
||||
share: true,
|
||||
update: true,
|
||||
},
|
||||
eventBusDestination: {
|
||||
list: true,
|
||||
test: true,
|
||||
},
|
||||
externalSecret: {},
|
||||
externalSecretsProvider: {},
|
||||
ldap: {},
|
||||
license: {},
|
||||
logStreaming: {},
|
||||
orchestration: {},
|
||||
project: {
|
||||
list: true,
|
||||
read: true,
|
||||
},
|
||||
saml: {},
|
||||
oidc: {},
|
||||
provisioning: {},
|
||||
mcp: {},
|
||||
mcpApiKey: {},
|
||||
securityAudit: {},
|
||||
securitySettings: {},
|
||||
sourceControl: {},
|
||||
tag: {
|
||||
create: true,
|
||||
list: true,
|
||||
read: true,
|
||||
update: true,
|
||||
},
|
||||
user: {
|
||||
list: true,
|
||||
},
|
||||
variable: {
|
||||
list: true,
|
||||
read: true,
|
||||
},
|
||||
projectVariable: {
|
||||
list: true,
|
||||
read: true,
|
||||
},
|
||||
workersView: {},
|
||||
workflow: {
|
||||
create: true,
|
||||
delete: true,
|
||||
execute: true,
|
||||
list: true,
|
||||
move: true,
|
||||
read: true,
|
||||
share: true,
|
||||
update: true,
|
||||
},
|
||||
folder: {
|
||||
create: true,
|
||||
},
|
||||
insights: {
|
||||
list: true,
|
||||
},
|
||||
dataTable: {},
|
||||
execution: {},
|
||||
workflowTags: {},
|
||||
role: {},
|
||||
chatHub: {},
|
||||
chatHubAgent: {},
|
||||
breakingChanges: {
|
||||
list: true,
|
||||
},
|
||||
apiKey: {
|
||||
manage: true,
|
||||
},
|
||||
credentialResolver: {},
|
||||
};
|
||||
|
||||
expect(getResourcePermissions(scopes)).toEqual(permissionRecord);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user