Documentation ¶
Index ¶
- Constants
- func AddUserPermissionToDB(t testing.TB, db db.DB, user *user.SignedInUser)
- func ConcurrentBatch(workers, count, size int, eachFn func(start, end int) error) error
- type FakeAccessControl
- type FakePermissionsService
- func (f *FakePermissionsService) DeleteResourcePermissions(ctx context.Context, orgID int64, resourceID string) error
- func (f *FakePermissionsService) GetPermissions(ctx context.Context, user identity.Requester, resourceID string) ([]accesscontrol.ResourcePermission, error)
- func (f *FakePermissionsService) MapActions(permission accesscontrol.ResourcePermission) string
- func (f *FakePermissionsService) SetBuiltInRolePermission(ctx context.Context, orgID int64, builtInRole string, resourceID string, ...) (*accesscontrol.ResourcePermission, error)
- func (f *FakePermissionsService) SetPermissions(ctx context.Context, orgID int64, resourceID string, ...) ([]accesscontrol.ResourcePermission, error)
- func (f *FakePermissionsService) SetTeamPermission(ctx context.Context, orgID, teamID int64, resourceID, permission string) (*accesscontrol.ResourcePermission, error)
- func (f *FakePermissionsService) SetUserPermission(ctx context.Context, orgID int64, user accesscontrol.User, ...) (*accesscontrol.ResourcePermission, error)
- type FakeService
- func (f FakeService) ClearUserPermissionCache(user identity.Requester)
- func (f FakeService) DeclareFixedRoles(registrations ...accesscontrol.RoleRegistration) error
- func (f FakeService) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error
- func (f FakeService) DeleteTeamPermissions(ctx context.Context, orgID, teamID int64) error
- func (f FakeService) DeleteUserPermissions(ctx context.Context, orgID, userID int64) error
- func (f FakeService) GetUsageStats(ctx context.Context) map[string]any
- func (f FakeService) GetUserPermissions(ctx context.Context, user identity.Requester, options accesscontrol.Options) ([]accesscontrol.Permission, error)
- func (f FakeService) RegisterFixedRoles(ctx context.Context) error
- func (f FakeService) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
- func (f FakeService) SearchUserPermissions(ctx context.Context, orgID int64, searchOptions accesscontrol.SearchOptions) ([]accesscontrol.Permission, error)
- func (f FakeService) SearchUsersPermissions(ctx context.Context, user identity.Requester, ...) (map[int64][]accesscontrol.Permission, error)
- type FakeStore
- func (f FakeStore) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error
- func (f FakeStore) DeleteTeamPermissions(ctx context.Context, orgID, teamID int64) error
- func (f FakeStore) DeleteUserPermissions(ctx context.Context, orgID, userID int64) error
- func (f FakeStore) GetBasicRolesPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
- func (f FakeStore) GetTeamsPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) (map[int64][]accesscontrol.Permission, error)
- func (f FakeStore) GetUserPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
- func (f FakeStore) GetUsersBasicRoles(ctx context.Context, userFilter []int64, orgID int64) (map[int64][]string, error)
- func (f FakeStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
- func (f FakeStore) SearchUsersPermissions(ctx context.Context, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)
- type MockStore
- func (_m *MockStore) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error
- func (_m *MockStore) DeleteTeamPermissions(ctx context.Context, orgID int64, teamID int64) error
- func (_m *MockStore) DeleteUserPermissions(ctx context.Context, orgID int64, userID int64) error
- func (_m *MockStore) GetBasicRolesPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
- func (_m *MockStore) GetTeamsPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) (map[int64][]accesscontrol.Permission, error)
- func (_m *MockStore) GetUserPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
- func (_m *MockStore) GetUsersBasicRoles(ctx context.Context, userFilter []int64, orgID int64) (map[int64][]string, error)
- func (_m *MockStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
- func (_m *MockStore) SearchUsersPermissions(ctx context.Context, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)
Constants ¶
const BatchSize = 1000
const Concurrency = 10
Variables ¶
This section is empty.
Functions ¶
func AddUserPermissionToDB ¶
creates a role, connected it to user and store all permission from the user in database
Types ¶
type FakeAccessControl ¶
func (FakeAccessControl) Evaluate ¶
func (f FakeAccessControl) Evaluate(ctx context.Context, user identity.Requester, evaluator accesscontrol.Evaluator) (bool, error)
func (FakeAccessControl) RegisterScopeAttributeResolver ¶
func (f FakeAccessControl) RegisterScopeAttributeResolver(prefix string, resolver accesscontrol.ScopeAttributeResolver)
type FakePermissionsService ¶
type FakePermissionsService struct { ExpectedErr error ExpectedPermission *accesscontrol.ResourcePermission ExpectedPermissions []accesscontrol.ResourcePermission ExpectedMappedAction string }
func (*FakePermissionsService) DeleteResourcePermissions ¶
func (*FakePermissionsService) GetPermissions ¶
func (f *FakePermissionsService) GetPermissions(ctx context.Context, user identity.Requester, resourceID string) ([]accesscontrol.ResourcePermission, error)
func (*FakePermissionsService) MapActions ¶
func (f *FakePermissionsService) MapActions(permission accesscontrol.ResourcePermission) string
func (*FakePermissionsService) SetBuiltInRolePermission ¶
func (f *FakePermissionsService) SetBuiltInRolePermission(ctx context.Context, orgID int64, builtInRole string, resourceID string, permission string) (*accesscontrol.ResourcePermission, error)
func (*FakePermissionsService) SetPermissions ¶
func (f *FakePermissionsService) SetPermissions(ctx context.Context, orgID int64, resourceID string, commands ...accesscontrol.SetResourcePermissionCommand) ([]accesscontrol.ResourcePermission, error)
func (*FakePermissionsService) SetTeamPermission ¶
func (f *FakePermissionsService) SetTeamPermission(ctx context.Context, orgID, teamID int64, resourceID, permission string) (*accesscontrol.ResourcePermission, error)
func (*FakePermissionsService) SetUserPermission ¶
func (f *FakePermissionsService) SetUserPermission(ctx context.Context, orgID int64, user accesscontrol.User, resourceID, permission string) (*accesscontrol.ResourcePermission, error)
type FakeService ¶
type FakeService struct { accesscontrol.Service ExpectedErr error ExpectedCachedPermissions bool ExpectedPermissions []accesscontrol.Permission ExpectedFilteredUserPermissions []accesscontrol.Permission ExpectedUsersPermissions map[int64][]accesscontrol.Permission }
func (FakeService) ClearUserPermissionCache ¶
func (f FakeService) ClearUserPermissionCache(user identity.Requester)
func (FakeService) DeclareFixedRoles ¶
func (f FakeService) DeclareFixedRoles(registrations ...accesscontrol.RoleRegistration) error
func (FakeService) DeleteExternalServiceRole ¶
func (f FakeService) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error
func (FakeService) DeleteTeamPermissions ¶
func (f FakeService) DeleteTeamPermissions(ctx context.Context, orgID, teamID int64) error
func (FakeService) DeleteUserPermissions ¶
func (f FakeService) DeleteUserPermissions(ctx context.Context, orgID, userID int64) error
func (FakeService) GetUsageStats ¶
func (f FakeService) GetUsageStats(ctx context.Context) map[string]any
func (FakeService) GetUserPermissions ¶
func (f FakeService) GetUserPermissions(ctx context.Context, user identity.Requester, options accesscontrol.Options) ([]accesscontrol.Permission, error)
func (FakeService) RegisterFixedRoles ¶
func (f FakeService) RegisterFixedRoles(ctx context.Context) error
func (FakeService) SaveExternalServiceRole ¶
func (f FakeService) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
func (FakeService) SearchUserPermissions ¶
func (f FakeService) SearchUserPermissions(ctx context.Context, orgID int64, searchOptions accesscontrol.SearchOptions) ([]accesscontrol.Permission, error)
func (FakeService) SearchUsersPermissions ¶
func (f FakeService) SearchUsersPermissions(ctx context.Context, user identity.Requester, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)
type FakeStore ¶
type FakeStore struct { ExpectedUserPermissions []accesscontrol.Permission ExpectedBasicRolesPermissions []accesscontrol.Permission ExpectedTeamsPermissions map[int64][]accesscontrol.Permission ExpectedUsersPermissions map[int64][]accesscontrol.Permission ExpectedUsersRoles map[int64][]string ExpectedErr error }
func (FakeStore) DeleteExternalServiceRole ¶
func (FakeStore) DeleteTeamPermissions ¶
func (FakeStore) DeleteUserPermissions ¶
func (FakeStore) GetBasicRolesPermissions ¶
func (f FakeStore) GetBasicRolesPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
func (FakeStore) GetTeamsPermissions ¶
func (f FakeStore) GetTeamsPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) (map[int64][]accesscontrol.Permission, error)
func (FakeStore) GetUserPermissions ¶
func (f FakeStore) GetUserPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
func (FakeStore) GetUsersBasicRoles ¶
func (FakeStore) SaveExternalServiceRole ¶
func (f FakeStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
func (FakeStore) SearchUsersPermissions ¶
func (f FakeStore) SearchUsersPermissions(ctx context.Context, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)
type MockStore ¶
MockStore is an autogenerated mock type for the Store type
func NewMockStore ¶
NewMockStore creates a new instance of MockStore. 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 (*MockStore) DeleteExternalServiceRole ¶
DeleteExternalServiceRole provides a mock function with given fields: ctx, externalServiceID
func (*MockStore) DeleteTeamPermissions ¶
DeleteTeamPermissions provides a mock function with given fields: ctx, orgID, teamID
func (*MockStore) DeleteUserPermissions ¶
DeleteUserPermissions provides a mock function with given fields: ctx, orgID, userID
func (*MockStore) GetBasicRolesPermissions ¶
func (_m *MockStore) GetBasicRolesPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
GetBasicRolesPermissions provides a mock function with given fields: ctx, query
func (*MockStore) GetTeamsPermissions ¶
func (_m *MockStore) GetTeamsPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) (map[int64][]accesscontrol.Permission, error)
GetTeamsPermissions provides a mock function with given fields: ctx, query
func (*MockStore) GetUserPermissions ¶
func (_m *MockStore) GetUserPermissions(ctx context.Context, query accesscontrol.GetUserPermissionsQuery) ([]accesscontrol.Permission, error)
GetUserPermissions provides a mock function with given fields: ctx, query
func (*MockStore) GetUsersBasicRoles ¶
func (_m *MockStore) GetUsersBasicRoles(ctx context.Context, userFilter []int64, orgID int64) (map[int64][]string, error)
GetUsersBasicRoles provides a mock function with given fields: ctx, userFilter, orgID
func (*MockStore) SaveExternalServiceRole ¶
func (_m *MockStore) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
SaveExternalServiceRole provides a mock function with given fields: ctx, cmd
func (*MockStore) SearchUsersPermissions ¶
func (_m *MockStore) SearchUsersPermissions(ctx context.Context, orgID int64, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)
SearchUsersPermissions provides a mock function with given fields: ctx, orgID, options