If current user is in the group defined ldap_group_admin_dn, it doesn't have the harbor admin role.

The current solution only fix the /api/users/currentuser, but for /api/users/:id it can display the real information. see issue #5620

Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
stonezdj 2018-08-15 15:12:13 +08:00
parent 11f79e369c
commit 764c43c995

View File

@ -116,6 +116,9 @@ func (ua *UserAPI) Get() {
ua.CustomAbort(http.StatusInternalServerError, "Internal error.")
}
u.Password = ""
if ua.userID == ua.currentUserID {
u.HasAdminRole = ua.SecurityCtx.IsSysAdmin()
}
ua.Data["json"] = u
ua.ServeJSON()
return