auth

package
v0.0.0-...-ad3f07b Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound       = errors.New("user not found")
	ErrGroupNotFound      = errors.New("group not found")
	ErrGroupAlreadyExists = errors.New("group already exists")
	ErrUserAlreadyExists  = errors.New("user already exists")
)

Functions

This section is empty.

Types

type ACL

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

func NewACL

func NewACL() *ACL

func (*ACL) ID

func (a *ACL) ID() uuid.UUID

func (*ACL) MarshalBinary

func (a *ACL) MarshalBinary(w io.Writer) error

func (*ACL) UnmarshalBinary

func (a *ACL) UnmarshalBinary(r io.Reader) error

type Auth

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

func New

func New() *Auth

func (*Auth) ACLGroups

func (a *Auth) ACLGroups(acl *ACL) map[string]Permission

func (*Auth) ACLUsers

func (a *Auth) ACLUsers(acl *ACL) map[string]Permission

func (*Auth) AddGroup

func (a *Auth) AddGroup(name string) error

func (*Auth) AddGroupToACL

func (a *Auth) AddGroupToACL(acl *ACL, groupOrId string, permission Permission) error

func (*Auth) AddUser

func (a *Auth) AddUser(username, password string) error

func (*Auth) AddUserToACL

func (a *Auth) AddUserToACL(acl *ACL, usernameOrId string, permission Permission) error

func (*Auth) AddUserToGroup

func (a *Auth) AddUserToGroup(username, groupName string) error

func (*Auth) DeleteGroup

func (a *Auth) DeleteGroup(name string) error

func (*Auth) DeleteUser

func (a *Auth) DeleteUser(usernameOrId string) error

func (*Auth) GetGroup

func (a *Auth) GetGroup(nameOrId string) (*Group, bool)

func (*Auth) GetPermission

func (a *Auth) GetPermission(acl *ACL, nameOrId string) (Permission, bool)

func (*Auth) GetUser

func (a *Auth) GetUser(usernameOrId string) (*User, bool)

func (*Auth) Groups

func (a *Auth) Groups() []*Group

func (*Auth) MarshalBinary

func (a *Auth) MarshalBinary(w io.Writer) error

func (*Auth) RemoveGroupFromACL

func (a *Auth) RemoveGroupFromACL(acl *ACL, groupOrId string) error

func (*Auth) RemoveUserFromACL

func (a *Auth) RemoveUserFromACL(acl *ACL, usernameOrId string) error

func (*Auth) RemoveUserFromGroup

func (a *Auth) RemoveUserFromGroup(username, groupName string) error

func (*Auth) UnmarshalBinary

func (a *Auth) UnmarshalBinary(r io.Reader) error

func (*Auth) Users

func (a *Auth) Users() []*User

type Group

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

func (*Group) ID

func (g *Group) ID() uuid.UUID

func (*Group) Name

func (g *Group) Name() string

func (*Group) UserIDs

func (g *Group) UserIDs() []uuid.UUID

func (*Group) UserNames

func (g *Group) UserNames() []string

type Permission

type Permission uint64

func (Permission) Clear

func (p Permission) Clear() Permission

func (Permission) Disable

func (p Permission) Disable(permissions uint64) Permission

func (Permission) Enable

func (p Permission) Enable(permissions uint64) Permission

func (Permission) HasAllPermissions

func (p Permission) HasAllPermissions(list ...uint64) bool

func (Permission) HasAnyPermission

func (p Permission) HasAnyPermission(list ...uint64) bool

func (Permission) HasPermission

func (p Permission) HasPermission(permission uint64) bool

func (Permission) SetAll

func (p Permission) SetAll() Permission

func (Permission) String

func (p Permission) String() string

type User

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

func (*User) GroupIDs

func (u *User) GroupIDs() []uuid.UUID

func (*User) GroupNames

func (u *User) GroupNames() []string

func (*User) HasGroup

func (u *User) HasGroup(groupNameOrId string) bool

func (*User) ID

func (u *User) ID() uuid.UUID

func (*User) LastLogin

func (u *User) LastLogin() time.Time

func (*User) PasswordChangeDate

func (u *User) PasswordChangeDate() time.Time

func (*User) Username

func (u *User) Username() string

func (*User) VerifyPassword

func (u *User) VerifyPassword(password string) bool

Jump to

Keyboard shortcuts

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