role

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleUserID      = 1
	RoleAdminID     = 2
	RoleModeratorID = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PowerRepo

type PowerRepo interface {
	GetPowerList(ctx context.Context, power *entity.Power) (powers []*entity.Power, err error)
}

PowerRepo power repository

type RolePowerRelRepo

type RolePowerRelRepo interface {
	GetRolePowerTypeList(ctx context.Context, roleID int) (powers []string, err error)
}

RolePowerRelRepo rolePowerRel repository

type RolePowerRelService

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

RolePowerRelService user service

func NewRolePowerRelService

func NewRolePowerRelService(rolePowerRelRepo RolePowerRelRepo,
	userRoleRelService *UserRoleRelService) *RolePowerRelService

NewRolePowerRelService new role power rel service

func (*RolePowerRelService) GetRolePowerList

func (rs *RolePowerRelService) GetRolePowerList(ctx context.Context, roleID int) (powers []string, err error)

GetRolePowerList get role power list

func (*RolePowerRelService) GetUserPowerList

func (rs *RolePowerRelService) GetUserPowerList(ctx context.Context, userID string) (powers []string, err error)

GetUserPowerList get list all

type RoleRepo

type RoleRepo interface {
	GetRoleAllList(ctx context.Context) (roles []*entity.Role, err error)
	GetRoleAllMapping(ctx context.Context) (roleMapping map[int]*entity.Role, err error)
}

RoleRepo role repository

type RoleService

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

RoleService user service

func NewRoleService

func NewRoleService(roleRepo RoleRepo) *RoleService

func (*RoleService) GetRoleList

func (rs *RoleService) GetRoleList(ctx context.Context) (resp []*schema.GetRoleResp, err error)

GetRoleList get role list all

func (*RoleService) GetRoleMapping

func (rs *RoleService) GetRoleMapping(ctx context.Context) (roleMapping map[int]*entity.Role, err error)

type UserRoleRelRepo

type UserRoleRelRepo interface {
	SaveUserRoleRel(ctx context.Context, userID string, roleID int) (err error)
	GetUserRoleRelList(ctx context.Context, userIDs []string) (userRoleRelList []*entity.UserRoleRel, err error)
	GetUserRoleRelListByRoleID(ctx context.Context, roleIDs []int) (
		userRoleRelList []*entity.UserRoleRel, err error)
	GetUserRoleRel(ctx context.Context, userID string) (rolePowerRel *entity.UserRoleRel, exist bool, err error)
}

UserRoleRelRepo userRoleRel repository

type UserRoleRelService

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

UserRoleRelService user service

func NewUserRoleRelService

func NewUserRoleRelService(userRoleRelRepo UserRoleRelRepo, roleService *RoleService) *UserRoleRelService

NewUserRoleRelService new user role rel service

func (*UserRoleRelService) GetUserByRoleID

func (us *UserRoleRelService) GetUserByRoleID(ctx context.Context, roleIDs []int) (rel []*entity.UserRoleRel, err error)

GetUserByRoleID get user by role id

func (*UserRoleRelService) GetUserRole

func (us *UserRoleRelService) GetUserRole(ctx context.Context, userID string) (roleID int, err error)

GetUserRole get user role

func (*UserRoleRelService) GetUserRoleMapping

func (us *UserRoleRelService) GetUserRoleMapping(ctx context.Context, userIDs []string) (
	userRoleMapping map[string]*entity.Role, err error)

GetUserRoleMapping get user role mapping

func (*UserRoleRelService) GetUserRoleRelMapping

func (us *UserRoleRelService) GetUserRoleRelMapping(ctx context.Context, userIDs []string) (
	userRoleRelMapping map[string]int, err error)

GetUserRoleRelMapping get user role rel mapping

func (*UserRoleRelService) SaveUserRole

func (us *UserRoleRelService) SaveUserRole(ctx context.Context, userID string, roleID int) (err error)

SaveUserRole save user role

Jump to

Keyboard shortcuts

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