filter user e-mail in graph/user requests
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user