Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Change params to subject, action, object
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Sep 2, 2020
1 parent 02799be commit 28b0b14
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/_staart/helpers/authorization.ts
Original file line number Diff line number Diff line change
@@ -98,8 +98,8 @@ model.loadModelFromText(readFileSync(join(".", "casbin-model.conf"), "utf-8"));

export const can = async (
subject: number | ApiKeyResponse | AccessTokenResponse,
object: string,
action: string
action: string,
object: string
) => {
if (typeof subject === "number") {
console.log("Subject is", subject);
2 changes: 1 addition & 1 deletion src/_staart/rest/user.ts
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ export const deleteUserForUser = async (
updateUserId: number,
locals: Locals | any
) => {
if (!(await can(tokenUserId, `${Acts.DELETE}`, `user-${updateUserId}`)))
if (!(await can(tokenUserId, Acts.DELETE, `user-${updateUserId}`)))
throw new Error(INSUFFICIENT_PERMISSION);

const groupsToDelete = await prisma.groups.findMany({

0 comments on commit 28b0b14

Please sign in to comment.