RBAC: Add a function to save external service roles (#66299)

* AuthN: Save external services RBAC roles

* Add missing test

* Placing roles in the same group

* Split function to gen role and assignment

* add test case and comments

* Ensure we check external service roles are assigned once only

* Update pkg/services/accesscontrol/models_test.go

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>

---------

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
This commit is contained in:
Gabriel MABILLE
2023-05-09 13:19:38 +02:00
committed by GitHub
parent 04df92ab47
commit 8c6b5a4319
11 changed files with 657 additions and 20 deletions

View File

@@ -53,6 +53,10 @@ func (f FakeService) IsDisabled() bool {
return f.ExpectedDisabled
}
func (f FakeService) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error {
return f.ExpectedErr
}
var _ accesscontrol.AccessControl = new(FakeAccessControl)
type FakeAccessControl struct {
@@ -95,6 +99,10 @@ func (f FakeStore) DeleteUserPermissions(ctx context.Context, orgID, userID int6
return f.ExpectedErr
}
func (f FakeStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error {
return f.ExpectedErr
}
var _ accesscontrol.PermissionsService = new(FakePermissionsService)
type FakePermissionsService struct {