Documentation
¶
Index ¶
- Constants
- Variables
- func CanAdd[T TAuthable](a OpAuth, u T, rulesets ...RuleSet) error
- func CanCache[T TAuthable](a OpAuth, u T, field string, cache string, rulesets ...RuleSet) error
- func CanDelete[T TAuthable](a OpAuth, u T, rulesets ...RuleSet) error
- func CanUpdate[T TAuthable](a OpAuth, u T, field string, value any, rulesets ...RuleSet) error
- func CanView[T TAuthable](a OpAuth, u T, field string, value any, rulesets ...RuleSet) error
- func Init(rules map[RuleSet]string, adminRole string) error
- func UID(a *Authorizator) string
- type Authorizator
- type IAuthenticate
- type IUser
- type OpAuth
- type Operant
- type Options
- type RuleSet
- type TAuthable
- type TokenType
Constants ¶
View Source
const ( Interfaces = iota Controllers Doors Cards Groups Events Logs Users )
Variables ¶
View Source
var ErrDoNotCache = errors.New("not cacheable")
View Source
var GRULES embed.FS
Functions ¶
func UID ¶
func UID(a *Authorizator) string
Types ¶
type Authorizator ¶
type Authorizator struct { OpAuth // contains filtered or unexported fields }
func NewAuthorizator ¶
func NewAuthorizator(uid, role string) *Authorizator
type IAuthenticate ¶
type IAuthenticate interface { Preauthenticate() (string, error) Authenticate(uid, pwd string) (string, error) Validate(uid, pwd string) error Verify(tokenType TokenType, token string) error Authenticated(token string) (string, string, string, error) Invalidate(tokenType TokenType, token string) error Options(uid, role string) Options AdminRole() string }
type OpAuth ¶
type OpAuth interface { CanView(o Operant, field string, value any, rulesets ...RuleSet) error CanAdd(o Operant, rulesets ...RuleSet) error CanUpdate(o Operant, field string, value any, rulesets ...RuleSet) error CanDelete(o Operant, rulesets ...RuleSet) error CanCache(o Operant, field string, cache string, rulesets ...RuleSet) error }
Click to show internal directories.
Click to hide internal directories.