manager

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Package manager is a generated GoMock package.

Index

Constants

View Source
const (
	// ResourceSeparator is the resource name separator between kind and value.
	ResourceSeparator = "."

	// WildcardValue is the wildcard value used to identify resources.
	WildcardValue = "*"
)

Variables

This section is empty.

Functions

func CastAnyToString

func CastAnyToString(value any) (string, error)

CastAnyToString casts a value of any type to a string.

func ResourceSplit

func ResourceSplit(resource string) (string, string)

ResourceSplit splits a resource name string to: * resource kind, * resource value.

Types

type Action

type Action interface {
	Create(identifier string) (*model.Action, error)
	GetRepository() ActionRepository
}

func NewAction

func NewAction(repository ActionRepository) Action

NewAction initializes a new action manager.

type ActionRepository

type ActionRepository repository.Base[model.Action]

type Attribute

type Attribute interface {
	MapToSlice(attributes map[string]any) ([]*model.Attribute, error)
	GetRepository() AttributeRepository
}

func NewAttribute

func NewAttribute(repository AttributeRepository) Attribute

NewAttribute initializes a new attribute manager.

type AttributeRepository

type AttributeRepository repository.Base[model.Attribute]

type Audit

type Audit interface {
	BatchAdd(audits []*model.Audit) error
	GetRepository() AuditRepository
}

func NewAudit

func NewAudit(
	repository AuditRepository,
) Audit

NewAudit initializes a new audit manager.

type AuditRepository

type AuditRepository repository.Base[model.Audit]

type Client

type Client interface {
	Create(name string, domain string) (*model.Client, error)
	Delete(identifier string) error
	GetRepository() ClientRepository
}

func NewClient

func NewClient(
	repository ClientRepository,
	principalRepository repository.Principal,
	transactionManager database.TransactionManager,
	tokenGenerator token.Generator,
) Client

NewClient initializes a new client manager.

type ClientRepository

type ClientRepository repository.Base[model.Client]

type CompiledPolicy

type CompiledPolicy interface {
	Create(compiledPolicy []*model.CompiledPolicy) error
	GetRepository() CompiledPolicyRepository
	IsAllowed(principalID string, resourceKind string, resourceValue string, actionID string) (bool, error)
}

func NewCompiledPolicy

func NewCompiledPolicy(
	repository CompiledPolicyRepository,
	principalRepository repository.Base[model.Principal],
	logger *slog.Logger,
	dispatcher event.Dispatcher,
) CompiledPolicy

NewCompiledPolicy initializes a new compiledPolicy manager.

type CompiledPolicyRepository

type CompiledPolicyRepository repository.Base[model.CompiledPolicy]

type MockAction

type MockAction struct {
	// contains filtered or unexported fields
}

MockAction is a mock of Action interface.

func NewMockAction

func NewMockAction(ctrl *gomock.Controller) *MockAction

NewMockAction creates a new mock instance.

func (*MockAction) Create

func (m *MockAction) Create(identifier string) (*model.Action, error)

Create mocks base method.

func (*MockAction) EXPECT

func (m *MockAction) EXPECT() *MockActionMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAction) GetRepository

func (m *MockAction) GetRepository() ActionRepository

GetRepository mocks base method.

type MockActionMockRecorder

type MockActionMockRecorder struct {
	// contains filtered or unexported fields
}

MockActionMockRecorder is the mock recorder for MockAction.

func (*MockActionMockRecorder) Create

func (mr *MockActionMockRecorder) Create(identifier interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockActionMockRecorder) GetRepository

func (mr *MockActionMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

type MockAttribute

type MockAttribute struct {
	// contains filtered or unexported fields
}

MockAttribute is a mock of Attribute interface.

func NewMockAttribute

func NewMockAttribute(ctrl *gomock.Controller) *MockAttribute

NewMockAttribute creates a new mock instance.

func (*MockAttribute) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAttribute) GetRepository

func (m *MockAttribute) GetRepository() AttributeRepository

