Access Control: Add option to filter only managed permissions (#43371)

* Add option to filter only managed permissions
This commit is contained in:
Karl Persson
2021-12-21 14:22:54 +01:00
committed by GitHub
parent c1be17bec7
commit b3d5a607d4
5 changed files with 56 additions and 3 deletions
@@ -9,6 +9,8 @@ type ResourceValidator func(ctx context.Context, orgID int64, resourceID string)
type Options struct {
// Resource is the action and scope prefix that is generated
Resource string
// OnlyManaged will tell the service to return all permissions if set to false and only managed permissions if set to true
OnlyManaged bool
// ResourceValidator is a validator function that will be called before each assignment.
// If set to nil the validator will be skipped
ResourceValidator ResourceValidator
@@ -69,6 +69,7 @@ func (s *Service) GetPermissions(ctx context.Context, orgID int64, resourceID st
Actions: s.actions,
Resource: s.options.Resource,
ResourceIDs: []string{resourceID},
OnlyManaged: s.options.OnlyManaged,
})
}