Documentation ¶
Index ¶
- Variables
- func ProjectIDByName(ctx context.Context, workspaceID int, projectName string) (*int, error)
- func WorkspaceByName(ctx context.Context, workspaceName string) (*model.Workspace, error)
- type WorkspaceAuthZ
- type WorkspaceAuthZBasic
- func (a *WorkspaceAuthZBasic) CanArchiveWorkspace(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanCreateWorkspace(ctx context.Context, curUser model.User) error
- func (a *WorkspaceAuthZBasic) CanCreateWorkspaceWithAgentUserGroup(ctx context.Context, curUser model.User) error
- func (a *WorkspaceAuthZBasic) CanCreateWorkspaceWithCheckpointStorageConfig(ctx context.Context, curUser model.User) error
- func (a *WorkspaceAuthZBasic) CanDeleteWorkspace(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanGetWorkspace(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) (canGetWorkspace bool, serverError error)
- func (a *WorkspaceAuthZBasic) CanPinWorkspace(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanSetWorkspacesAgentUserGroup(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanSetWorkspacesCheckpointStorageConfig(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanSetWorkspacesName(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanUnarchiveWorkspace(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) CanUnpinWorkspace(ctx context.Context, curUser model.User, workspace *workspacev1.Workspace) error
- func (a *WorkspaceAuthZBasic) FilterWorkspaceProjects(ctx context.Context, curUser model.User, projects []*projectv1.Project) ([]*projectv1.Project, error)
- func (a *WorkspaceAuthZBasic) FilterWorkspaces(ctx context.Context, curUser model.User, workspaces []*workspacev1.Workspace) ([]*workspacev1.Workspace, error)
Constants ¶
This section is empty.
Variables ¶
var AuthZProvider authz.AuthZProviderType[WorkspaceAuthZ]
AuthZProvider providers WorkspaceAuthZ implementations.
Functions ¶
func ProjectIDByName ¶
ProjectIDByName returns a project's ID if it exists in the given workspace.
Types ¶
type WorkspaceAuthZ ¶
type WorkspaceAuthZ interface { // GET /api/v1/workspaces/:workspace_id CanGetWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) (canGetWorkspace bool, serverError error) // GET /api/v1/workspaces/:workspace_id/projects FilterWorkspaceProjects( ctx context.Context, curUser model.User, projects []*projectv1.Project, ) ([]*projectv1.Project, error) // GET /api/v1/workspaces FilterWorkspaces( ctx context.Context, curUser model.User, workspaces []*workspacev1.Workspace, ) ([]*workspacev1.Workspace, error) // POST /api/v1/workspaces CanCreateWorkspace(ctx context.Context, curUser model.User) error CanCreateWorkspaceWithAgentUserGroup(ctx context.Context, curUser model.User) error CanCreateWorkspaceWithCheckpointStorageConfig(ctx context.Context, curUser model.User) error // PATCH /api/v1/workspaces/:workspace_id CanSetWorkspacesName( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error CanSetWorkspacesAgentUserGroup( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error CanSetWorkspacesCheckpointStorageConfig( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error // DELETE /api/v1/workspaces/:workspace_id CanDeleteWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error // POST /api/v1/workspaces/:workspace_id/archive CanArchiveWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error // POST /api/v1/workspaces/:workspace_id/unarchive CanUnarchiveWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error // POST /api/v1/workspaces/:workspace_id/pin CanPinWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error // POST /api/v1/workspaces/:workspace_id/unpin CanUnpinWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error }
WorkspaceAuthZ is the interface for workspace authorization.
type WorkspaceAuthZBasic ¶
type WorkspaceAuthZBasic struct{}
WorkspaceAuthZBasic is classic OSS Determined authentication for workspaces.
func (*WorkspaceAuthZBasic) CanArchiveWorkspace ¶
func (a *WorkspaceAuthZBasic) CanArchiveWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanArchiveWorkspace returns an error if the user is not an admin or not the owner of the workspace.
func (*WorkspaceAuthZBasic) CanCreateWorkspace ¶
CanCreateWorkspace always returns a nil error.
func (*WorkspaceAuthZBasic) CanCreateWorkspaceWithAgentUserGroup ¶
func (a *WorkspaceAuthZBasic) CanCreateWorkspaceWithAgentUserGroup( ctx context.Context, curUser model.User, ) error
CanCreateWorkspaceWithAgentUserGroup requires user to be an admin.
func (*WorkspaceAuthZBasic) CanCreateWorkspaceWithCheckpointStorageConfig ¶
func (a *WorkspaceAuthZBasic) CanCreateWorkspaceWithCheckpointStorageConfig( ctx context.Context, curUser model.User, ) error
CanCreateWorkspaceWithCheckpointStorageConfig returns an nil error.
func (*WorkspaceAuthZBasic) CanDeleteWorkspace ¶
func (a *WorkspaceAuthZBasic) CanDeleteWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanDeleteWorkspace returns an error if the user is not an admin or not the owner of the workspace.
func (*WorkspaceAuthZBasic) CanGetWorkspace ¶
func (a *WorkspaceAuthZBasic) CanGetWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) (canGetWorkspace bool, serverError error)
CanGetWorkspace always return true and a nil error.
func (*WorkspaceAuthZBasic) CanPinWorkspace ¶
func (a *WorkspaceAuthZBasic) CanPinWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanPinWorkspace always returns a nil error.
func (*WorkspaceAuthZBasic) CanSetWorkspacesAgentUserGroup ¶
func (a *WorkspaceAuthZBasic) CanSetWorkspacesAgentUserGroup( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanSetWorkspacesAgentUserGroup can only be done by admins.
func (*WorkspaceAuthZBasic) CanSetWorkspacesCheckpointStorageConfig ¶
func (a *WorkspaceAuthZBasic) CanSetWorkspacesCheckpointStorageConfig( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanSetWorkspacesCheckpointStorageConfig returns an error if the user is not an admin or owner of the workspace.
func (*WorkspaceAuthZBasic) CanSetWorkspacesName ¶
func (a *WorkspaceAuthZBasic) CanSetWorkspacesName( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanSetWorkspacesName returns an error if the user is not an admin or not the owner of the workspace.
func (*WorkspaceAuthZBasic) CanUnarchiveWorkspace ¶
func (a *WorkspaceAuthZBasic) CanUnarchiveWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanUnarchiveWorkspace returns an error if the user is not an admin or not the owner of the workspace.
func (*WorkspaceAuthZBasic) CanUnpinWorkspace ¶
func (a *WorkspaceAuthZBasic) CanUnpinWorkspace( ctx context.Context, curUser model.User, workspace *workspacev1.Workspace, ) error
CanUnpinWorkspace always returns a nil error.
func (*WorkspaceAuthZBasic) FilterWorkspaceProjects ¶
func (a *WorkspaceAuthZBasic) FilterWorkspaceProjects( ctx context.Context, curUser model.User, projects []*projectv1.Project, ) ([]*projectv1.Project, error)
FilterWorkspaceProjects always returns the list provided and a nil error.
func (*WorkspaceAuthZBasic) FilterWorkspaces ¶
func (a *WorkspaceAuthZBasic) FilterWorkspaces( ctx context.Context, curUser model.User, workspaces []*workspacev1.Workspace, ) ([]*workspacev1.Workspace, error)
FilterWorkspaces always returns provided list and a nil errir.