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