service

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoAuthIdentity = AuthIdentity{
		UserId:   -2,
		Username: "noauth",
		DeptId:   -2,
		RoleId:   -2,
		RoleKey:  "noauth",
		RoleName: "noauth",
	}

	WebIdentity = AuthIdentity{
		UserId:   -1,
		Username: "web",
		DeptId:   -1,
		RoleId:   -1,
		RoleKey:  "web",
		RoleName: "web",
	}
)

Functions

func Permission

func Permission(tableName string, p *AuthIdentity) func(db *gorm.DB) *gorm.DB

Permission check permission of data scope

Types

type AuthIdentity

type AuthIdentity struct {
	UserId    int
	Username  string
	DeptId    int
	RoleId    int
	RoleKey   string
	RoleName  string
	DataScope string
}

func GetIdentity

func GetIdentity(c *gin.Context) *AuthIdentity

type Service

type Service struct {
	Orm      *gorm.DB
	Identity *AuthIdentity
}

func (*Service) ConstructFromDB

func (s *Service) ConstructFromDB(db *gorm.DB)

Jump to

Keyboard shortcuts

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