Documentation
¶
Index ¶
- Constants
- Variables
- func IsValidEmail(str string) bool
- type AccessPair
- type CSVExport
- type Filter
- type Group
- type GroupData
- type Page
- type PolicyService
- type RelationService
- type Repository
- type RoleService
- type SearchUserResponse
- type Service
- func (s Service) Create(ctx context.Context, user User) (User, error)
- func (s Service) Delete(ctx context.Context, id string) error
- func (s Service) Disable(ctx context.Context, id string) error
- func (s Service) Enable(ctx context.Context, id string) error
- func (s Service) Export(ctx context.Context) ([]byte, string, error)
- func (s Service) GetByEmail(ctx context.Context, email string) (User, error)
- func (s Service) GetByID(ctx context.Context, id string) (User, error)
- func (s Service) GetByIDs(ctx context.Context, userIDs []string) ([]User, error)
- func (s Service) IsSudo(ctx context.Context, id string, permissionName string) (bool, error)
- func (s Service) IsSudos(ctx context.Context, ids []string, permissionName string) ([]relation.Relation, error)
- func (s Service) List(ctx context.Context, flt Filter) ([]User, error)
- func (s Service) ListByGroup(ctx context.Context, groupID string, roleFilter string) ([]User, error)
- func (s Service) ListByOrg(ctx context.Context, orgID string, roleFilter string) ([]User, error)
- func (s Service) Search(ctx context.Context, rql *rql.Query) (SearchUserResponse, error)
- func (s Service) Sudo(ctx context.Context, id string, relationName string) error
- func (s Service) UnSudo(ctx context.Context, id string) error
- func (s Service) Update(ctx context.Context, toUpdate User) (User, error)
- func (s Service) UpdateByEmail(ctx context.Context, toUpdate User) (User, error)
- type State
- type User
Constants ¶
View Source
const CSVContentType = "text/csv"
Variables ¶
View Source
var ( ErrNotExist = errors.New("user doesn't exist") ErrInvalidID = errors.New("user id is invalid") ErrInvalidEmail = errors.New("user email is invalid") ErrConflict = errors.New("user already exist") ErrInvalidDetails = errors.New("invalid user details (name|email)") ErrMissingName = errors.New("user name is missing") ErrEmptyKey = errors.New("empty key") ErrKeyAlreadyExists = errors.New("key already exist") ErrKeyDoesNotExists = errors.New("key does not exist") ErrMissingEmail = errors.New("user email is missing") ErrInvalidUUID = errors.New("invalid syntax of uuid") ErrDisabled = errors.New("user is disabled") ErrNoUsersFound = errors.New("no users found") )
Functions ¶
func IsValidEmail ¶ added in v0.60.0
IsValidEmail checks if the string is a valid email address
Types ¶
type AccessPair ¶ added in v0.7.5
type CSVExport ¶ added in v0.57.0
type CSVExport struct { UserID string `csv:"User ID"` Name string `csv:"Name"` Title string `csv:"Title"` Email string `csv:"Email"` State string `csv:"State"` CreatedAt string `csv:"Joined At"` }
func NewCSVExport ¶ added in v0.57.0
NewCSVExport converts User to CSVExport
func (CSVExport) GetHeaders ¶ added in v0.57.0
GetHeaders returns the CSV headers based on struct tags
type PolicyService ¶ added in v0.7.19
type RelationService ¶
type RelationService interface { Create(ctx context.Context, rel relation.Relation) (relation.Relation, error) BatchCheckPermission(ctx context.Context, relations []relation.Relation) ([]relation.CheckPair, error) Delete(ctx context.Context, rel relation.Relation) error LookupSubjects(ctx context.Context, rel relation.Relation) ([]string, error) LookupResources(ctx context.Context, rel relation.Relation) ([]string, error) }
type Repository ¶
type Repository interface { GetByID(ctx context.Context, id string) (User, error) GetByEmail(ctx context.Context, email string) (User, error) GetByIDs(ctx context.Context, userIds []string) ([]User, error) GetByName(ctx context.Context, name string) (User, error) Create(ctx context.Context, user User) (User, error) List(ctx context.Context, flt Filter) ([]User, error) UpdateByID(ctx context.Context, toUpdate User) (User, error) UpdateByName(ctx context.Context, toUpdate User) (User, error) UpdateByEmail(ctx context.Context, toUpdate User) (User, error) Delete(ctx context.Context, id string) error SetState(ctx context.Context, id string, state State) error Search(ctx context.Context, query *rql.Query) (SearchUserResponse, error) }
type RoleService ¶ added in v0.8.0
type SearchUserResponse ¶ added in v0.57.0
type Service ¶
func NewService ¶
func NewService(repository Repository, relationRepo RelationService, policyService PolicyService, roleService RoleService) *Service
func (Service) GetByEmail ¶
func (Service) IsSudo ¶
IsSudo checks platform permissions. Platform permissions are: - superuser - check
func (Service) ListByGroup ¶
func (Service) UnSudo ¶ added in v0.14.0
UnSudo remove platform permissions to user only remove the 'member' relation if it exists
type User ¶
type User struct { ID string `rql:"name=id,type=string"` Name string `rql:"name=name,type=string"` Email string `rql:"name=email,type=string"` State State `rql:"name=state,type=string"` Avatar string `rql:"name=avatar,type=string"` Title string `rql:"name=title,type=string"` Metadata metadata.Metadata CreatedAt time.Time `rql:"name=created_at,type=datetime"` UpdatedAt time.Time `rql:"name=updated_at,type=datetime"` }
Click to show internal directories.
Click to hide internal directories.