mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
fix(secure): remove user list from roles and permissions field to avoid leaking userlist (#1614)
* fix(secure): remove user list from roles and permissions field to avoid leaking userlist Signed-off-by: fengxsong <fengxsong@outlook.com> * Update permission.go * Update role.go --------- Signed-off-by: fengxsong <fengxsong@outlook.com> Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
@ -245,6 +245,10 @@ func GetPermissionsByUser(userId string) []*Permission {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for i := range permissions {
|
||||
permissions[i].Users = nil
|
||||
}
|
||||
|
||||
return permissions
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,10 @@ func GetRolesByUser(userId string) []*Role {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for i := range roles {
|
||||
roles[i].Users = nil
|
||||
}
|
||||
|
||||
return roles
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user