@@ -34,7 +34,7 @@ type ProvisionManageService struct {
3434 sidProvider supermq.IDProvider
3535 policy policies.Service
3636 actions []Action
37- BuiltInRoles map [BuiltInRoleName ][]Action
37+ builtInRoles map [BuiltInRoleName ][]Action
3838}
3939
4040func NewProvisionManageService (entityType string , repo Repository , policy policies.Service , sidProvider supermq.IDProvider , actions []Action , builtInRoles map [BuiltInRoleName ][]Action ) (ProvisionManageService , error ) {
@@ -44,11 +44,19 @@ func NewProvisionManageService(entityType string, repo Repository, policy polici
4444 sidProvider : sidProvider ,
4545 policy : policy ,
4646 actions : actions ,
47- BuiltInRoles : builtInRoles ,
47+ builtInRoles : builtInRoles ,
4848 }
4949 return rm , nil
5050}
5151
52+ func (pms ProvisionManageService ) BuiltInRoleActions (name BuiltInRoleName ) ([]Action , error ) {
53+ actions , ok := pms .builtInRoles [name ]
54+ if ! ok {
55+ return nil , errors .Wrap (svcerr .ErrNotFound , fmt .Errorf ("role %s not found" , name ))
56+ }
57+ return actions , nil
58+ }
59+
5260func toRolesActions (actions []string ) []Action {
5361 roActions := []Action {}
5462 for _ , action := range actions {
@@ -143,7 +151,7 @@ func (r ProvisionManageService) AddNewEntitiesRoles(ctx context.Context, domainI
143151
144152 for _ , entityID := range entityIDs {
145153 for defaultRole , defaultRoleMembers := range newBuiltInRoleMembers {
146- actions , ok := r .BuiltInRoles [defaultRole ]
154+ actions , ok := r .builtInRoles [defaultRole ]
147155 if ! ok {
148156 return []RoleProvision {}, fmt .Errorf ("default role %s not found in in-built roles" , defaultRole )
149157 }
0 commit comments