GetRepository mocks base method.

func (*MockAttribute) MapToSlice

func (m *MockAttribute) MapToSlice(attributes map[string]any) ([]*model.Attribute, error)

MapToSlice mocks base method.

type MockAttributeMockRecorder

type MockAttributeMockRecorder struct {
	// contains filtered or unexported fields
}

MockAttributeMockRecorder is the mock recorder for MockAttribute.

func (*MockAttributeMockRecorder) GetRepository

func (mr *MockAttributeMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockAttributeMockRecorder) MapToSlice

func (mr *MockAttributeMockRecorder) MapToSlice(attributes interface{}) *gomock.Call

MapToSlice indicates an expected call of MapToSlice.

type MockAudit

type MockAudit struct {
	// contains filtered or unexported fields
}

MockAudit is a mock of Audit interface.

func NewMockAudit

func NewMockAudit(ctrl *gomock.Controller) *MockAudit

NewMockAudit creates a new mock instance.

func (*MockAudit) BatchAdd

func (m *MockAudit) BatchAdd(audits []*model.Audit) error

BatchAdd mocks base method.

func (*MockAudit) EXPECT

func (m *MockAudit) EXPECT() *MockAuditMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAudit) GetRepository

func (m *MockAudit) GetRepository() AuditRepository

GetRepository mocks base method.

type MockAuditMockRecorder

type MockAuditMockRecorder struct {
	// contains filtered or unexported fields
}

MockAuditMockRecorder is the mock recorder for MockAudit.

func (*MockAuditMockRecorder) BatchAdd

func (mr *MockAuditMockRecorder) BatchAdd(audits interface{}) *gomock.Call

BatchAdd indicates an expected call of BatchAdd.

func (*MockAuditMockRecorder) GetRepository

func (mr *MockAuditMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

type MockClient

type MockClient struct {
	// contains filtered or unexported fields
}

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Create

func (m *MockClient) Create(name, domain string) (*model.Client, error)

Create mocks base method.

func (*MockClient) Delete

func (m *MockClient) Delete(identifier string) error

Delete mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) GetRepository

func (m *MockClient) GetRepository() ClientRepository

GetRepository mocks base method.

type MockClientMockRecorder

type MockClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Create

func (mr *MockClientMockRecorder) Create(name, domain interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockClientMockRecorder) Delete

func (mr *MockClientMockRecorder) Delete(identifier interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockClientMockRecorder) GetRepository

func (mr *MockClientMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

type MockCompiledPolicy

type MockCompiledPolicy struct {
	// contains filtered or unexported fields
}

MockCompiledPolicy is a mock of CompiledPolicy interface.

func NewMockCompiledPolicy

func NewMockCompiledPolicy(ctrl *gomock.Controller) *MockCompiledPolicy

NewMockCompiledPolicy creates a new mock instance.

func (*MockCompiledPolicy) Create

func (m *MockCompiledPolicy) Create(compiledPolicy []*model.CompiledPolicy) error

Create mocks base method.

func (*MockCompiledPolicy) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCompiledPolicy) GetRepository

func (m *MockCompiledPolicy) GetRepository() CompiledPolicyRepository

GetRepository mocks base method.

func (*MockCompiledPolicy) IsAllowed

func (m *MockCompiledPolicy) IsAllowed(principalID, resourceKind, resourceValue, actionID string) (bool, error)

IsAllowed mocks base method.

type MockCompiledPolicyMockRecorder

type MockCompiledPolicyMockRecorder struct {
	// contains filtered or unexported fields
}

MockCompiledPolicyMockRecorder is the mock recorder for MockCompiledPolicy.

func (*MockCompiledPolicyMockRecorder) Create

func (mr *MockCompiledPolicyMockRecorder) Create(compiledPolicy interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockCompiledPolicyMockRecorder) GetRepository

func (mr *MockCompiledPolicyMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockCompiledPolicyMockRecorder) IsAllowed

