user

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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