Skip to content

Commit

Permalink
Rename permissiosn checking functions
Browse files Browse the repository at this point in the history
  • Loading branch information
darunrs committed Apr 18, 2024
1 parent 3c73a21 commit a56b66a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runner/src/provisioner/provisioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,18 @@ export default class Provisioner {
return true;
}

return this.roleLacksPermissionsForTable(roleName, tablePermissionsMetadata, permissionsToCheck);
return this.tablePermissionsLackRole(roleName, tablePermissionsMetadata, permissionsToCheck);
});
}

private roleLacksPermissionsForTable (roleName: string, tablePermissionsMetadata: HasuraTableMetadata, permissionsToCheck: HasuraPermission[]): boolean {
private tablePermissionsLackRole (roleName: string, tablePermissionsMetadata: HasuraTableMetadata, permissionsToCheck: HasuraPermission[]): boolean {
return permissionsToCheck.some((permission: string) => {
const permissionAttribute = `${permission}_permissions` as keyof Omit<HasuraTableMetadata, 'table'>;
return this.roleLacksPermission(roleName, tablePermissionsMetadata[permissionAttribute]);
return this.permissionLacksRole(roleName, tablePermissionsMetadata[permissionAttribute]);
});
}

private roleLacksPermission (roleName: string, tablePermission: HasuraRolePermission[] | undefined): boolean {
private permissionLacksRole (roleName: string, tablePermission: HasuraRolePermission[] | undefined): boolean {
return !tablePermission?.some((roleWithPermission: { role: string }) => roleWithPermission.role === roleName);
}

Expand Down

0 comments on commit a56b66a

Please sign in to comment.