user

package
v0.0.0-...-1ae172a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListUserRoleCondition

type ListUserRoleCondition struct {
	Scope   string
	ScopeId *uint
	UserId  *uint
	Role    string

	// 是否需要username
	WithUsername bool
}

type RoleManager

type RoleManager struct {
	manager.CommonManager
}

func NewRoleManager

func NewRoleManager(redisClient *redis.Client) *RoleManager

func (*RoleManager) Create

func (r *RoleManager) Create(role *types.Role) error

func (*RoleManager) Get

func (r *RoleManager) Get(name string) (*types.Role, error)

func (*RoleManager) Init

func (r *RoleManager) Init()

func (*RoleManager) InitRole

func (r *RoleManager) InitRole(role *types.Role) error

func (*RoleManager) List

func (r *RoleManager) List(filters map[string]interface{}) ([]*types.Role, error)

func (*RoleManager) Update

func (r *RoleManager) Update(role *types.Role) error

type SessionManager

type SessionManager struct {
	manager.CommonManager
}

func NewTokenManager

func NewTokenManager(redisClient *redis.Client) *SessionManager

func (*SessionManager) Create

func (tk *SessionManager) Create(tkObj *types.UserSession) error

func (*SessionManager) Get

func (tk *SessionManager) Get(name string) (*types.UserSession, error)

type UserListCondition

type UserListCondition struct {
	Ids []uint `json:"ids"`
}

type UserManager

type UserManager struct {
	//CommonManager
	//role *RoleManager
	DB *gorm.DB
}

func NewUserManager

func NewUserManager(db *gorm.DB) *UserManager

func (*UserManager) Create

func (u *UserManager) Create(user *types.User) error

func (*UserManager) Delete

func (u *UserManager) Delete(name string) error

func (*UserManager) GetById

func (u *UserManager) GetById(id uint) (*types.User, error)

func (*UserManager) GetByName

func (u *UserManager) GetByName(name string, opfs ...manager.OptionFunc) (*types.User, error)

func (*UserManager) List

func (u *UserManager) List(cond UserListCondition) ([]*types.User, error)

func (*UserManager) Permissions

func (u *UserManager) Permissions(user *types.User) ([]types.Permission, error)

func (*UserManager) Update

func (u *UserManager) Update(user *types.User) error

type UserRoleManager

type UserRoleManager struct {
	DB          *gorm.DB
	UserManager *UserManager
}

func NewUserRoleManager

func NewUserRoleManager(db *gorm.DB, user *UserManager) *UserRoleManager

func (*UserRoleManager) AuthRole

func (r *UserRoleManager) AuthRole(user *types.User, scope string, scopeId uint, role string) bool

AuthRole 对用户角色进行鉴权,判断用户是否有该角色权限

func (*UserRoleManager) CreateOrUpdate

func (r *UserRoleManager) CreateOrUpdate(scope string, scopeId uint, userIds []uint, role string) error

func (*UserRoleManager) Delete

func (r *UserRoleManager) Delete(id uint) error

func (*UserRoleManager) GetById

func (r *UserRoleManager) GetById(id uint) (*types.UserRole, error)

func (*UserRoleManager) GetUserRoles

func (r *UserRoleManager) GetUserRoles(userId uint) ([]types.UserRole, error)

func (*UserRoleManager) List

Jump to

Keyboard shortcuts

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