project

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AuthZProvider providers ProjectAuthZ implementations.

Functions

This section is empty.

Types

type ProjectAuthZ

type ProjectAuthZ interface {
	// GET /api/v1/projects/:project_id
	CanGetProject(ctx context.Context, curUser model.User, project *projectv1.Project) error

	// POST /api/v1/workspaces/:workspace_id/projects
	CanCreateProject(
		ctx context.Context, curUser model.User, targetWorkspace *workspacev1.Workspace,
	) error

	// POST /api/v1/projects/:project_id/notes
	// PUT /api/v1/projects/:project_id/notes
	CanSetProjectNotes(ctx context.Context, curUser model.User, project *projectv1.Project) error

	// PATCH /api/v1/projects/:project_id
	CanSetProjectName(ctx context.Context, curUser model.User, project *projectv1.Project) error
	CanSetProjectDescription(
		ctx context.Context, curUser model.User, project *projectv1.Project,
	) error

	// DELETE /api/v1/projects/:project_id
	CanDeleteProject(
		ctx context.Context, curUser model.User, targetProject *projectv1.Project,
	) error

	// POST /api/v1/projects/:project_id/move
	CanMoveProject(ctx context.Context, curUser model.User, project *projectv1.Project, from,
		to *workspacev1.Workspace) error

	// POST /api/v1/experiments/:experiment_id/move
	CanMoveProjectExperiments(ctx context.Context, curUser model.User, exp *model.Experiment, from,
		to *projectv1.Project) error

	// POST /api/v1/projects/:project_id/archive
	CanArchiveProject(ctx context.Context, curUser model.User, project *projectv1.Project) error
	// POST /api/v1/projects/:project_id/unarchive
	CanUnarchiveProject(ctx context.Context, curUser model.User, project *projectv1.Project) error
}

ProjectAuthZ is the interface for project authorization.

type ProjectAuthZBasic

type ProjectAuthZBasic struct{}

ProjectAuthZBasic is classic OSS Determined authentication for projects.

func (*ProjectAuthZBasic) CanArchiveProject

func (a *ProjectAuthZBasic) CanArchiveProject(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanArchiveProject returns an error if a non admin isn't the owner of the project or workspace.

func (*ProjectAuthZBasic) CanCreateProject

func (a *ProjectAuthZBasic) CanCreateProject(
	ctx context.Context, curUser model.User, willBeInWorkspace *workspacev1.Workspace,
) error

CanCreateProject always returns true and a nil error for basic auth.

func (*ProjectAuthZBasic) CanDeleteProject

func (a *ProjectAuthZBasic) CanDeleteProject(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanDeleteProject returns an error if a non admin isn't the owner of the project or workspace.

func (*ProjectAuthZBasic) CanGetProject

func (a *ProjectAuthZBasic) CanGetProject(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanGetProject always return true and a nil error for basic auth.

func (*ProjectAuthZBasic) CanMoveProject

func (a *ProjectAuthZBasic) CanMoveProject(
	ctx context.Context,
	curUser model.User,
	project *projectv1.Project,
	from, to *workspacev1.Workspace,
) error

CanMoveProject returns an error if the user isn't a admin or owner of a project.

func (*ProjectAuthZBasic) CanMoveProjectExperiments

func (a *ProjectAuthZBasic) CanMoveProjectExperiments(
	ctx context.Context, curUser model.User, exp *model.Experiment, from, to *projectv1.Project,
) error

CanMoveProjectExperiments returns an error if the user isn't a admin or owner of a project.

func (*ProjectAuthZBasic) CanSetProjectDescription

func (a *ProjectAuthZBasic) CanSetProjectDescription(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanSetProjectDescription returns an error if a non admin isn't the owner of the project or workspace.

func (*ProjectAuthZBasic) CanSetProjectName

func (a *ProjectAuthZBasic) CanSetProjectName(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanSetProjectName returns an error if a non admin isn't the owner of the project or workspace.

func (*ProjectAuthZBasic) CanSetProjectNotes

func (a *ProjectAuthZBasic) CanSetProjectNotes(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanSetProjectNotes always returns nil for basic auth.

func (*ProjectAuthZBasic) CanUnarchiveProject

func (a *ProjectAuthZBasic) CanUnarchiveProject(
	ctx context.Context, curUser model.User, project *projectv1.Project,
) error

CanUnarchiveProject returns an error if the user isn't the owner of the project or workspace.

Jump to

Keyboard shortcuts

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