34c40f959f
* include and resolve action sets when fetching user's permissions * expand both action and action prefix (returns an empty set for the one that isn't specified) Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * if action is specified, check for exact match; also extend tests
33 lines
1002 B
Go
33 lines
1002 B
Go
package resourcepermissions
|
|
|
|
import "github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
|
|
type FakeActionSetSvc struct {
|
|
ExpectedErr error
|
|
ExpectedActionSets []string
|
|
ExpectedActions []string
|
|
ExpectedPermissions []accesscontrol.Permission
|
|
}
|
|
|
|
func (f *FakeActionSetSvc) ResolveAction(action string) []string {
|
|
return f.ExpectedActionSets
|
|
}
|
|
|
|
func (f *FakeActionSetSvc) ResolveActionPrefix(prefix string) []string {
|
|
return f.ExpectedActionSets
|
|
}
|
|
|
|
func (f *FakeActionSetSvc) ResolveActionSet(actionSet string) []string {
|
|
return f.ExpectedActions
|
|
}
|
|
|
|
func (f *FakeActionSetSvc) ExpandActionSets(permissions []accesscontrol.Permission) []accesscontrol.Permission {
|
|
return f.ExpectedPermissions
|
|
}
|
|
|
|
func (f *FakeActionSetSvc) ExpandActionSetsWithFilter(permissions []accesscontrol.Permission, actionMatcher func(action string) bool) []accesscontrol.Permission {
|
|
return f.ExpectedPermissions
|
|
}
|
|
|
|
func (f *FakeActionSetSvc) StoreActionSet(resource, permission string, actions []string) {}
|