File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments