fix settings and idm admin user id configuration

This commit is contained in:
Willy Kloucek
2022-05-16 08:30:16 +02:00
parent 7b95b40536
commit 382d91b22b
8 changed files with 23 additions and 3 deletions
@@ -0,0 +1,9 @@
Bugfix: Fix the idm and settings extensions' admin user id configuration option
We've fixed the admin user id configuration of the settings and idm extensions.
The have previously only been configurable via the oCIS shared configuration and
therefore have been undocumented for the extensions. This config option is now part
of both extensions' configuration and can now also be used when the extensions are
compiled standalone.
https://github.com/owncloud/ocis/pull/3799
+1 -1
View File
@@ -98,7 +98,7 @@ func bootstrap(logger log.Logger, cfg *config.Config, srvcfg server.Config) erro
{ {
Name: "admin", Name: "admin",
Password: cfg.ServiceUserPasswords.OcisAdmin, Password: cfg.ServiceUserPasswords.OcisAdmin,
ID: cfg.Commons.AdminUserID, ID: cfg.AdminUserID,
}, },
{ {
Name: "libregraph", Name: "libregraph",
+1
View File
@@ -20,6 +20,7 @@ type Config struct {
CreateDemoUsers bool `yaml:"create_demo_users" env:"IDM_CREATE_DEMO_USERS;ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"Flag to enabe/disable the creation of the demo users"` CreateDemoUsers bool `yaml:"create_demo_users" env:"IDM_CREATE_DEMO_USERS;ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"Flag to enabe/disable the creation of the demo users"`
ServiceUserPasswords ServiceUserPasswords `yaml:"service_user_passwords"` ServiceUserPasswords ServiceUserPasswords `yaml:"service_user_passwords"`
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;IDM_ADMIN_USER_ID"`
Context context.Context `yaml:"-"` Context context.Context `yaml:"-"`
} }
@@ -52,6 +52,10 @@ func EnsureDefaults(cfg *config.Config) {
} else if cfg.Tracing == nil { } else if cfg.Tracing == nil {
cfg.Tracing = &config.Tracing{} cfg.Tracing = &config.Tracing{}
} }
if cfg.AdminUserID == "" {
cfg.AdminUserID = cfg.Commons.AdminUserID
}
} }
func Sanitize(cfg *config.Config) { func Sanitize(cfg *config.Config) {
+2
View File
@@ -23,6 +23,8 @@ type Config struct {
DataPath string `yaml:"data_path" env:"SETTINGS_DATA_PATH"` DataPath string `yaml:"data_path" env:"SETTINGS_DATA_PATH"`
Metadata Metadata `yaml:"metadata_config"` Metadata Metadata `yaml:"metadata_config"`
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;SETTINGS_ADMIN_USER_ID"`
Asset Asset `yaml:"asset"` Asset Asset `yaml:"asset"`
TokenManager *TokenManager `yaml:"token_manager"` TokenManager *TokenManager `yaml:"token_manager"`
@@ -96,6 +96,10 @@ func EnsureDefaults(cfg *config.Config) {
if cfg.Metadata.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" { if cfg.Metadata.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.Metadata.SystemUserID = cfg.Commons.SystemUserID cfg.Metadata.SystemUserID = cfg.Commons.SystemUserID
} }
if cfg.AdminUserID == "" {
cfg.AdminUserID = cfg.Commons.AdminUserID
}
} }
func Sanitize(cfg *config.Config) { func Sanitize(cfg *config.Config) {
@@ -539,7 +539,7 @@ func (g Service) defaultRoleAssignments() []*settingsmsg.UserRoleAssignment {
AccountUuid: "058bff95-6708-4fe5-91e4-9ea3d377588b", // demo user "moss" AccountUuid: "058bff95-6708-4fe5-91e4-9ea3d377588b", // demo user "moss"
RoleId: BundleUUIDRoleAdmin, RoleId: BundleUUIDRoleAdmin,
}, { }, {
AccountUuid: g.config.Commons.AdminUserID, AccountUuid: g.config.AdminUserID,
RoleId: BundleUUIDRoleAdmin, RoleId: BundleUUIDRoleAdmin,
}, },
// default users with role "user" // default users with role "user"
@@ -504,7 +504,7 @@ func DefaultRoleAssignments(cfg *config.Config) []*settingsmsg.UserRoleAssignmen
AccountUuid: "058bff95-6708-4fe5-91e4-9ea3d377588b", // demo user "moss" AccountUuid: "058bff95-6708-4fe5-91e4-9ea3d377588b", // demo user "moss"
RoleId: BundleUUIDRoleAdmin, RoleId: BundleUUIDRoleAdmin,
}, { }, {
AccountUuid: cfg.Commons.AdminUserID, AccountUuid: cfg.AdminUserID,
RoleId: BundleUUIDRoleAdmin, RoleId: BundleUUIDRoleAdmin,
}, },
// default users with role "user" // default users with role "user"