Documentation ¶
Index ¶
- Constants
- func NewOperationPerm() svcutil.OperationPerm
- func NewOperationPermissionMap() map[svcutil.Operation]svcutil.Permission
- func NewRolesOperationPermissionMap() map[svcutil.Operation]svcutil.Permission
- type Domain
- type DomainReq
- type DomainsPage
- type Metadata
- type Page
- type Repository
- type Service
- type Status
Constants ¶
View Source
const ( Disabled = "disabled" Enabled = "enabled" Freezed = "freezed" Deleted = "deleted" All = "all" Unknown = "unknown" )
String representation of the possible status values.
View Source
const ( OpUpdateDomain svcutil.Operation = iota OpRetrieveDomain OpEnableDomain OpDisableDomain )
View Source
const ( ClientCreatePermission = "client_create_permission" ChannelCreatePermission = "channel_create_permission" GroupCreatePermission = "group_create_permission" )
View Source
const BuiltInRoleAdmin roles.BuiltInRoleName = "admin"
Variables ¶
This section is empty.
Functions ¶
func NewOperationPerm ¶
func NewOperationPerm() svcutil.OperationPerm
func NewOperationPermissionMap ¶
func NewOperationPermissionMap() map[svcutil.Operation]svcutil.Permission
func NewRolesOperationPermissionMap ¶
func NewRolesOperationPermissionMap() map[svcutil.Operation]svcutil.Permission
Types ¶
type Domain ¶
type Domain struct { ID string `json:"id"` Name string `json:"name"` Metadata Metadata `json:"metadata,omitempty"` Tags []string `json:"tags,omitempty"` Alias string `json:"alias,omitempty"` Status Status `json:"status"` RoleID string `json:"role_id,omitempty"` RoleName string `json:"role_name,omitempty"` Actions []string `json:"actions,omitempty"` CreatedBy string `json:"created_by,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedBy string `json:"updated_by,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type DomainsPage ¶
type DomainsPage struct { Total uint64 `json:"total"` Offset uint64 `json:"offset"` Limit uint64 `json:"limit"` Domains []Domain `json:"domains"` }
func (DomainsPage) MarshalJSON ¶
func (page DomainsPage) MarshalJSON() ([]byte, error)
type Page ¶
type Page struct { Total uint64 `json:"total"` Offset uint64 `json:"offset"` Limit uint64 `json:"limit"` Name string `json:"name,omitempty"` Order string `json:"-"` Dir string `json:"-"` Metadata Metadata `json:"metadata,omitempty"` Tag string `json:"tag,omitempty"` RoleName string `json:"role_name,omitempty"` RoleID string `json:"role_id,omitempty"` Actions []string `json:"actions,omitempty"` Status Status `json:"status,omitempty"` ID string `json:"id,omitempty"` IDs []string `json:"-"` Identity string `json:"identity,omitempty"` UserID string `json:"-"` }
type Repository ¶
type Repository interface { // Save creates db insert transaction for the given domain. Save(ctx context.Context, d Domain) (Domain, error) // RetrieveByID retrieves Domain by its unique ID. RetrieveByID(ctx context.Context, id string) (Domain, error) RetrieveByUserAndID(ctx context.Context, userID, id string) (Domain, error) // RetrieveAllByIDs retrieves for given Domain IDs. RetrieveAllByIDs(ctx context.Context, pm Page) (DomainsPage, error) // Update updates the client name and metadata. Update(ctx context.Context, id string, userID string, d DomainReq) (Domain, error) // Delete Delete(ctx context.Context, id string) error // ListDomains list all the domains ListDomains(ctx context.Context, pm Page) (DomainsPage, error) roles.Repository }
Repository specifies Domain persistence API.
type Service ¶
type Service interface { CreateDomain(ctx context.Context, sesssion authn.Session, d Domain) (Domain, error) RetrieveDomain(ctx context.Context, sesssion authn.Session, id string) (Domain, error) UpdateDomain(ctx context.Context, sesssion authn.Session, id string, d DomainReq) (Domain, error) EnableDomain(ctx context.Context, sesssion authn.Session, id string) (Domain, error) DisableDomain(ctx context.Context, sesssion authn.Session, id string) (Domain, error) FreezeDomain(ctx context.Context, sesssion authn.Session, id string) (Domain, error) ListDomains(ctx context.Context, sesssion authn.Session, page Page) (DomainsPage, error) DeleteUserFromDomains(ctx context.Context, id string) error roles.RoleManager }
func New ¶
func New(repo Repository, policy policies.Service, idProvider supermq.IDProvider, sidProvider supermq.IDProvider, availableActions []roles.Action, builtInRoles map[roles.BuiltInRoleName][]roles.Action) (Service, error)
type Status ¶
type Status uint8
Status represents Domain status.
const ( // EnabledStatus represents enabled Domain. EnabledStatus Status = iota // DisabledStatus represents disabled Domain. DisabledStatus // FreezeStatus represents domain is in freezed state. FreezeStatus // DeletedStatus represents domain is in deleted state. DeletedStatus // AllStatus is used for querying purposes to list Domains irrespective // of their status - enabled, disabled, freezed, deleting. It is never stored in the // database as the actual domain status and should always be the larger than freeze status // value in this enumeration. AllStatus )
Possible Domain status values.
func (Status) MarshalJSON ¶
Custom Marshaller for Domains status.
func (*Status) UnmarshalJSON ¶
Custom Unmarshaler for Domains status.
Directories ¶
Path | Synopsis |
---|---|
api
|
|
grpc
Package grpc contains implementation of Domains service gRPC API.
|
Package grpc contains implementation of Domains service gRPC API. |
Package events provides the domain concept definitions needed to support SuperMQ auth service functionality.
|
Package events provides the domain concept definitions needed to support SuperMQ auth service functionality. |
Package postgres contains Key repository implementations using PostgreSQL as the underlying database.
|
Package postgres contains Key repository implementations using PostgreSQL as the underlying database. |
Click to show internal directories.
Click to hide internal directories.