mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-07 03:50:30 -05:00
filter user e-mail in graph/user requests
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -5,3 +5,4 @@ the sharee search. This is the ocis side which adds an suiting config option to
|
||||
|
||||
https://github.com/owncloud/ocis/issues/8726
|
||||
https://github.com/cs3org/reva/pull/4603
|
||||
https://github.com/owncloud/ocis/pull/8764
|
||||
|
||||
@@ -2,5 +2,6 @@ package config
|
||||
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;GRAPH_JWT_SECRET" desc:"The secret to mint and validate jwt tokens." introductionVersion:"pre5.0"`
|
||||
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;GRAPH_JWT_SECRET" desc:"The secret to mint and validate jwt tokens." introductionVersion:"pre5.0"`
|
||||
ShowUserEmailInResults bool `yaml:"mask_user_email" env:"OCIS_SHOW_USER_EMAIL_IN_RESULTS" desc:"Mask user email addresses in responses." introductionVersion:"5.1"`
|
||||
}
|
||||
|
||||
@@ -279,9 +279,12 @@ func (g Graph) GetUsers(w http.ResponseWriter, r *http.Request) {
|
||||
finalUsers[i] = &libregraph.User{
|
||||
Id: u.Id,
|
||||
DisplayName: u.DisplayName,
|
||||
Mail: u.Mail,
|
||||
UserType: u.UserType,
|
||||
}
|
||||
|
||||
if g.config.TokenManager.ShowUserEmailInResults {
|
||||
finalUsers[i].Mail = u.Mail
|
||||
}
|
||||
}
|
||||
users = finalUsers
|
||||
}
|
||||
@@ -545,6 +548,10 @@ func (g Graph) GetUser(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if !g.config.TokenManager.ShowUserEmailInResults {
|
||||
user.Mail = nil
|
||||
}
|
||||
|
||||
render.Status(r, http.StatusOK)
|
||||
render.JSON(w, r, user)
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ package config
|
||||
// TokenManager is the config for using the reva token manager
|
||||
type TokenManager struct {
|
||||
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;OCS_JWT_SECRET" desc:"The secret to mint and validate jwt tokens." introductionVersion:"pre5.0"`
|
||||
ShowUserEmailInResults bool `yaml:"mask_user_email" env:"OCS_SHOW_USER_EMAIL_IN_RESULTS" desc:"Mask user email addresses in responses." introductionVersion:"5.1"`
|
||||
ShowUserEmailInResults bool `yaml:"mask_user_email" env:"OCIS_SHOW_USER_EMAIL_IN_RESULTS" desc:"Mask user email addresses in responses." introductionVersion:"5.1"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user