member

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package member 成员操作封装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Member

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

Member 成员操作封装

func New

func New(options ...Option) *Member

New 新建 Member 实例

func (*Member) CheckInviteCode

func (m *Member) CheckInviteCode(inviteCode, orgID string) (string, error)

CheckInviteCode 校验邀请码

func (*Member) CheckPermission

func (m *Member) CheckPermission(userID string, scopeType apistructs.ScopeType, scopeID int64) error

CheckPermission 成员相关API鉴权, userID: 当前操作用户

func (*Member) CreateOrUpdate

func (m *Member) CreateOrUpdate(userID string, req apistructs.MemberAddRequest) error

CreateOrUpdate 创建/更新成员

func (*Member) Delete

func (m *Member) Delete(userID string, req apistructs.MemberRemoveRequest) error

Delete 删除成员

func (*Member) GetAllOrganizational

func (m *Member) GetAllOrganizational() (*apistructs.GetAllOrganizationalData, error)

GetAllOrganizational 获取所有组织架构

func (*Member) GetByToken

func (m *Member) GetByToken(token string) (*model.Member, error)

GetByToken 根据用户token获取成员

func (*Member) GetByUserAndScope

func (m *Member) GetByUserAndScope(userID string, scopeType apistructs.ScopeType, scopeID int64) ([]model.MemberJoin, error)

GetByUserAndScope 根据用户 & scope获取成员

func (*Member) GetScopeManagersByScopeID

func (m *Member) GetScopeManagersByScopeID(scopeType apistructs.ScopeType, scopeID int64) ([]apistructs.Member, error)

GetScopeManagersByScopeID 根据 scopeID 获取 scope 对应的管理员列表

func (*Member) IsAdmin

func (m *Member) IsAdmin(userID string) bool

IsAdmin 检查用户是否为系统管理员

func (*Member) List

func (m *Member) List(param *apistructs.MemberListRequest) (int, []model.Member, error)

List 成员列表/查询

func (*Member) ListByOrgAndUser

func (m *Member) ListByOrgAndUser(orgID int64, userID string) ([]model.MemberJoin, error)

ListByOrgAndUser 根据用户获取成员列表

func (*Member) ListByScopeTypeAndUser

func (m *Member) ListByScopeTypeAndUser(scopeType apistructs.ScopeType, userID string) ([]model.Member, error)

ListByScopeTypeAndUser 根据scopeType & user 获取成员

func (*Member) ListMemberLabel

func (m *Member) ListMemberLabel(userID string, scopeID int64) ([]string, error)

ListMemberLabel 查看一个成员的label

func (*Member) ListMemberRolesByUser

ListMemberRolesByUser 根据用户查看角色

func (*Member) ListOrgByUserIDs

func (m *Member) ListOrgByUserIDs(userIDs []string) ([]model.Member, error)

ListOrgByUserIDs 获取userid对应的企业关系

func (*Member) UpdateMemberUserInfo

func (m *Member) UpdateMemberUserInfo(req apistructs.MemberUserInfoUpdateRequest) error

UpdateMemberUserInfo 更新成员的user info 和 uc 同步

type Option

type Option func(*Member)

Option 定义 Member 对象配置选项

func WithDBClient

func WithDBClient(db *dao.DBClient) Option

WithDBClient 配置 db client

func WithRedisClient

func WithRedisClient(cli *redis.Client) Option

WithRedisClient 配置 redis client

func WithTokenSvc

func WithTokenSvc(tokenService tokenpb.TokenServiceServer) Option

func WithTranslator

func WithTranslator(tran i18n.Translator) Option

func WithUCClient

func WithUCClient(uc userpb.UserServiceServer) Option

WithUCClient 配置 uc client

Jump to

Keyboard shortcuts

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