don't setup demo role assignments on default
This commit is contained in:
@@ -28,6 +28,8 @@ type Config struct {
|
||||
Asset Asset `yaml:"asset"`
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
|
||||
SetupDefaultAssignments bool `yaml:"set_default_assignments" env:"SETTINGS_SETUP_DEFAULT_ASSIGNMENTS;ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"If the default role assignments for the demo users should be setup."`
|
||||
|
||||
Context context.Context `yaml:"-"`
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func DefaultConfig() *config.Config {
|
||||
Asset: config.Asset{
|
||||
Path: "",
|
||||
},
|
||||
|
||||
SetupDefaultAssignments: false,
|
||||
Metadata: config.Metadata{
|
||||
GatewayAddress: "127.0.0.1:9215", // system storage
|
||||
StorageAddress: "127.0.0.1:9215",
|
||||
|
||||
@@ -126,9 +126,11 @@ func (g Service) RegisterDefaultRoles() {
|
||||
}
|
||||
}
|
||||
|
||||
for _, req := range g.defaultRoleAssignments() {
|
||||
if _, err := g.manager.WriteRoleAssignment(req.AccountUuid, req.RoleId); err != nil {
|
||||
g.logger.Error().Err(err).Msg("failed to register role assignment")
|
||||
if g.config.SetupDefaultAssignments {
|
||||
for _, req := range g.defaultRoleAssignments() {
|
||||
if _, err := g.manager.WriteRoleAssignment(req.AccountUuid, req.RoleId); err != nil {
|
||||
g.logger.Error().Err(err).Msg("failed to register role assignment")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,15 +544,15 @@ func (g Service) defaultRoleAssignments() []*settingsmsg.UserRoleAssignment {
|
||||
},
|
||||
// default users with role "user"
|
||||
{
|
||||
AccountUuid: "4c510ada-c86b-4815-8820-42cdf82c3d51",
|
||||
AccountUuid: "4c510ada-c86b-4815-8820-42cdf82c3d51", // demo user "einstein"
|
||||
RoleId: BundleUUIDRoleUser,
|
||||
}, {
|
||||
AccountUuid: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
|
||||
AccountUuid: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", // demo user "marie"
|
||||
RoleId: BundleUUIDRoleUser,
|
||||
},
|
||||
// default users with role "spaceadmin"
|
||||
{
|
||||
AccountUuid: "534bb038-6f9d-4093-946f-133be61fa4e7",
|
||||
AccountUuid: "534bb038-6f9d-4093-946f-133be61fa4e7", // demo user "katherine"
|
||||
RoleId: BundleUUIDRoleSpaceAdmin,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user