rbac

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DB  *gorm.DB
	Err *Err
}

type Err

type Err struct{}

func (Err) Msg

func (Err) Msg(msg string) error

type Page

type Page struct {
	Config `json:"-"`

	Page     int   `json:"page,omitempty"`
	Count    int   `json:"count,omitempty"`
	Enable   bool  `json:"enable,omitempty"`
	Level    int32 `json:"level,omitempty"`     // 权限层级
	ParentId int64 `json:"parent_id,omitempty"` // 父级权限id
}

func (*Page) PermPageTurn

func (self *Page) PermPageTurn() (perms []auth.IPerm, err error)

func (*Page) RolePageTurn

func (self *Page) RolePageTurn() (roles []auth.IRole, err error)

func (*Page) UserPageTurn

func (self *Page) UserPageTurn() (users []auth.IUser, err error)

type Perm

type Perm struct {
	Config `gorm:"-" json:"-"`

	PermId   int64  `gorm:"column:perm_id;primaryKey" json:"perm_id,omitempty"`
	Name     string `gorm:"column:name;default:''" json:"name,omitempty"`
	Path     string `gorm:"column:path;default:''" json:"path,omitempty"`
	Level    int32  `gorm:"column:level;default:0" json:"level,omitempty"`
	ParentId int64  `gorm:"column:parent_id;default:0" json:"parent_id,omitempty"`
	Status   string `gorm:"column:status;default:'enable'" json:"status,omitempty"`
}

func (*Perm) Add

func (self *Perm) Add() (pid int64, err error)

func (*Perm) Del

func (self *Perm) Del() (err error)

func (*Perm) Get

func (self *Perm) Get() (auth.IPerm, error)

func (Perm) TableName

func (Perm) TableName() string

type Query

type Query struct {
	Config

	UserId int64   `json:"user_id,omitempty"`
	User   User    `json:"user,omitempty"`
	Roles  []*Role `json:"roles,omitempty"`
	Perms  []*Perm `json:"perms,omitempty"`
}

func (*Query) GetAllByUser

func (self *Query) GetAllByUser() (err error)

type Role

type Role struct {
	Config `gorm:"-" json:"-"`

	RoleId int64  `gorm:"column:role_id;primaryKey" json:"role_id,omitempty"`
	Name   string `gorm:"column:name;default:''" json:"name,omitempty"`
	Status string `gorm:"column:status;default:'enable'" json:"status,omitempty"`
}

func (*Role) Add

func (self *Role) Add() (rid int64, err error)

func (*Role) Del

func (self *Role) Del() (err error)

func (*Role) Get

func (self *Role) Get() (auth.IRole, error)

func (Role) TableName

func (Role) TableName() string

type RolePerm

type RolePerm struct {
	Config `gorm:"-" json:"-"`

	RoleId int64  `gorm:"column:role_id;primaryKey" json:"role_id,omitempty"`
	PermId int64  `gorm:"column:perm_id;primaryKey" json:"perm_id,omitempty"`
	Status string `gorm:"column:status;default:'enable'" json:"status,omitempty"`
}

func (*RolePerm) Add

func (self *RolePerm) Add() error

func (*RolePerm) Del

func (self *RolePerm) Del() (err error)

func (RolePerm) TableName

func (RolePerm) TableName() string

type User

type User struct {
	Config `gorm:"-" json:"-"`

	UserId int64  `gorm:"column:user_id;primaryKey" json:"user_id,omitempty"`
	Nick   string `gorm:"column:nick;default:''" json:"nick,omitempty"`
	Phone  string `gorm:"column:phone;default:''" json:"phone,omitempty"`
	Name   string `gorm:"column:name;default:''" json:"name,omitempty"`
	Pass   string `gorm:"column:pass;default:''" json:"pass,omitempty"`
	Status string `gorm:"column:status;default:'enable'" json:"status,omitempty"`
}

func (*User) Add

func (self *User) Add() (uid int64, err error)

func (*User) Del

func (self *User) Del() (err error)

func (*User) Get

func (self *User) Get() (auth.IUser, error)

func (User) TableName

func (User) TableName() string

type UserRole

type UserRole struct {
	Config `gorm:"-" json:"-"`

	UserId int64  `gorm:"column:user_id;primaryKey" json:"user_id,omitempty"`
	RoleId int64  `gorm:"column:role_id;primaryKey" json:"role_id,omitempty"`
	Status string `gorm:"column:status;default:'enable'" json:"status,omitempty"`
}

func (*UserRole) Add

func (self *UserRole) Add() error

func (*UserRole) Del

func (self *UserRole) Del() (err error)

func (UserRole) TableName

func (UserRole) TableName() string

Jump to

Keyboard shortcuts

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