policy

package
v0.0.0-...-dae269f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAccess = errors.New("no access")
	ErrInvalid  = errors.New("invalid parameters")
)

Functions

This section is empty.

Types

type Policy

type Policy struct {
	component.Base

	Dependencies struct {
		SQL  *sql.SQL
		Auth *auth.Auth
	}
}

func (*Policy) Has

func (policy *Policy) Has(ctx context.Context, username string, slug string) (grant models.Grant, err error)

Has checks if the given username has access to the given instance. If the user has access, returns the provided grant.

If the user does not have access, returns ErrNoAccess. Other errors may be returned in other cases.

func (*Policy) Instance

func (policy *Policy) Instance(ctx context.Context, slug string) (grants []models.Grant, err error)

Instance returns all the grants for the given instance

func (*Policy) OnUserDelete

func (pol *Policy) OnUserDelete(ctx context.Context, user *models.User) error

OnUserDelete is called when a user is deleted

func (*Policy) Provision

func (*Policy) Provision(ctx context.Context, instance models.Instance, domain string) error

func (*Policy) Purge

func (pol *Policy) Purge(ctx context.Context, instance models.Instance, domain string) error

Purge purges every policy for the given slug form the database

func (*Policy) Remove

func (policy *Policy) Remove(ctx context.Context, username string, slug string) error

Remove removes access for the given username form the given instance. The user not having access is not an error.

func (*Policy) Set

func (policy *Policy) Set(ctx context.Context, grant models.Grant) error

Set sets a specific grant, overwriting any previous grant.

User and Slug must not be empty. If DrupalUsername is empty, sets the username to be equal to the user.

func (*Policy) TableInfo

func (pol *Policy) TableInfo() component.TableInfo

func (*Policy) User

func (policy *Policy) User(ctx context.Context, username string) (grants []models.Grant, err error)

User returns all grants for the given user

Jump to

Keyboard shortcuts

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