model

package
v0.0.0-...-18d628c Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTokenName      = "X-Webitel-Access"
	RequestContextName = "grpc_ctx"
)
View Source
const (
	SuperSelectPermission = "read"
	SuperEditPermission   = "write"
	SuperCreatePermission = "add"
	SuperDeletePermission = "delete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessMode

type AccessMode uint8
const (
	Delete AccessMode = 1 << iota
	Edit
	Read
	Add

	NONE AccessMode = 0
	FULL            = Add | Read | Edit | Delete
)

func (AccessMode) Value

func (a AccessMode) Value() uint8

type Permission

type Permission struct {
	Id   string
	Name string
}

type Role

type Role struct {
	Name string
	Id   int64
}

type Scope

type Scope struct {
	Name   string
	Class  string
	Access string
	Id     int64
	Abac   bool
	Obac   bool
	Rbac   bool
}

func (*Scope) IsObacUsed

func (s *Scope) IsObacUsed() bool

func (*Scope) IsRbacUsed

func (s *Scope) IsRbacUsed() bool

type Session

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

func ConstructSessionFromUserInfo

func ConstructSessionFromUserInfo(userinfo *authmodel.Userinfo) *Session

func (*Session) GetAclRoles

func (s *Session) GetAclRoles() []int64

func (*Session) GetDomainId

func (s *Session) GetDomainId() int64

func (*Session) GetScope

func (s *Session) GetScope(scopeName string) *Scope

func (*Session) GetUser

func (s *Session) GetUser() *User

func (*Session) GetUserId

func (s *Session) GetUserId() int64

func (*Session) GetUserName

func (s *Session) GetUserName() string

func (*Session) HasObacAccess

func (s *Session) HasObacAccess(scopeName string, accessType AccessMode) bool

func (*Session) HasPermission

func (s *Session) HasPermission(permissionName string) bool

func (*Session) HasScope

func (s *Session) HasScope(scopeName string) bool

func (*Session) IsExpired

func (s *Session) IsExpired() bool

type User

type User struct {
	Name      string
	Username  string
	Extension string
	Id        int64
}

Jump to

Keyboard shortcuts

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