func (mr *MockCompiledPolicyMockRecorder) IsAllowed(principalID, resourceKind, resourceValue, actionID interface{}) *gomock.Call

IsAllowed indicates an expected call of IsAllowed.

type MockPolicy

type MockPolicy struct {
	// contains filtered or unexported fields
}

MockPolicy is a mock of Policy interface.

func NewMockPolicy

func NewMockPolicy(ctrl *gomock.Controller) *MockPolicy

NewMockPolicy creates a new mock instance.

func (*MockPolicy) Create

func (m *MockPolicy) Create(identifier string, resources, actions, attributeRules []string) (*model.Policy, error)

Create mocks base method.

func (*MockPolicy) Delete

func (m *MockPolicy) Delete(identifier string) error

Delete mocks base method.

func (*MockPolicy) EXPECT

func (m *MockPolicy) EXPECT() *MockPolicyMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPolicy) GetRepository

func (m *MockPolicy) GetRepository() PolicyRepository

GetRepository mocks base method.

func (*MockPolicy) Update

func (m *MockPolicy) Update(identifier string, resources, actions, attributeRules []string) (*model.Policy, error)

Update mocks base method.

type MockPolicyMockRecorder

type MockPolicyMockRecorder struct {
	// contains filtered or unexported fields
}

MockPolicyMockRecorder is the mock recorder for MockPolicy.

func (*MockPolicyMockRecorder) Create

func (mr *MockPolicyMockRecorder) Create(identifier, resources, actions, attributeRules interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockPolicyMockRecorder) Delete

func (mr *MockPolicyMockRecorder) Delete(identifier interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockPolicyMockRecorder) GetRepository

func (mr *MockPolicyMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockPolicyMockRecorder) Update

func (mr *MockPolicyMockRecorder) Update(identifier, resources, actions, attributeRules interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockPrincipal

type MockPrincipal struct {
	// contains filtered or unexported fields
}

MockPrincipal is a mock of Principal interface.

func NewMockPrincipal

func NewMockPrincipal(ctrl *gomock.Controller) *MockPrincipal

NewMockPrincipal creates a new mock instance.

func (*MockPrincipal) Create

func (m *MockPrincipal) Create(identifier string, roles []string, attributes map[string]any) (*model.Principal, error)

Create mocks base method.

func (*MockPrincipal) Delete

func (m *MockPrincipal) Delete(identifier string) error

Delete mocks base method.

func (*MockPrincipal) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPrincipal) GetRepository

func (m *MockPrincipal) GetRepository() repository.Principal

GetRepository mocks base method.

func (*MockPrincipal) Update

func (m *MockPrincipal) Update(identifier string, roles []string, attributes map[string]any) (*model.Principal, error)

Update mocks base method.

type MockPrincipalMockRecorder

type MockPrincipalMockRecorder struct {
	// contains filtered or unexported fields
}

MockPrincipalMockRecorder is the mock recorder for MockPrincipal.

func (*MockPrincipalMockRecorder) Create

func (mr *MockPrincipalMockRecorder) Create(identifier, roles, attributes interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockPrincipalMockRecorder) Delete

func (mr *MockPrincipalMockRecorder) Delete(identifier interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockPrincipalMockRecorder) GetRepository

func (mr *MockPrincipalMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockPrincipalMockRecorder) Update

func (mr *MockPrincipalMockRecorder) Update(identifier, roles, attributes interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockResource

type MockResource struct {
	// contains filtered or unexported fields
}

MockResource is a mock of Resource interface.

func NewMockResource

func NewMockResource(ctrl *gomock.Controller) *MockResource

NewMockResource creates a new mock instance.

func (*MockResource) Create

func (m *MockResource) Create(identifier, kind, value string, attributes map[string]any) (*model.Resource, error)

Create mocks base method.

func (*MockResource) Delete

func (m *MockResource) Delete(identifier string) error

Delete mocks base method.

func (*MockResource) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockResource) GetRepository

