Expose smtp and sso settings to team admins (#25322)
## For #25320 - [x] Added/updated automated tests - [ ] A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it) - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
co-authored by
Jacob Shandling
parent
18bdab7a67
commit
d26afe3e62
@@ -134,13 +134,29 @@ func getAppConfigEndpoint(ctx context.Context, request interface{}, svc fleet.Se
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Only the Global Admin should be able to see see SMTP, SSO and osquery agent settings.
|
||||
isGlobalAdmin := vc.User.GlobalRole != nil && *vc.User.GlobalRole == fleet.RoleAdmin
|
||||
isAnyTeamAdmin := false
|
||||
if vc.User.Teams != nil {
|
||||
// check if the user is an admin for any team
|
||||
for _, team := range vc.User.Teams {
|
||||
if team.Role == fleet.RoleAdmin {
|
||||
isAnyTeamAdmin = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only admins should see SMTP and SSO settings
|
||||
var smtpSettings *fleet.SMTPSettings
|
||||
var ssoSettings *fleet.SSOSettings
|
||||
var agentOptions *json.RawMessage
|
||||
if vc.User.GlobalRole != nil && *vc.User.GlobalRole == fleet.RoleAdmin {
|
||||
if isGlobalAdmin || isAnyTeamAdmin {
|
||||
smtpSettings = appConfig.SMTPSettings
|
||||
ssoSettings = appConfig.SSOSettings
|
||||
}
|
||||
|
||||
// Only global admins should see osquery agent settings.
|
||||
var agentOptions *json.RawMessage
|
||||
if isGlobalAdmin {
|
||||
agentOptions = appConfig.AgentOptions
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user