user

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPermissions

func HasPermissions(ctx context.Context, scope Scope, perms ...Permission) error

Types

type Permission

type Permission uint8
const (
	PermRead Permission = iota
	PermCreate
	PermUpdate
	PermDelete
)

func (Permission) String

func (p Permission) String() string

type Role

type Role struct {
	Name        string              `json:"name"`
	Description *string             `json:"description"`
	IsSystem    bool                `json:"system"`
	Permissions map[string][]string `json:"scopes_permissions"`
}

func (*Role) Validate

func (r *Role) Validate() error

type Scope

type Scope string
const (
	ScopeHosts             Scope = "hosts"
	ScopeConfigOpt         Scope = "config-opt"
	ScopePool              Scope = "pool"
	ScopeOsd               Scope = "osd"
	ScopeMonitor           Scope = "monitor"
	ScopeRbdImage          Scope = "rbd-image"
	ScopeIscsi             Scope = "iscsi"
	ScopeRbdMirroring      Scope = "rbd-mirroring"
	ScopeRgw               Scope = "rgw"
	ScopeCephfs            Scope = "cephfs"
	ScopeManager           Scope = "manager"
	ScopeLog               Scope = "log"
	ScopeGrafana           Scope = "grafana"
	ScopePrometheus        Scope = "prometheus"
	ScopeUser              Scope = "user"
	ScopeDashboardSettings Scope = "dashboard-setting"
	ScopeNfsGanesha        Scope = "nfs-ganesha"
	ScopeNvmeOf            Scope = "nvme-of"
)

type Service

type Service struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(radosSvc *rados.Svc) (*Service, error)

func (*Service) ChangePassword

func (s *Service) ChangePassword(ctx context.Context, username, oldPass, newPass string) error

func (*Service) CloneRole

func (s *Service) CloneRole(ctx context.Context, srcName, dstName string) error

func (*Service) CreateRole

func (s *Service) CreateRole(ctx context.Context, role Role) error

func (*Service) CreateUser

func (s *Service) CreateUser(ctx context.Context, user User) error

func (*Service) DeleteRole

func (s *Service) DeleteRole(ctx context.Context, name string) error

func (*Service) DeleteUser

func (s *Service) DeleteUser(ctx context.Context, username string) error

func (*Service) GetPermissions

func (s *Service) GetPermissions(ctx context.Context, username string) map[string][]string

func (*Service) GetRole

func (s *Service) GetRole(ctx context.Context, name string) (Role, error)

func (*Service) GetUser

func (s *Service) GetUser(ctx context.Context, username string) (User, error)

func (*Service) ListRoles

func (s *Service) ListRoles(ctx context.Context) ([]Role, error)

func (*Service) ListUsers

func (s *Service) ListUsers(ctx context.Context) ([]User, error)

func (*Service) UpdateRole

func (s *Service) UpdateRole(ctx context.Context, role Role) error

func (*Service) UpdateUser

func (s *Service) UpdateUser(ctx context.Context, user User) error

type User

type User struct {
	Username          string   `json:"username"`
	Roles             []string `json:"roles"`
	Password          string   `json:"password"`
	Name              *string  `json:"name"`
	Email             *string  `json:"email"`
	LastUpdate        int      `json:"lastUpdate"`
	Enabled           bool     `json:"enabled"`
	PwdExpirationDate *int     `json:"pwdExpirationDate"`
	PwdUpdateRequired bool     `json:"pwdUpdateRequired"`
}

func (*User) Validate

func (u *User) Validate() error

Jump to

Keyboard shortcuts

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