Documentation
¶
Index ¶
- type AuthZReq
- type Authorizer
- func (_m *Authorizer) Authorize(principal *models.Principal, verb string, resources ...string) error
- func (_m *Authorizer) AuthorizeSilent(principal *models.Principal, verb string, resources ...string) error
- func (_m *Authorizer) FilterAuthorizedResources(principal *models.Principal, verb string, resources ...string) ([]string, error)
- type Controller
- func (_m *Controller) AddRolesForUser(user string, roles []string) error
- func (_m *Controller) DeleteRoles(roles ...string) error
- func (_m *Controller) GetRoles(names ...string) (map[string][]authorization.Policy, error)
- func (_m *Controller) GetRolesForUser(user string) (map[string][]authorization.Policy, error)
- func (_m *Controller) GetUsersForRole(role string) ([]string, error)
- func (_m *Controller) HasPermission(role string, permission *authorization.Policy) (bool, error)
- func (_m *Controller) RemovePermissions(role string, permissions []*authorization.Policy) error
- func (_m *Controller) RevokeRolesForUser(user string, roles ...string) error
- func (_m *Controller) UpsertRolesPermissions(roles map[string][]authorization.Policy) error
- type FakeAuthorizer
- func (a *FakeAuthorizer) Authorize(principal *models.Principal, verb string, resources ...string) error
- func (a *FakeAuthorizer) AuthorizeSilent(principal *models.Principal, verb string, resources ...string) error
- func (a *FakeAuthorizer) Calls() []AuthZReq
- func (a *FakeAuthorizer) FilterAuthorizedResources(principal *models.Principal, verb string, resources ...string) ([]string, error)
- func (a *FakeAuthorizer) SetErr(err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶ added in v1.28.0
Authorizer is an autogenerated mock type for the Authorizer type
func NewAuthorizer ¶ added in v1.28.0
func NewAuthorizer(t interface { mock.TestingT Cleanup(func()) }, ) *Authorizer
NewAuthorizer creates a new instance of Authorizer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Authorizer) Authorize ¶ added in v1.28.0
func (_m *Authorizer) Authorize(principal *models.Principal, verb string, resources ...string) error
Authorize provides a mock function with given fields: principal, verb, resources
func (*Authorizer) AuthorizeSilent ¶ added in v1.28.5
func (_m *Authorizer) AuthorizeSilent(principal *models.Principal, verb string, resources ...string) error
AuthorizeSilent provides a mock function with given fields: principal, verb, resources
func (*Authorizer) FilterAuthorizedResources ¶ added in v1.28.5
func (_m *Authorizer) FilterAuthorizedResources(principal *models.Principal, verb string, resources ...string) ([]string, error)
FilterAuthorizedResources provides a mock function with given fields: principal, verb, resources
type Controller ¶ added in v1.28.0
Controller is an autogenerated mock type for the Controller type
func NewController ¶ added in v1.28.0
func NewController(t interface { mock.TestingT Cleanup(func()) }, ) *Controller
NewController creates a new instance of Controller. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Controller) AddRolesForUser ¶ added in v1.28.0
func (_m *Controller) AddRolesForUser(user string, roles []string) error
AddRolesForUser provides a mock function with given fields: user, roles
func (*Controller) DeleteRoles ¶ added in v1.28.0
func (_m *Controller) DeleteRoles(roles ...string) error
DeleteRoles provides a mock function with given fields: roles
func (*Controller) GetRoles ¶ added in v1.28.0
func (_m *Controller) GetRoles(names ...string) (map[string][]authorization.Policy, error)
GetRoles provides a mock function with given fields: names
func (*Controller) GetRolesForUser ¶ added in v1.28.0
func (_m *Controller) GetRolesForUser(user string) (map[string][]authorization.Policy, error)
GetRolesForUser provides a mock function with given fields: user
func (*Controller) GetUsersForRole ¶ added in v1.28.0
func (_m *Controller) GetUsersForRole(role string) ([]string, error)
GetUsersForRole provides a mock function with given fields: role
func (*Controller) HasPermission ¶ added in v1.28.0
func (_m *Controller) HasPermission(role string, permission *authorization.Policy) (bool, error)
HasPermission provides a mock function with given fields: role, permissions
func (*Controller) RemovePermissions ¶ added in v1.28.0
func (_m *Controller) RemovePermissions(role string, permissions []*authorization.Policy) error
RemovePermissions provides a mock function with given fields: role, permissions
func (*Controller) RevokeRolesForUser ¶ added in v1.28.0
func (_m *Controller) RevokeRolesForUser(user string, roles ...string) error
RevokeRolesForUser provides a mock function with given fields: user, roles
func (*Controller) UpsertRolesPermissions ¶ added in v1.28.0
func (_m *Controller) UpsertRolesPermissions(roles map[string][]authorization.Policy) error
UpsertRolesPermissions provides a mock function with given fields: roles
type FakeAuthorizer ¶
type FakeAuthorizer struct {
// contains filtered or unexported fields
}
func NewMockAuthorizer ¶
func NewMockAuthorizer() *FakeAuthorizer
func (*FakeAuthorizer) Authorize ¶
func (a *FakeAuthorizer) Authorize(principal *models.Principal, verb string, resources ...string) error
Authorize provides a mock function with given fields: principal, verb, resource
func (*FakeAuthorizer) AuthorizeSilent ¶ added in v1.28.5
func (*FakeAuthorizer) Calls ¶
func (a *FakeAuthorizer) Calls() []AuthZReq
func (*FakeAuthorizer) FilterAuthorizedResources ¶ added in v1.28.5
func (*FakeAuthorizer) SetErr ¶
func (a *FakeAuthorizer) SetErr(err error)