mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
fix: add GetMaskedRoles and GetMaskedPermissions when GetAccount (#1456)
This commit is contained in:
parent
c8846f1a2d
commit
dcf148fb7f
@ -273,6 +273,9 @@ func (c *ApiController) GetAccount() {
|
||||
|
||||
object.ExtendUserWithRolesAndPermissions(user)
|
||||
|
||||
user.Permissions = object.GetMaskedPermissions(user.Permissions)
|
||||
user.Roles = object.GetMaskedRoles(user.Roles)
|
||||
|
||||
organization := object.GetMaskedOrganization(object.GetOrganizationByUser(user))
|
||||
resp := Response{
|
||||
Status: "ok",
|
||||
|
@ -269,3 +269,12 @@ func ContainsAsterisk(userId string, users []string) bool {
|
||||
|
||||
return containsAsterisk
|
||||
}
|
||||
|
||||
func GetMaskedPermissions(permissions []*Permission) []*Permission {
|
||||
for _, permission := range permissions {
|
||||
permission.Users = nil
|
||||
permission.Submitter = ""
|
||||
}
|
||||
|
||||
return permissions
|
||||
}
|
||||
|
@ -192,3 +192,11 @@ func roleChangeTrigger(oldName string, newName string) error {
|
||||
|
||||
return session.Commit()
|
||||
}
|
||||
|
||||
func GetMaskedRoles(roles []*Role) []*Role {
|
||||
for _, role := range roles {
|
||||
role.Users = nil
|
||||
}
|
||||
|
||||
return roles
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user