Skip to content

Commit f36ab11

Browse files
committed
fix: duplication bug
1 parent a4c5375 commit f36ab11

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

apps/api/src/lib/roles.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export function hasPermission(
2626
requireAll: boolean = true
2727
): boolean {
2828
// Admins have all permissions
29-
if (user?.isAdmin) {
30-
return true;
31-
}
29+
if (user?.isAdmin) {
30+
return true;
31+
}
3232

3333
// Convert single permission to array for consistent handling
3434
const permissions = Array.isArray(requiredPermissions)
@@ -93,15 +93,16 @@ export function requirePermission(
9393

9494
if (!hasPermission(userWithRoles, requiredPermissions, requireAll)) {
9595
return res.status(401).send({
96-
message: "You do not have the required permission to access this resource.",
96+
message:
97+
"You do not have the required permission to access this resource.",
9798
success: false,
9899
status: 403,
99100
});
100101
}
101102

102-
next();
103+
return;
103104
} else {
104-
next();
105+
return;
105106
}
106107
} catch (error) {
107108
next(error);

0 commit comments

Comments
 (0)