feat(keystone): add options to set admin and domain admin role to notify

This commit is contained in:
rainzm
2021-01-17 19:41:09 +08:00
parent c31368c41b
commit 349db2dce8
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -131,7 +131,7 @@ func fetchRoleId(name string) (string, error) {
}
func getAdminUserIds() ([]string, error) {
return getUserIdsWithRole("admin", "")
return getUserIdsWithRole(o.Options.AdminRoleToNotify, "")
}
func getUserIdsWithRole(roleName string, domainId string) ([]string, error) {
@@ -152,7 +152,7 @@ func getUserIdsWithRole(roleName string, domainId string) ([]string, error) {
}
func getDomainAdminUserIds(domainId string) ([]string, error) {
return getUserIdsWithRole("domainadmin", domainId)
return getUserIdsWithRole(o.Options.DomainAdminRoleToNotify, domainId)
}
func (sql *SSQLDriver) Sync(ctx context.Context) error {
+3
View File
@@ -56,6 +56,9 @@ type SKeystoneOptions struct {
AllowJoinProjectsAcrossDomains bool `help:"allow users/groups to join projects across domains" default:"false"`
DefaultUserLanguage string `help:"default user language, default to zh-CN" default:"zh-CN"`
DomainAdminRoleToNotify string `help:"domain admin role to notify" default:"domainadmin"`
AdminRoleToNotify string `help:"admin role to notify" default:"admin"`
}
var (