func (m *MockResource) GetRepository() repository.Resource

GetRepository mocks base method.

func (*MockResource) Update

func (m *MockResource) Update(identifier, kind, value string, attributes map[string]any) (*model.Resource, error)

Update mocks base method.

type MockResourceMockRecorder

type MockResourceMockRecorder struct {
	// contains filtered or unexported fields
}

MockResourceMockRecorder is the mock recorder for MockResource.

func (*MockResourceMockRecorder) Create

func (mr *MockResourceMockRecorder) Create(identifier, kind, value, attributes interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockResourceMockRecorder) Delete

func (mr *MockResourceMockRecorder) Delete(identifier interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockResourceMockRecorder) GetRepository

func (mr *MockResourceMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockResourceMockRecorder) Update

func (mr *MockResourceMockRecorder) Update(identifier, kind, value, attributes interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockRole

type MockRole struct {
	// contains filtered or unexported fields
}

MockRole is a mock of Role interface.

func NewMockRole

func NewMockRole(ctrl *gomock.Controller) *MockRole

NewMockRole creates a new mock instance.

func (*MockRole) Create

func (m *MockRole) Create(identifier string, policies []string) (*model.Role, error)

Create mocks base method.

func (*MockRole) Delete

func (m *MockRole) Delete(identifier string) error

Delete mocks base method.

func (*MockRole) EXPECT

func (m *MockRole) EXPECT() *MockRoleMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRole) GetRepository

func (m *MockRole) GetRepository() RoleRepository

GetRepository mocks base method.

func (*MockRole) Update

func (m *MockRole) Update(identifier string, policies []string) (*model.Role, error)

Update mocks base method.

type MockRoleMockRecorder

type MockRoleMockRecorder struct {
	// contains filtered or unexported fields
}

MockRoleMockRecorder is the mock recorder for MockRole.

func (*MockRoleMockRecorder) Create

func (mr *MockRoleMockRecorder) Create(identifier, policies interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockRoleMockRecorder) Delete

func (mr *MockRoleMockRecorder) Delete(identifier interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockRoleMockRecorder) GetRepository

func (mr *MockRoleMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockRoleMockRecorder) Update

func (mr *MockRoleMockRecorder) Update(identifier, policies interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockStats

type MockStats struct {
	// contains filtered or unexported fields
}

MockStats is a mock of Stats interface.

func NewMockStats

func NewMockStats(ctrl *gomock.Controller) *MockStats

NewMockStats creates a new mock instance.

func (*MockStats) BatchAddCheck

func (m *MockStats) BatchAddCheck(timestamp, allowed, denied int64) error

BatchAddCheck mocks base method.

func (*MockStats) EXPECT

func (m *MockStats) EXPECT() *MockStatsMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStats) GetRepository

func (m *MockStats) GetRepository() StatsRepository

GetRepository mocks base method.

type MockStatsMockRecorder

type MockStatsMockRecorder struct {
	// contains filtered or unexported fields
}

MockStatsMockRecorder is the mock recorder for MockStats.

func (*MockStatsMockRecorder) BatchAddCheck

func (mr *MockStatsMockRecorder) BatchAddCheck(timestamp, allowed, denied interface{}) *gomock.Call

BatchAddCheck indicates an expected call of BatchAddCheck.

func (*MockStatsMockRecorder) GetRepository

func (mr *MockStatsMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

type MockUser

type MockUser struct {
	// contains filtered or unexported fields
}

MockUser is a mock of User interface.

func NewMockUser

func NewMockUser(ctrl *gomock.Controller) *MockUser

NewMockUser creates a new mock instance.

func (*MockUser) Create

func (m *MockUser) Create(username, password string) (*model.User, error)

Create mocks base method.

func (*MockUser) Delete

func (m *MockUser) Delete(username string) error

Delete mocks base method.

func (*MockUser) EXPECT

func (m *MockUser) EXPECT() *MockUserMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUser) GetRepository

