user

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorUserNotFound error = errors.New("user not found")

Functions

This section is empty.

Types

type Service

type Service interface {
	Create(ctx context.Context, user *sdk.User) error
	Update(ctx context.Context, user *sdk.User) error
	GetByEmail(ctx context.Context, email string, projectId string) (*sdk.User, error)
	GetById(ctx context.Context, id string) (*sdk.User, error)
	GetByPhone(ctx context.Context, phone string, projectId string) (*sdk.User, error)
	GetAll(ctx context.Context, query sdk.UserQuery) (*sdk.UserList, error)
	AddRoleToUser(ctx context.Context, userId, roleId string) error
	RemoveRoleFromUser(ctx context.Context, userId, roleId string) error
	AddResourceToUser(ctx context.Context, userId string, request sdk.AddUserResourceRequest) error
	AddPolicyToUser(ctx context.Context, userId string, policies map[string]sdk.UserPolicy) error
	RemovePolicyFromUser(ctx context.Context, userId string, policyIds []string) error
	RemoveResourceFromAll(ctx context.Context, resourceKey string) error
	TransferOwnership(ctx context.Context, userId, newOwnerId string) error
	CopyUserResources(ctx context.Context, sourceUserId, targetUserId string) error
	HandleEvent(event utils.Event[sdk.Role])
	utils.Emitter[utils.Event[sdk.User], sdk.User]
}

func NewService

func NewService(store Store, roleSvc role.Service) Service

type Store

type Store interface {
	Create(ctx context.Context, user *sdk.User) error
	Update(ctx context.Context, user *sdk.User) error
	GetByEmail(ctx context.Context, email string, projectId string) (*sdk.User, error)
	GetById(ctx context.Context, id string) (*sdk.User, error)
	GetByPhone(ctx context.Context, phone string, projectId string) (*sdk.User, error)
	GetAll(ctx context.Context, query sdk.UserQuery) (*sdk.UserList, error)
	RemoveResourceFromAll(ctx context.Context, resourceKey string) error
}

func NewStore

func NewStore(db db.DB) Store

Jump to

Keyboard shortcuts

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