Documentation
¶
Overview ¶
Package mock provides a no-op implementation of the minder the authorization client
Package mock provides a no-op implementation of the minder the authorization client
Index ¶
- type NoopClient
- func (*NoopClient) Adopt(_ context.Context, _, _ uuid.UUID) error
- func (*NoopClient) AssignmentsToProject(_ context.Context, _ uuid.UUID) ([]*minderv1.RoleAssignment, error)
- func (n *NoopClient) Check(ctx context.Context, action string, project uuid.UUID) error
- func (*NoopClient) Delete(_ context.Context, _ string, _ authz.Role, _ uuid.UUID) error
- func (*NoopClient) DeleteUser(_ context.Context, _ string) error
- func (*NoopClient) MigrateUp(_ context.Context) error
- func (*NoopClient) Orphan(_ context.Context, _, _ uuid.UUID) error
- func (*NoopClient) PrepareForRun(_ context.Context) error
- func (*NoopClient) ProjectsForUser(_ context.Context, _ string) ([]uuid.UUID, error)
- func (*NoopClient) Write(_ context.Context, _ string, _ authz.Role, _ uuid.UUID) error
- type SimpleClient
- func (n *SimpleClient) Adopt(_ context.Context, p, c uuid.UUID) error
- func (n *SimpleClient) AssignmentsToProject(_ context.Context, p uuid.UUID) ([]*minderv1.RoleAssignment, error)
- func (n *SimpleClient) Check(_ context.Context, _ string, project uuid.UUID) error
- func (n *SimpleClient) Delete(_ context.Context, id string, role authz.Role, project uuid.UUID) error
- func (n *SimpleClient) DeleteUser(_ context.Context, user string) error
- func (*SimpleClient) MigrateUp(_ context.Context) error
- func (n *SimpleClient) Orphan(_ context.Context, _, c uuid.UUID) error
- func (*SimpleClient) PrepareForRun(_ context.Context) error
- func (n *SimpleClient) ProjectsForUser(_ context.Context, _ string) ([]uuid.UUID, error)
- func (n *SimpleClient) Write(_ context.Context, id string, role authz.Role, project uuid.UUID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoopClient ¶
type NoopClient struct {
// If Authorized is true, all Check calls will return nil
Authorized bool
}
NoopClient is a no-op implementation of the authz.Client interface, which always returns the same authorization result.
func (*NoopClient) AssignmentsToProject ¶
func (*NoopClient) AssignmentsToProject(_ context.Context, _ uuid.UUID) ([]*minderv1.RoleAssignment, error)
AssignmentsToProject implements authz.Client
func (*NoopClient) DeleteUser ¶
func (*NoopClient) DeleteUser(_ context.Context, _ string) error
DeleteUser implements authz.Client
func (*NoopClient) MigrateUp ¶
func (*NoopClient) MigrateUp(_ context.Context) error
MigrateUp implements authz.Client
func (*NoopClient) PrepareForRun ¶
func (*NoopClient) PrepareForRun(_ context.Context) error
PrepareForRun implements authz.Client
func (*NoopClient) ProjectsForUser ¶
ProjectsForUser implements authz.Client
type SimpleClient ¶
type SimpleClient struct {
Allowed []uuid.UUID
Assignments map[uuid.UUID][]*minderv1.RoleAssignment
// Adoptions is a map of child project to parent project
Adoptions map[uuid.UUID]uuid.UUID
// OrphanCalls is a counter for the number of times Orphan is called
OrphanCalls atomic.Int32
}
SimpleClient maintains a list of authorized projects, suitable for use in tests.
func (*SimpleClient) AssignmentsToProject ¶
func (n *SimpleClient) AssignmentsToProject(_ context.Context, p uuid.UUID) ([]*minderv1.RoleAssignment, error)
AssignmentsToProject implements authz.Client
func (*SimpleClient) Delete ¶
func (n *SimpleClient) Delete(_ context.Context, id string, role authz.Role, project uuid.UUID) error
Delete implements authz.Client
func (*SimpleClient) DeleteUser ¶
func (n *SimpleClient) DeleteUser(_ context.Context, user string) error
DeleteUser implements authz.Client
func (*SimpleClient) MigrateUp ¶
func (*SimpleClient) MigrateUp(_ context.Context) error
MigrateUp implements authz.Client
func (*SimpleClient) PrepareForRun ¶
func (*SimpleClient) PrepareForRun(_ context.Context) error
PrepareForRun implements authz.Client
func (*SimpleClient) ProjectsForUser ¶
ProjectsForUser implements authz.Client