fix(gateway): Profile 포괄 운영 권한 제거
This commit is contained in:
@@ -18,9 +18,9 @@ const turnDaemonAdminProcedure = authedProcedure.use(({ ctx, next }) => {
|
||||
roles.includes('superuser') ||
|
||||
roles.includes('admin') ||
|
||||
roles.includes('admin.superuser') ||
|
||||
roles.includes('admin.profiles.manage') ||
|
||||
roles.includes('admin.profiles.manage:*') ||
|
||||
roles.includes(`admin.profiles.manage:${profileName}`);
|
||||
roles.includes('admin.profiles.runtime') ||
|
||||
roles.includes('admin.profiles.runtime:*') ||
|
||||
roles.includes(`admin.profiles.runtime:${profileName}`);
|
||||
if (!canManageProfile) {
|
||||
throw new TRPCError({
|
||||
code: 'FORBIDDEN',
|
||||
|
||||
@@ -803,6 +803,26 @@ describe('appRouter', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('accepts the scoped profile runtime permission for turn daemon control', async () => {
|
||||
const auth = buildAuth();
|
||||
auth.user.roles = ['admin.profiles.runtime:che:default'];
|
||||
const caller = appRouter.createCaller(buildContext({ auth }));
|
||||
|
||||
await expect(caller.turnDaemon.run({ reason: 'manual' })).resolves.toMatchObject({ accepted: true });
|
||||
await expect(caller.turnDaemon.pause()).resolves.toMatchObject({ accepted: true });
|
||||
await expect(caller.turnDaemon.resume()).resolves.toMatchObject({ accepted: true });
|
||||
await expect(caller.turnDaemon.status()).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
it('rejects the removed umbrella profile permission for turn daemon control', async () => {
|
||||
const auth = buildAuth();
|
||||
auth.user.roles = ['admin.profiles.manage:che:default'];
|
||||
const caller = appRouter.createCaller(buildContext({ auth }));
|
||||
|
||||
await expect(caller.turnDaemon.run({ reason: 'manual' })).rejects.toMatchObject({ code: 'FORBIDDEN' });
|
||||
await expect(caller.turnDaemon.status()).rejects.toMatchObject({ code: 'FORBIDDEN' });
|
||||
});
|
||||
|
||||
it('rejects unauthenticated turn daemon control', async () => {
|
||||
const caller = appRouter.createCaller(buildContext({ auth: null }));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user