user

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 4 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 SetPermissions

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

Types

type Account

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

func (Account) String

func (a Account) String() 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) 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

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"`
	Mode  string `json:"mode,omitempty"`
	Theme string `json:"theme,omitempty"`
}

func (*Profile) AuthString

func (p *Profile) AuthString(a Accounts) string

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