mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +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)
|
object.ExtendUserWithRolesAndPermissions(user)
|
||||||
|
|
||||||
|
user.Permissions = object.GetMaskedPermissions(user.Permissions)
|
||||||
|
user.Roles = object.GetMaskedRoles(user.Roles)
|
||||||
|
|
||||||
organization := object.GetMaskedOrganization(object.GetOrganizationByUser(user))
|
organization := object.GetMaskedOrganization(object.GetOrganizationByUser(user))
|
||||||
resp := Response{
|
resp := Response{
|
||||||
Status: "ok",
|
Status: "ok",
|
||||||
|
@ -269,3 +269,12 @@ func ContainsAsterisk(userId string, users []string) bool {
|
|||||||
|
|
||||||
return containsAsterisk
|
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()
|
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