mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-12-05 08:03:01 +00:00
1 parent
81c1fd20ef
commit
fde819b05a
1 file changed
+4
-2
+4
-2
@@ -26,8 +26,10 @@ func GetGroups(c *gin.Context) {
|
||||
func GetUserGroups(c *gin.Context) {
|
||||
usableGroups := make(map[string]map[string]any)
|
||||
userGroup := ""
|
||||
userId := c.GetInt("id")
|
||||
userGroup, _ = model.GetUserGroup(userId, false)
|
||||
// /api/user/groups is public, so anonymous requests have no user id and use the public groups
|
||||
if userId := c.GetInt("id"); userId > 0 {
|
||||
userGroup, _ = model.GetUserGroup(userId, false)
|
||||
}
|
||||
userUsableGroups := service.GetUserUsableGroups(userGroup)
|
||||
for groupName, _ := range ratio_setting.GetGroupRatioCopy() {
|
||||
// UserUsableGroups contains the groups that the user can use
|
||||
|
||||
Reference in new issue
Block a user