Documentation
¶
Index ¶
- Variables
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type Base
- type Change
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type EntityInput
- type GrantedUser
- type GrantedUserConnection
- type Invite
- type Mutation
- type MutationResolver
- type PageInfo
- type Permission
- type Query
- type QueryResolver
- type ResolverRoot
- type Role
- type RoleInput
- type SortByInput
- type SortDirection
- type SortableFields
- type Team
- type TeamConnection
- type TeamInput
- type TenantInfo
- type User
- type UserConnection
- type UserInput
- type Zone
Constants ¶
This section is empty.
Variables ¶
View Source
var AllSortDirection = []SortDirection{ SortDirectionAsc, SortDirectionDesc, }
View Source
var AllSortableFields = []SortableFields{ SortableFieldsUser, }
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct {
GrantedUser struct {
Roles func(childComplexity int) int
User func(childComplexity int) int
}
GrantedUserConnection struct {
PageInfo func(childComplexity int) int
Users func(childComplexity int) int
}
Mutation struct {
AssignRoleBindings func(childComplexity int, tenantID string, entityType string, entityID string, input []*Change) int
CreateUser func(childComplexity int, tenantID string, input UserInput) int
DeleteInvite func(childComplexity int, tenantID string, invite Invite) int
InviteUser func(childComplexity int, tenantID string, invite Invite, notifyByEmail bool) int
LeaveEntity func(childComplexity int, tenantID string, entityType string, entityID string) int
Login func(childComplexity int) int
RemoveFromEntity func(childComplexity int, tenantID string, entityType string, userID string, entityID string) int
RemoveUser func(childComplexity int, tenantID string, userID *string, email *string) int
}
PageInfo struct {
OwnerCount func(childComplexity int) int
TotalCount func(childComplexity int) int
}
Permission struct {
DisplayName func(childComplexity int) int
Relation func(childComplexity int) int
}
Query struct {
AvailableRolesForEntity func(childComplexity int, tenantID string, entity EntityInput) int
AvailableRolesForEntityType func(childComplexity int, tenantID string, entityType string) int
RolesForUserOfEntity func(childComplexity int, tenantID string, entity EntityInput, userID string) int
SearchUsers func(childComplexity int, query string) int
TenantInfo func(childComplexity int, tenantID *string) int
User func(childComplexity int, tenantID string, userID string) int
UserByEmail func(childComplexity int, tenantID string, email string) int
UsersByIds func(childComplexity int, tenantID string, userIds []string) int
UsersConnection func(childComplexity int, tenantID string, limit *int, page *int) int
UsersOfEntity func(childComplexity int, tenantID string, entity EntityInput, limit *int, page *int, showInvitees *bool, searchTerm *string, roles []*RoleInput, sortBy *SortByInput) int
}
Role struct {
DisplayName func(childComplexity int) int
Permissions func(childComplexity int) int
TechnicalName func(childComplexity int) int
}
TenantInfo struct {
EmailDomain func(childComplexity int) int
EmailDomains func(childComplexity int) int
Subdomain func(childComplexity int) int
TenantID func(childComplexity int) int
}
User struct {
Email func(childComplexity int) int
FirstName func(childComplexity int) int
InvitationOutstanding func(childComplexity int) int
LastName func(childComplexity int) int
UserID func(childComplexity int) int
}
UserConnection struct {
PageInfo func(childComplexity int) int
User func(childComplexity int) int
}
}
type Config ¶
type Config struct {
Schema *ast.Schema
Resolvers ResolverRoot
Directives DirectiveRoot
Complexity ComplexityRoot
}
type DirectiveRoot ¶
type DirectiveRoot struct {
Authorized func(ctx context.Context, obj any, next graphql.Resolver, relation string, entityType *string, entityTypeParamName *string, entityParamName string) (res any, err error)
PeersOnly func(ctx context.Context, obj any, next graphql.Resolver) (res any, err error)
Tenant func(ctx context.Context, obj any, next graphql.Resolver, peers bool) (res any, err error)
User func(ctx context.Context, obj any, next graphql.Resolver, peers bool) (res any, err error)
}
type EntityInput ¶
type EntityInput struct {
// the type of entity e.g. team, project etc.
EntityType string `json:"entityType"`
// the identifier for the entity itself e.g. name or id
EntityID string `json:"entityId"`
}
An entity of Hyperspace Portal
type GrantedUser ¶
type GrantedUserConnection ¶
type GrantedUserConnection struct {
Users []*GrantedUser `json:"users,omitempty"`
PageInfo *PageInfo `json:"pageInfo"`
}
type Invite ¶
type Invite struct {
Email string `json:"email"`
Entity *EntityInput `json:"entity"`
Roles []string `json:"roles"`
}
type MutationResolver ¶
type MutationResolver interface {
InviteUser(ctx context.Context, tenantID string, invite Invite, notifyByEmail bool) (bool, error)
DeleteInvite(ctx context.Context, tenantID string, invite Invite) (bool, error)
AssignRoleBindings(ctx context.Context, tenantID string, entityType string, entityID string, input []*Change) (bool, error)
RemoveFromEntity(ctx context.Context, tenantID string, entityType string, userID string, entityID string) (bool, error)
LeaveEntity(ctx context.Context, tenantID string, entityType string, entityID string) (bool, error)
CreateUser(ctx context.Context, tenantID string, input UserInput) (*User, error)
RemoveUser(ctx context.Context, tenantID string, userID *string, email *string) (*bool, error)
Login(ctx context.Context) (bool, error)
}
type Permission ¶
type QueryResolver ¶
type QueryResolver interface {
UsersOfEntity(ctx context.Context, tenantID string, entity EntityInput, limit *int, page *int, showInvitees *bool, searchTerm *string, roles []*RoleInput, sortBy *SortByInput) (*GrantedUserConnection, error)
RolesForUserOfEntity(ctx context.Context, tenantID string, entity EntityInput, userID string) ([]*Role, error)
AvailableRolesForEntity(ctx context.Context, tenantID string, entity EntityInput) ([]*Role, error)
AvailableRolesForEntityType(ctx context.Context, tenantID string, entityType string) ([]*Role, error)
User(ctx context.Context, tenantID string, userID string) (*User, error)
UserByEmail(ctx context.Context, tenantID string, email string) (*User, error)
UsersConnection(ctx context.Context, tenantID string, limit *int, page *int) (*UserConnection, error)
SearchUsers(ctx context.Context, query string) ([]*User, error)
TenantInfo(ctx context.Context, tenantID *string) (*TenantInfo, error)
UsersByIds(ctx context.Context, tenantID string, userIds []string) ([]*User, error)
}
type ResolverRoot ¶
type ResolverRoot interface {
Mutation() MutationResolver
Query() QueryResolver
}
type Role ¶
type Role struct {
DisplayName string `json:"displayName"`
TechnicalName string `json:"technicalName"`
Permissions []*Permission `json:"permissions,omitempty"`
}
type RoleInput ¶
type RoleInput struct {
DisplayName string `json:"displayName"`
TechnicalName string `json:"technicalName"`
}
Holds a payload of a role input - label, id, display name and technical name
type SortByInput ¶
type SortByInput struct {
Field SortableFields `json:"field"`
Direction SortDirection `json:"direction"`
}
type SortDirection ¶
type SortDirection string
const ( SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
func (SortDirection) IsValid ¶
func (e SortDirection) IsValid() bool
func (SortDirection) MarshalGQL ¶
func (e SortDirection) MarshalGQL(w io.Writer)
func (SortDirection) MarshalJSON ¶
func (e SortDirection) MarshalJSON() ([]byte, error)
func (SortDirection) String ¶
func (e SortDirection) String() string
func (*SortDirection) UnmarshalGQL ¶
func (e *SortDirection) UnmarshalGQL(v any) error
func (*SortDirection) UnmarshalJSON ¶
func (e *SortDirection) UnmarshalJSON(b []byte) error
type SortableFields ¶
type SortableFields string
const (
SortableFieldsUser SortableFields = "user"
)
func (SortableFields) IsValid ¶
func (e SortableFields) IsValid() bool
func (SortableFields) MarshalGQL ¶
func (e SortableFields) MarshalGQL(w io.Writer)
func (SortableFields) MarshalJSON ¶
func (e SortableFields) MarshalJSON() ([]byte, error)
func (SortableFields) String ¶
func (e SortableFields) String() string
func (*SortableFields) UnmarshalGQL ¶
func (e *SortableFields) UnmarshalGQL(v any) error
func (*SortableFields) UnmarshalJSON ¶
func (e *SortableFields) UnmarshalJSON(b []byte) error
type Team ¶
type TeamConnection ¶
type TenantInfo ¶
type User ¶
type User struct {
Base
ID string `gorm:"type:uuid;primary_key"`
TenantID string `gorm:"index:idx_user_id,unique;index:idx_email,unique;index:idx_user_id_email,unique"`
UserID string `` // nolint: lll
/* 150-byte string literal not displayed */
Email string `gorm:"index:idx_email,unique,where:email != '';index:idx_user_id_email,unique"`
FirstName *string `gorm:"index:idx_first_name"`
LastName *string `gorm:"index:idx_last_name"`
InvitationOutstanding bool
}
type UserConnection ¶
Click to show internal directories.
Click to hide internal directories.