@@ -43,12 +43,13 @@ export class RoleGuardService implements CanActivate {
43
43
const bannedRoles = this . parseRoleConstraints ( view . access . bannedRole , url ) ;
44
44
const allowedRoles = this . parseRoleConstraints ( view . access . role , url ) ;
45
45
46
- if ( bannedRoles . length == 0 && allowedRoles . length == 0 ) {
46
+ if ( bannedRoles . some ( role => this . decideAccessByRole ( role ) ) ) {
47
47
return false ;
48
48
}
49
49
50
- if ( bannedRoles . some ( role => this . decideAccessByRole ( role ) ) ) {
51
- return false ;
50
+ if ( allowedRoles . length === 0 ) {
51
+ this . _log . warn ( `View at '${ url } ' defines role access constraint with an empty array!`
52
+ + ` No users will be allowed to enter this view!` ) ;
52
53
}
53
54
return allowedRoles . some ( role => this . decideAccessByRole ( role ) ) ; // user was not denied access by a banned role, they need at least one allowed role
54
55
}
@@ -62,6 +63,10 @@ export class RoleGuardService implements CanActivate {
62
63
63
64
if ( view . access . hasOwnProperty ( 'role' ) ) {
64
65
const allowedRoles = this . parseRoleConstraints ( view . access . role , url ) ;
66
+ if ( allowedRoles . length === 0 ) {
67
+ this . _log . warn ( `View at '${ url } ' defines role access constraint with an empty array!`
68
+ + ` No users will be allowed to enter this view!` ) ;
69
+ }
65
70
return allowedRoles . some ( constraint => {
66
71
return this . decideAccessByRole ( constraint ) ;
67
72
} ) ;
@@ -77,8 +82,6 @@ export class RoleGuardService implements CanActivate {
77
82
}
78
83
if ( Array . isArray ( roleConstrains ) ) {
79
84
if ( roleConstrains . length === 0 ) {
80
- this . _log . warn ( `View at '${ viewUrl } ' defines role access constraint with an empty array!`
81
- + ` No users will be allowed to enter this view!` ) ;
82
85
return [ ] ;
83
86
}
84
87
if ( typeof roleConstrains [ 0 ] === 'string' ) {
0 commit comments