user

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MPL-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PermissionWriteSecret    = "writesecret"
	PermissionReadSecret     = "readsecret"
	PermissionUpdatePackage  = "updatesecurityversion"
	PermissionUpdateManifest = "updatemanifest"
)

Permissions available to users.

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission struct {
	PermissionID string
	ResourceID   map[string]bool
}

Permission represents the permissions of a MarbleRun user.

func NewPermission

func NewPermission(permissionID string, resourceIDs []string) Permission

NewPermission creates a new permission, granting access to resources grouped by permissionID.

func (Permission) ID

func (p Permission) ID() string

ID returns the permissionID.

type User

type User struct {
	// contains filtered or unexported fields
}

User represents a privileged user of MarbleRun.

func NewUser

func NewUser(name string, certificate *x509.Certificate) *User

NewUser creates a new user.

func (*User) Assign

func (u *User) Assign(p Permission)

Assign adds a new permission to the user.

func (*User) Certificate

func (u *User) Certificate() *x509.Certificate

Certificate returns a users certificate.

func (*User) Equal added in v1.0.0

func (u *User) Equal(other *User) bool

Equal returns true if both users are the same.

func (*User) IsGranted

func (u *User) IsGranted(p Permission) bool

IsGranted returns true if the user has the requested permission.

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*User) Name

func (u *User) Name() string

Name returns the name of a user.

func (*User) Permissions

func (u *User) Permissions() map[string]Permission

Permissions returns a users permissions.

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface.

Jump to

Keyboard shortcuts

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