@@ -13,17 +13,17 @@ type AccessControlPolicy string
1313
1414const (
1515 PolicyAllow AccessControlPolicy = "allow"
16- PolicyBlock AccessControlPolicy = "block "
16+ PolicyDeny AccessControlPolicy = "deny "
1717)
1818
1919func accessControlPolicyFromString (s string ) (AccessControlPolicy , bool ) {
2020 switch strings .ToLower (s ) {
2121 case "allow" :
2222 return PolicyAllow , true
23- case "block " :
24- return PolicyBlock , true
23+ case "deny " :
24+ return PolicyDeny , true
2525 default :
26- return "" , false
26+ return PolicyAllow , false
2727 }
2828}
2929
@@ -49,17 +49,16 @@ func NewAccessControlsService(
4949 labelProvider : labelProvider ,
5050 }
5151
52- policy , ok := accessControlPolicyFromString (config .Auth .ACLS .Policy )
52+ policy , ok := accessControlPolicyFromString (config .Auth .ACLs .Policy )
5353
5454 if ! ok {
55- log .App .Warn ().Str ("policy" , config .Auth .ACLS .Policy ).Msg ("Invalid ACL policy in config, defaulting to 'allow'" )
56- service .policy = PolicyAllow
55+ log .App .Warn ().Str ("policy" , config .Auth .ACLs .Policy ).Msg ("Invalid ACL policy in config, defaulting to 'allow'" )
5756 }
5857
5958 if policy == PolicyAllow {
6059 log .App .Debug ().Msg ("Using 'allow' ACL policy: access to apps will be allowed by default unless explicitly blocked" )
6160 } else {
62- log .App .Debug ().Msg ("Using 'block ' ACL policy: access to apps will be blocked by default unless explicitly allowed" )
61+ log .App .Debug ().Msg ("Using 'deny ' ACL policy: access to apps will be blocked by default unless explicitly allowed" )
6362 }
6463
6564 service .policy = policy
@@ -121,7 +120,7 @@ func (service *AccessControlsService) IsUserAllowed(context model.UserContext, a
121120 }
122121
123122 service .log .App .Debug ().Msg ("Checking users allow list" )
124- return utils .CheckFilter (acls .Users .Allow , context .GetUsername ())
123+ return service . policyResult ( utils .CheckFilter (acls .Users .Allow , context .GetUsername () ))
125124}
126125
127126func (service * AccessControlsService ) IsInOAuthGroup (context model.UserContext , acls * model.App ) bool {
@@ -211,8 +210,8 @@ func (service *AccessControlsService) IsIPAllowed(ip string, acls *model.App) bo
211210 }
212211
213212 // Merge the global and app IP filter
214- blockedIps := append (service . config . Auth . IP .Block , acls .IP .Block ... )
215- allowedIPs := append (service . config . Auth . IP .Allow , acls .IP .Allow ... )
213+ blockedIps := append (acls . IP .Block , service . config . Auth .IP .Block ... )
214+ allowedIPs := append (acls . IP .Allow , service . config . Auth .IP .Allow ... )
216215
217216 for _ , blocked := range blockedIps {
218217 res , err := utils .FilterIP (blocked , ip )
0 commit comments