ExtSvcAuth: Assign roles locally (#78669)

* ExtSvcAuth: Assign roles locally

* Fix test

* HandlePluginStateChanged in the OrgID

* Remove Global from command

* Use AssignmentOrgID instead of OrgID

* Remove unecessary test case
This commit is contained in:
Gabriel MABILLE
2023-11-29 12:12:30 +01:00
committed by GitHub
parent 5a6ac44902
commit 72d32eed27
8 changed files with 44 additions and 119 deletions

View File

@@ -274,8 +274,7 @@ type SetResourcePermissionCommand struct {
}
type SaveExternalServiceRoleCommand struct {
OrgID int64
Global bool
AssignmentOrgID int64
ExternalServiceID string
ServiceAccountID int64
Permissions []Permission
@@ -289,10 +288,6 @@ func (cmd *SaveExternalServiceRoleCommand) Validate() error {
// slugify the external service id ID for the role to have correct name and uid
cmd.ExternalServiceID = slugify.Slugify(cmd.ExternalServiceID)
if (cmd.OrgID == GlobalOrgID) != cmd.Global {
return fmt.Errorf("invalid org id %d for global role %t", cmd.OrgID, cmd.Global)
}
// Check and deduplicate permissions
if cmd.Permissions == nil || len(cmd.Permissions) == 0 {
return errors.New("no permissions provided")