user

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Index

Constants

This section is empty.

Variables

View Source
var DefaultProfile = &Profile{Name: "Guest"}
View Source
var (
	PermissionsLogger util.Logger
)

Functions

func Check

func Check(path string, accounts Accounts) (bool, string)

func IsAdmin added in v0.2.12

func IsAdmin(accounts Accounts) bool

func SetPermissions

func SetPermissions(allowDefault bool, ps ...*Permission)

Types

type Account

type Account struct {
	Provider string `json:"provider"`
	Email    string `json:"email"`
	Picture  string `json:"picture"`
	Token    string `json:"-"`
}

func (Account) Domain added in v0.2.12

func (a Account) Domain() string

func (Account) String

func (a Account) String() string

func (Account) TitleString added in v0.2.12

func (a Account) TitleString() string

type Accounts

type Accounts []*Account

func AccountsFromString

func AccountsFromString(s string) Accounts

func (Accounts) GetByProvider

func (a Accounts) GetByProvider(p string) Accounts

func (Accounts) GetByProviderDomain added in v0.2.12

func (a Accounts) GetByProviderDomain(p string, d string) *Account

func (Accounts) Image added in v0.2.12

func (a Accounts) Image() string

func (Accounts) Images added in v0.2.12

func (a Accounts) Images() []string

func (Accounts) Matches

func (a Accounts) Matches(match string) bool

func (Accounts) Purge

func (a Accounts) Purge(keys ...string) Accounts

func (Accounts) Sort

func (a Accounts) Sort()

func (Accounts) String

func (a Accounts) String() string

func (Accounts) TitleString added in v0.2.12

func (a Accounts) TitleString() string

type Permission

type Permission struct {
	Path  string `json:"path"`
	Match string `json:"match"`
	Allow bool   `json:"allow"`
}

func Perm

func Perm(p string, m string, a bool) *Permission

func (Permission) Matches

func (p Permission) Matches(path string) bool

func (Permission) String

func (p Permission) String() string

type Permissions

type Permissions []*Permission

func GetPermissions

func GetPermissions() Permissions

func (Permissions) Check

func (p Permissions) Check(path string, accounts Accounts) (bool, string)

func (Permissions) Sort

func (p Permissions) Sort()

type Profile

type Profile struct {
	Name  string `json:"name,omitempty"`
	Mode  string `json:"mode,omitempty"`
	Theme string `json:"theme,omitempty"`
}

func (*Profile) Clone

func (p *Profile) Clone() *Profile

func (*Profile) Equals

func (p *Profile) Equals(x *Profile) bool

func (*Profile) ModeClass

func (p *Profile) ModeClass() string

func (*Profile) String

func (p *Profile) String() string

Jump to

Keyboard shortcuts

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