* initial commit * Action sets stored remove the dependancy for actionsets got the actionsets registered storing the permissions * fix golanglinting * remove unused struct field * wip * actionset registry for a plugin from the actionsetservice * update to make declareactionset the primary way of plugin registration and modification * declare actually extends actionsets * tests fixed * tests skipped * skip tests * skip tests * skip tests * skip tests * change to warning instead * remove step from pipeline to see if it fails due to plugin not registering * reintroduce step but remove features dependancy * add back the tests that were failing * remove comments and another skip test * fix a comment and remove unneeded changes * fix and clean up, put the behaviour behind a feature toggle * clean up * fixing tests * hard-code allowed action sets for plugins * Apply suggestions from code review Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * small cleanup --------- Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com> Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
33 lines
986 B
Go
33 lines
986 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(name string, actions []string) {}
|