mock

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mock contains a mock implementation of the query.Engine interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	mock.Mock
	Namespace string
	// contains filtered or unexported fields
}

Engine represents an engine that does nothing and accepts all resource types.

func (*Engine) AssignSubjectRole

func (e *Engine) AssignSubjectRole(ctx context.Context, subject types.Resource, role types.Role) error

AssignSubjectRole does nothing but satisfies the Engine interface.

func (*Engine) CreateRelationships

func (e *Engine) CreateRelationships(ctx context.Context, rels []types.Relationship) error

CreateRelationships does nothing but satisfies the Engine interface.

func (*Engine) CreateRole

func (e *Engine) CreateRole(ctx context.Context, actor, res types.Resource, name string, actions []string) (types.Role, error)

CreateRole creates a Role object and does not persist it anywhere.

func (*Engine) DeleteRelationships

func (e *Engine) DeleteRelationships(ctx context.Context, relationships ...types.Relationship) error

DeleteRelationships does nothing but satisfies the Engine interface.

func (*Engine) DeleteResourceRelationships added in v0.2.0

func (e *Engine) DeleteResourceRelationships(ctx context.Context, resource types.Resource) error

DeleteResourceRelationships does nothing but satisfies the Engine interface.

func (*Engine) DeleteRole added in v0.1.15

func (e *Engine) DeleteRole(ctx context.Context, roleResource types.Resource) error

DeleteRole does nothing but satisfies the Engine interface.

func (*Engine) GetResourceType added in v0.1.8

func (e *Engine) GetResourceType(name string) *types.ResourceType

GetResourceType returns the resource type by name

func (*Engine) GetRole added in v0.1.19

func (e *Engine) GetRole(ctx context.Context, roleResource types.Resource) (types.Role, error)

GetRole returns nothing but satisfies the Engine interface.

func (*Engine) GetRoleResource added in v0.1.19

func (e *Engine) GetRoleResource(ctx context.Context, roleResource types.Resource) (types.Resource, error)

GetRoleResource returns nothing but satisfies the Engine interface.

func (*Engine) ListAssignments

func (e *Engine) ListAssignments(ctx context.Context, role types.Role) ([]types.Resource, error)

ListAssignments returns nothing but satisfies the Engine interface.

func (*Engine) ListRelationshipsFrom added in v0.1.16

func (e *Engine) ListRelationshipsFrom(ctx context.Context, resource types.Resource) ([]types.Relationship, error)

ListRelationshipsFrom returns nothing but satisfies the Engine interface.

func (*Engine) ListRelationshipsTo added in v0.1.16

func (e *Engine) ListRelationshipsTo(ctx context.Context, resource types.Resource) ([]types.Relationship, error)

ListRelationshipsTo returns nothing but satisfies the Engine interface.

func (*Engine) ListRoles

func (e *Engine) ListRoles(ctx context.Context, resource types.Resource) ([]types.Role, error)

ListRoles returns nothing but satisfies the Engine interface.

func (*Engine) NewResourceFromID added in v0.1.4

func (e *Engine) NewResourceFromID(id gidx.PrefixedID) (types.Resource, error)

NewResourceFromID creates a new resource object based on the given ID.

func (*Engine) SubjectHasPermission

func (e *Engine) SubjectHasPermission(ctx context.Context, subject types.Resource, action string, resource types.Resource) error

SubjectHasPermission returns nil to satisfy the Engine interface.

func (*Engine) UnassignSubjectRole added in v0.1.15

func (e *Engine) UnassignSubjectRole(ctx context.Context, subject types.Resource, role types.Role) error

UnassignSubjectRole does nothing but satisfies the Engine interface.

func (*Engine) UpdateRole added in v0.3.1

func (e *Engine) UpdateRole(ctx context.Context, actor, roleResource types.Resource, newName string, newActions []string) (types.Role, error)

UpdateRole returns the provided mock results.

Jump to

Keyboard shortcuts

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