func (m *MockUser) GetRepository() UserRepository

GetRepository mocks base method.

func (*MockUser) UpdatePassword

func (m *MockUser) UpdatePassword(username, password string) error

UpdatePassword mocks base method.

type MockUserMockRecorder

type MockUserMockRecorder struct {
	// contains filtered or unexported fields
}

MockUserMockRecorder is the mock recorder for MockUser.

func (*MockUserMockRecorder) Create

func (mr *MockUserMockRecorder) Create(username, password interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockUserMockRecorder) Delete

func (mr *MockUserMockRecorder) Delete(username interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockUserMockRecorder) GetRepository

func (mr *MockUserMockRecorder) GetRepository() *gomock.Call

GetRepository indicates an expected call of GetRepository.

func (*MockUserMockRecorder) UpdatePassword

func (mr *MockUserMockRecorder) UpdatePassword(username, password interface{}) *gomock.Call

UpdatePassword indicates an expected call of UpdatePassword.

type Policy

type Policy interface {
	Create(identifier string, resources []string, actions []string, attributeRules []string) (*model.Policy, error)
	Delete(identifier string) error
	Update(identifier string, resources []string, actions []string, attributeRules []string) (*model.Policy, error)
	GetRepository() PolicyRepository
}

func NewPolicy

func NewPolicy(
	repository PolicyRepository,
	resourceManager Resource,
	actionManager Action,
	transactionManager database.TransactionManager,
	dispatcher event.Dispatcher,
) Policy

NewPolicy initializes a new policy manager.

type PolicyRepository

type PolicyRepository repository.Base[model.Policy]

type Principal

type Principal interface {
	Create(identifier string, roles []string, attributes map[string]any) (*model.Principal, error)
	Delete(identifier string) error
	GetRepository() repository.Principal
	Update(identifier string, roles []string, attributes map[string]any) (*model.Principal, error)
}

func NewPrincipal

func NewPrincipal(
	repository repository.Principal,
	roleRepository RoleRepository,
	attributeManager Attribute,
	transactionManager database.TransactionManager,
	dispatcher event.Dispatcher,
) Principal

NewPrincipal initializes a new principal manager.

type Resource

type Resource interface {
	Create(identifier string, kind string, value string, attributes map[string]any) (*model.Resource, error)
	Delete(identifier string) error
	GetRepository() repository.Resource
	Update(identifier string, kind string, value string, attributes map[string]any) (*model.Resource, error)
}

func NewResource

func NewResource(
	repository repository.Resource,
	attributeManager Attribute,
	transactionManager database.TransactionManager,
	dispatcher event.Dispatcher,
) Resource

NewResource initializes a new resource manager.

type Role

type Role interface {
	Create(identifier string, policies []string) (*model.Role, error)
	Delete(identifier string) error
	GetRepository() RoleRepository
	Update(identifier string, policies []string) (*model.Role, error)
}

func NewRole

func NewRole(
	repository RoleRepository,
	policyRepository PolicyRepository,
	transactionManager database.TransactionManager,
	dispatcher event.Dispatcher,
) Role

NewRole initializes a new role manager.

type RoleRepository

type RoleRepository repository.Base[model.Role]

type Stats

type Stats interface {
	BatchAddCheck(timestamp int64, allowed int64, denied int64) error
	GetRepository() StatsRepository
}

func NewStats

func NewStats(
	repository StatsRepository,
) Stats

NewStats initializes a new stats manager.

type StatsRepository

type StatsRepository repository.Base[model.Stats]

type User

type User interface {
	Create(username string, password string) (*model.User, error)
	Delete(username string) error
	UpdatePassword(username string, password string) error
	GetRepository() UserRepository
}

func NewUser

func NewUser(
	repository UserRepository,
	principalRepository repository.Base[model.Principal],
	transactionManager database.TransactionManager,
	tokenGenerator token.Generator,
) User

NewUser initializes a new user manager.

type UserRepository

type UserRepository repository.Base[model.User]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL