mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 12:45:47 +00:00
fix: fix oauth group check logic
This commit is contained in:
@@ -300,8 +300,8 @@ func (auth *AuthService) IsResourceAllowed(c *gin.Context, context config.UserCo
|
|||||||
return utils.CheckFilter(labels.Users.Allow, context.Username)
|
return utils.CheckFilter(labels.Users.Allow, context.Username)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserContext, groups string) bool {
|
func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserContext, requiredGroups string) bool {
|
||||||
if groups == "" {
|
if requiredGroups == "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,11 +310,8 @@ func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserConte
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to parse since they are from the API response
|
for _, userGroup := range strings.Split(context.OAuthGroups, ",") {
|
||||||
groupsSplit := strings.Split(groups, ",")
|
if utils.CheckFilter(requiredGroups, strings.TrimSpace(userGroup)) {
|
||||||
|
|
||||||
for _, group := range groupsSplit {
|
|
||||||
if utils.CheckFilter(groups, group) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user