-
Notifications
You must be signed in to change notification settings - Fork 347
/
authz_iface.go
39 lines (31 loc) · 1.33 KB
/
authz_iface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package templates
import (
"context"
"github.com/determined-ai/determined/master/internal/authz"
"github.com/determined-ai/determined/master/pkg/model"
)
// TemplateAuthZ describes authz methods for template actions.
type TemplateAuthZ interface {
// ViewableScopes returns the set of scopes that the user can view templates in.
ViewableScopes(
ctx context.Context, curUser *model.User, requestedScope model.AccessScopeID,
) (model.AccessScopeSet, error)
// CanCreateTemplate checks if the user can create a template.
CanCreateTemplate(
ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)
// CanViewTemplate checks if the user can view a template.
CanViewTemplate(
ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)
// CanUpdateTemplate checks if the user can update a template.
CanUpdateTemplate(
ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)
// CanDeleteTemplate checks if the user can delete a template.
CanDeleteTemplate(
ctx context.Context, curUser *model.User, workspaceID model.AccessScopeID,
) (permErr error, err error)
}
// AuthZProvider is the authz registry for Notebooks, Shells, and Commands.
var AuthZProvider authz.AuthZProviderType[TemplateAuthZ]