Skip to content

Commit

Permalink
fix(permission): enhance the strictness of permissions (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirCute authored Dec 25, 2024
1 parent 66a081c commit 8f4b7a4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export const UserMethods = {
is_admin: (user: User) => user.role === UserRole.ADMIN,
is_general: (user: User) => user.role === UserRole.GENERAL,
can: (user: User, permission: number) => {
let adminPrivilege = UserMethods.is_admin(user) && permission < 10
return adminPrivilege || ((user.permission >> permission) & 1) == 1
return ((user.permission >> permission) & 1) == 1
},
// can_see_hides: (user: User) =>
// UserMethods.is_admin(user) || (user.permission & 1) == 1,
Expand Down

0 comments on commit 8f4b7a4

Please sign in to comment.