Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit bf6f7a8

Browse files
HasithDeAlwisMFarabi619
authored andcommitted
feat(axiom): add helper function to allow users to edit their own profile
1 parent 2ec27c2 commit bf6f7a8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libs/db/access/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ export const adminsAndUser: IsAuthenticated = ({ req: { user } }) => {
2424

2525
return false
2626
}
27+
28+
export const isSameUser: IsAuthenticated = ({ req : { user }, id }) => {
29+
if (!user) {
30+
return false;
31+
}
32+
33+
return user.id === id
34+
};
35+
2736
export const anyone: IsAuthenticated = () => true
2837

2938
export function checkRole(allRoles: User['roles'] = [], user: User = undefined): boolean {

0 commit comments

Comments
 (0)