keyshade icon indicating copy to clipboard operation
keyshade copied to clipboard

API: Update `authority-checker.service.ts` to allow checking for multiple authorities

Open rajdip-b opened this issue 9 months ago • 2 comments

Description

The authority check input in authority-checker.service.ts file currently takes the following interface as its input type:

AuthorityInput {
  userId: string
  entity: {
    id?: string
    name?: string
  }
  authority: Authority
  prisma: PrismaClient
}

The problem with this approach is, we are not able to check multiple authorities at once. Ideally, we would want authority to be renamed to ...authorities: Authority[]. This will allow us to pass multiple authorities so that we can check them at once.

Ideally, we would like the comparison in the functions to be set difference operations.

Solution

  • Refactor the authority field and all its occurrences
  • Then, pass the required authorities and collective authorities into this function to check for any overlap.
  • Add relevant tests for each of project, environment, workspace, secret, variable and approval in individual .e2e.spec.ts files in the modules

rajdip-b avatar Apr 30 '24 15:04 rajdip-b