Skip to content

Commit

Permalink
fix: update permission name
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Oct 22, 2024
1 parent 865eab1 commit fb1236f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions integration-tests/tests/api/oidc-integrations/crud.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('create', () => {
expect(errors).toEqual(
expect.arrayContaining([
expect.objectContaining({
message: `No access (reason: "Missing organization:integrations permission")`,
message: `No access (reason: "Missing permission for performing 'oidc:modify' on resource")`,
}),
]),
);
Expand Down Expand Up @@ -545,7 +545,7 @@ describe('delete', () => {
expect(errors).toEqual(
expect.arrayContaining([
expect.objectContaining({
message: `No access (reason: "Missing organization:integrations permission")`,
message: `No access (reason: "Missing permission for performing 'oidc:modify' on resource")`,
}),
]),
);
Expand Down Expand Up @@ -742,7 +742,7 @@ describe('update', () => {
expect(errors).toEqual(
expect.arrayContaining([
expect.objectContaining({
message: `No access (reason: "Missing organization:integrations permission")`,
message: `No access (reason: "Missing permission for performing 'oidc:modify' on resource")`,
}),
]),
);
Expand Down
7 changes: 4 additions & 3 deletions packages/services/api/src/modules/auth/lib/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export abstract class Session {
for (const action of actions) {
if (isActionMatch(action, args.action)) {
if (permission.effect === 'deny') {
throw new AccessError(`Missing permissions '${args.action}' on resource.`);
throw new AccessError(`Missing permission for performing '${args.action}' on resource`);
} else {
isAllowed = true;
}
Expand All @@ -112,7 +112,7 @@ export abstract class Session {
}

if (!isAllowed) {
throw new AccessError(`Missing permissions '${args.action}' on resource.`);
throw new AccessError(`Missing permission for performing '${args.action}' on resource`);
}
}
}
Expand Down Expand Up @@ -235,7 +235,8 @@ const actionDefinitions = {
'project:delete': defaultProjectIdentity,
'alert:modify': defaultProjectIdentity,
'project:updateSlug': defaultProjectIdentity,
'schemaLinting:manage': defaultProjectIdentity,
'schemaLinting:manageOrganization': defaultProjectIdentity,
'schemaLinting:manageProject': defaultProjectIdentity,
'target:create': defaultProjectIdentity,
'target:delete': defaultTargetIdentity,
'schemaCheck:create': schemaCheckOrPublishIdentity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function transformLegacyPolicies(
action: ['support:manageTickets'],
resource: [`hrn:${organizationId}:*`],
});
break;
}
case OrganizationAccessScope.SETTINGS: {
policies.push({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import SessionNode from 'supertokens-node/recipe/session/index.js';
import * as zod from 'zod';
import { User } from '@hive/api';
import type { FastifyReply, FastifyRequest, ServiceLogger } from '@hive/service-common';
import { captureException } from '@sentry/node';
import type { User } from '../../../shared/entities';
import { AccessError, HiveError } from '../../../shared/errors';
import { isUUID } from '../../../shared/is-uuid';
import type { Storage } from '../../shared/providers/storage';
Expand Down

0 comments on commit fb1236f

Please sign in to comment.