Skip to content

Commit

Permalink
renamed type
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier committed Jul 25, 2024
1 parent 6d2ab76 commit 15890fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions front/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
ACLType,
GroupType,
LightWorkspaceType,
Permission,
RoleType,
SupportedPermissionType,
UserType,
WhitelistableFeature,
WorkspaceType,
Expand Down Expand Up @@ -559,7 +559,7 @@ export class Authenticator {
return this._groups ? this._groups.map((group) => group.toJSON()) : [];
}

hasPermission(acls: ACLType[], permission: SupportedPermissionType): boolean {
hasPermission(acls: ACLType[], permission: Permission): boolean {
// Does the user belongs to a group which has the required permission on all ACLs ?
return this.groups().some((group) =>
acls.every((acl) => groupHasPermission(acl, permission, group.id))
Expand Down
6 changes: 3 additions & 3 deletions types/src/front/acl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { ModelId } from "../shared/model_id";
// Supported permissions
export const SUPPORTED_PERMISSIONS = ["read", "write"] as const;

export type SupportedPermissionType = (typeof SUPPORTED_PERMISSIONS)[number];
export type Permission = (typeof SUPPORTED_PERMISSIONS)[number];

// Access Control Entry
export type ACEType = {
groupId: ModelId;
permissions: SupportedPermissionType[];
permissions: Permission[];
};

// Access Control List
Expand All @@ -18,7 +18,7 @@ export type ACLType = {

export function groupHasPermission(
acl: ACLType,
permission: SupportedPermissionType,
permission: Permission,
groupId: ModelId
): boolean {
const entry = acl.aclEntries.find((ace) => ace.groupId === groupId);
Expand Down

0 comments on commit 15890fa

Please sign in to comment.