Merge pull request #898 from opencloud-eu/fix#368

always get the user email for admin user
This commit is contained in:
Ralf Haferkamp
2025-05-21 17:58:27 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions
+3 -2
View File
@@ -557,8 +557,9 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) {
return
}
}
if !g.config.API.ShowUserEmailInResults {
ctxHasFullPerms := g.contextUserHasFullAccountPerms(r.Context())
if !ctxHasFullPerms && !g.config.API.ShowUserEmailInResults {
user.Mail = nil
}
@@ -581,6 +581,7 @@ var _ = Describe("Users", func() {
user := &libregraph.User{}
user.SetId("user1")
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settings.GetPermissionByIDResponse{}, nil)
identityBackend.On("GetUser", mock.Anything, mock.Anything, mock.Anything).Return(user, nil)
valueService.On("GetValueByUniqueIdentifiers", mock.Anything, mock.Anything, mock.Anything).
Return(&settings.GetValueResponse{
@@ -621,6 +622,7 @@ var _ = Describe("Users", func() {
user := &libregraph.User{}
user.SetId("user1")
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settings.GetPermissionByIDResponse{}, nil)
identityBackend.On("GetUser", mock.Anything, mock.Anything, mock.Anything).Return(user, nil)
gatewayClient.On("GetQuota", mock.Anything, mock.Anything, mock.Anything).Return(&provider.GetQuotaResponse{
Status: status.NewOK(ctx),
@@ -680,6 +682,7 @@ var _ = Describe("Users", func() {
user := &libregraph.User{}
user.SetId("user1")
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settings.GetPermissionByIDResponse{}, nil)
identityBackend.On("GetUser", mock.Anything, mock.Anything, mock.Anything).Return(user, nil)
gatewayClient.On("GetQuota", mock.Anything, mock.Anything, mock.Anything).Return(&provider.GetQuotaResponse{
Status: status.NewOK(ctx),
@@ -732,6 +735,7 @@ var _ = Describe("Users", func() {
user := &libregraph.User{}
user.SetId("user1")
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settings.GetPermissionByIDResponse{}, nil)
identityBackend.On("GetUser", mock.Anything, mock.Anything, mock.Anything).Return(user, nil)
assignments := []*settingsmsg.UserRoleAssignment{