Skip to content

Commit b629e99

Browse files
Enforcer email lowercase fix (#2103)
* enforcer invalidate & cache dump API exposed * cache not enabled check * email lowecase fix
1 parent b0a94b0 commit b629e99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/user/casbin/rbac.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ type EnforcerImpl struct {
110110

111111
// Enforce is a wrapper around casbin.Enforce to additionally enforce a default role and a custom
112112
// claims function
113-
func (e *EnforcerImpl) Enforce(emailId string, resource string, action string, resourceItem string) bool {
114-
return e.enforce(emailId, resource, action, resourceItem)
113+
func (e *EnforcerImpl) Enforce(token string, resource string, action string, resourceItem string) bool {
114+
return e.enforce(token, resource, action, resourceItem)
115115
}
116116

117117
func (e *EnforcerImpl) EnforceByEmail(emailId string, resource string, action string, resourceItem string) bool {
@@ -358,7 +358,7 @@ func (e *EnforcerImpl) enforce(token string, resource string, action string, res
358358
if invalid {
359359
return false
360360
}
361-
return e.enforceByEmail(email, resource, action, resourceItem)
361+
return e.enforceByEmail(strings.ToLower(email), resource, action, resourceItem)
362362
}
363363

364364
func (e *EnforcerImpl) enforceAndUpdateCache(email string, resource string, action string, resourceItem string) bool {

0 commit comments

Comments
 (0)