groups

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

Groups

The Groups service exposes HTTP and gRPC APIs for organizing entities into hierarchical groups within a domain, managing membership, permissions, and roles. It handles group lifecycle (create/update/enable/disable/delete), parent/child relationships, listings (flat or tree), and role-based access.

For a deeper overview of SuperMQ, see the official documentation.

Configuration

The service is configured via environment variables (unset values fall back to defaults).

Variable Description Default
SMQ_GROUPS_LOG_LEVEL Log level for Groups (debug, info, warn, error) debug
SMQ_GROUPS_HTTP_HOST Groups service HTTP host groups
SMQ_GROUPS_HTTP_PORT Groups service HTTP port 9004
SMQ_GROUPS_HTTP_SERVER_CERT Path to PEM-encoded HTTP server certificate ""
SMQ_GROUPS_HTTP_SERVER_KEY Path to PEM-encoded HTTP server key ""
SMQ_GROUPS_HTTP_SERVER_CA_CERTS Path to trusted CA bundle for the HTTP server ""
SMQ_GROUPS_HTTP_CLIENT_CA_CERTS Path to client CA bundle to require HTTP mTLS ""
SMQ_GROUPS_GRPC_HOST Groups service gRPC host groups
SMQ_GROUPS_GRPC_PORT Groups service gRPC port 7004
SMQ_GROUPS_GRPC_SERVER_CERT Path to PEM-encoded gRPC server certificate ""
SMQ_GROUPS_GRPC_SERVER_KEY Path to PEM-encoded gRPC server key ""
SMQ_GROUPS_GRPC_SERVER_CA_CERTS Path to trusted CA bundle for the gRPC server ""
SMQ_GROUPS_GRPC_CLIENT_CA_CERTS Path to client CA bundle to require gRPC mTLS ""
SMQ_GROUPS_DB_HOST Database host address groups-db
SMQ_GROUPS_DB_PORT Database host port 5432
SMQ_GROUPS_DB_USER Database user supermq
SMQ_GROUPS_DB_PASS Database password supermq
SMQ_GROUPS_DB_NAME Name of the database used by the service groups
SMQ_GROUPS_DB_SSL_MODE Database connection SSL mode (disable, require, verify-ca, verify-full) disable
SMQ_GROUPS_DB_SSL_CERT Path to the PEM-encoded certificate file ""
SMQ_GROUPS_DB_SSL_KEY Path to the PEM-encoded key file ""
SMQ_GROUPS_DB_SSL_ROOT_CERT Path to the PEM-encoded root certificate file ""
SMQ_GROUPS_INSTANCE_ID Groups instance ID (auto-generated when empty) ""
SMQ_GROUPS_EVENT_CONSUMER NATS consumer name for domain events groups
SMQ_SPICEDB_HOST SpiceDB host for policy checks supermq-spicedb
SMQ_SPICEDB_PORT SpiceDB port 50051
SMQ_SPICEDB_SCHEMA_FILE Path to SpiceDB schema file used to seed available actions "/schema.zed"
SMQ_SPICEDB_PRE_SHARED_KEY SpiceDB preshared key 12345678
SMQ_ES_URL Event store URL nats://nats:4222
SMQ_JAEGER_URL Jaeger server URL http://jaeger:4318/v1/traces
SMQ_JAEGER_TRACE_RATIO Trace sampling ratio 1.0
SMQ_SEND_TELEMETRY Send telemetry to the SuperMQ call-home server true
SMQ_AUTH_GRPC_URL Auth service gRPC URL ""
SMQ_AUTH_GRPC_TIMEOUT Auth service gRPC request timeout 1s
SMQ_AUTH_GRPC_CLIENT_CERT Path to the PEM-encoded Auth gRPC client certificate ""
SMQ_AUTH_GRPC_CLIENT_KEY Path to the PEM-encoded Auth gRPC client key ""
SMQ_AUTH_GRPC_SERVER_CA_CERTS Path to the PEM-encoded Auth gRPC trusted CA bundle ""
SMQ_GROUPS_CALLOUT_URLS Comma-separated list of HTTP callout targets invoked on group operations ""
SMQ_GROUPS_CALLOUT_METHOD HTTP method for callouts (POST or GET) POST
SMQ_GROUPS_CALLOUT_TLS_VERIFICATION Verify TLS certificates for callouts false
SMQ_GROUPS_CALLOUT_TIMEOUT Callout request timeout 10s
SMQ_GROUPS_CALLOUT_CA_CERT CA bundle for verifying callout targets ""
SMQ_GROUPS_CALLOUT_CERT Client certificate for mTLS callouts ""
SMQ_GROUPS_CALLOUT_KEY Client key for mTLS callouts ""
SMQ_GROUPS_CALLOUT_OPERATIONS Comma-separated list of operation names that should trigger callouts ""

Note: Set SMQ_GROUPS_CALLOUT_OPERATIONS to a subset of OpCreateGroup, OpViewGroup, OpUpdateGroup, OpEnableGroup, OpDisableGroup, OpDeleteGroup, OpListGroups, OpHierarchy, OpAddParentGroup, OpRemoveParentGroup, OpAddChildrenGroups, OpRemoveChildrenGroups, OpRemoveAllChildrenGroups, or OpListChildrenGroups to filter which actions produce callouts.

Deployment

The service ships as a Docker container. See the groups section in docker-compose.yaml for deployment configuration.

To build and run locally:

# download the latest version of the service
git clone https://github.com/absmach/supermq
cd supermq

# compile the groups service
make groups

# copy binary to $GOBIN
make install

# set the environment variables and run the service
SMQ_GROUPS_LOG_LEVEL=debug \
SMQ_GROUPS_HTTP_HOST=groups \
SMQ_GROUPS_HTTP_PORT=9004 \
SMQ_GROUPS_HTTP_SERVER_CERT="" \
SMQ_GROUPS_HTTP_SERVER_KEY="" \
SMQ_GROUPS_GRPC_HOST=groups \
SMQ_GROUPS_GRPC_PORT=7004 \
SMQ_GROUPS_GRPC_SERVER_CERT="" \
SMQ_GROUPS_GRPC_SERVER_KEY="" \
SMQ_GROUPS_GRPC_SERVER_CA_CERTS="" \
SMQ_GROUPS_GRPC_CLIENT_CA_CERTS="" \
SMQ_GROUPS_DB_HOST=groups-db \
SMQ_GROUPS_DB_PORT=5432 \
SMQ_GROUPS_DB_USER=supermq \
SMQ_GROUPS_DB_PASS=supermq \
SMQ_GROUPS_DB_NAME=groups \
SMQ_GROUPS_DB_SSL_MODE=disable \
SMQ_GROUPS_DB_SSL_CERT="" \
SMQ_GROUPS_DB_SSL_KEY="" \
SMQ_GROUPS_DB_SSL_ROOT_CERT="" \
SMQ_AUTH_GRPC_URL="" \
SMQ_AUTH_GRPC_TIMEOUT=1s \
SMQ_AUTH_GRPC_CLIENT_CERT="" \
SMQ_AUTH_GRPC_CLIENT_KEY="" \
SMQ_AUTH_GRPC_SERVER_CA_CERTS="" \
SMQ_DOMAINS_GRPC_URL=domains:7003 \
SMQ_DOMAINS_GRPC_TIMEOUT=1s \
SMQ_DOMAINS_GRPC_CLIENT_CERT="" \
SMQ_DOMAINS_GRPC_CLIENT_KEY="" \
SMQ_DOMAINS_GRPC_SERVER_CA_CERTS="" \
SMQ_CHANNELS_GRPC_URL=channels:7005 \
SMQ_CHANNELS_GRPC_TIMEOUT=1s \
SMQ_CHANNELS_GRPC_CLIENT_CERT="" \
SMQ_CHANNELS_GRPC_CLIENT_KEY="" \
SMQ_CHANNELS_GRPC_SERVER_CA_CERTS="" \
SMQ_CLIENTS_GRPC_URL=clients:7000 \
SMQ_CLIENTS_GRPC_TIMEOUT=1s \
SMQ_CLIENTS_GRPC_CLIENT_CERT="" \
SMQ_CLIENTS_GRPC_CLIENT_KEY="" \
SMQ_CLIENTS_GRPC_SERVER_CA_CERTS="" \
SMQ_SPICEDB_HOST=localhost \
SMQ_SPICEDB_PORT=50051 \
SMQ_SPICEDB_SCHEMA_FILE=schema.zed \
SMQ_SPICEDB_PRE_SHARED_KEY=12345678 \
SMQ_ES_URL=nats://localhost:4222 \
SMQ_JAEGER_URL=<http://localhost:4318/v1/traces> \
SMQ_JAEGER_TRACE_RATIO=1.0 \
SMQ_GROUPS_CALLOUT_URLS="" \
SMQ_GROUPS_CALLOUT_METHOD=POST \
SMQ_GROUPS_CALLOUT_TLS_VERIFICATION=false \
SMQ_GROUPS_CALLOUT_TIMEOUT=10s \
SMQ_GROUPS_CALLOUT_CA_CERT="" \
SMQ_GROUPS_CALLOUT_CERT="" \
SMQ_GROUPS_CALLOUT_KEY="" \
SMQ_GROUPS_CALLOUT_OPERATIONS="" \
SMQ_SEND_TELEMETRY=true \
SMQ_GROUPS_INSTANCE_ID="" \
$GOBIN/supermq-groups

Usage

Groups supports the following operations:

Operation Description
create Create a new group within a domain
list List groups (flat list or tree) with filters for metadata, tags, status
get Retrieve a single group (optionally with role memberships)
update Update a group’s name, description, tags, or metadata
enable / disable Enable or disable a group
delete Permanently delete a group
add-parent / remove-parent Assign or remove a parent group
add-children / remove-children Attach or detach child groups (or remove all children)
list-children List children at specific depth ranges
hierarchy Fetch ancestors/descendants as a tree or list
roles Create/list/update/delete group roles; manage role actions and members
API Examples
Create a Group
curl -X POST http://localhost:9004/<domainID>/groups \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "edge-devices",
    "description": "All edge devices",
    "metadata": { "region": "eu-west-1" },
    "tags": ["iot","edge"],
    "parent_id": "",
    "status": "enabled"
  }'
List Groups (flat)
curl -X GET "http://localhost:9004/<domainID>/groups?limit=10&status=enabled" \
  -H "Authorization: Bearer <your_access_token>"
Retrieve a Group (with Roles)
curl -X GET "http://localhost:9004/<domainID>/groups/<groupID>?roles=true" \
  -H "Authorization: Bearer <your_access_token>"
Update a Group
curl -X PUT http://localhost:9004/<domainID>/groups/<groupID> \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "edge-ops",
    "description": "Edge operations",
    "metadata": { "region": "eu-west-1", "env": "prod" },
    "tags": ["iot","ops"]
  }'
Enable or Disable a Group
curl -X POST http://localhost:9004/<domainID>/groups/<groupID>/enable \
  -H "Authorization: Bearer <your_access_token>"

curl -X POST http://localhost:9004/<domainID>/groups/<groupID>/disable \
  -H "Authorization: Bearer <your_access_token>"
Manage Hierarchy
# Add a parent
curl -X POST http://localhost:9004/<domainID>/groups/<groupID>/parents \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{ "parent_id": "<parentID>" }'

# List children between levels 1 and 2
curl -X GET "http://localhost:9004/<domainID>/groups/<groupID>/children?start_level=1&end_level=2&limit=10" \
  -H "Authorization: Bearer <your_access_token>"

Roles Management for Groups

Group roles use the shared role manager. Supported operations mirror domain roles (create, list, view, update, delete roles; add/list/remove actions; add/list/remove members; list available actions).

Example: create a group role

curl -X POST http://localhost:9004/<domainID>/groups/<groupID>/roles \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "role_name": "group-admin",
    "optional_actions": ["manage_role_permission", "update_permission"],
    "optional_members": ["<userID>"]
  }'

List available actions for groups:

curl -X GET http://localhost:9004/<domainID>/groups/roles/available-actions \
  -H "Authorization: Bearer <your_access_token>"

Implementation Details

  • Groups are stored in PostgreSQL with ltree paths for hierarchy queries; domain migrations are applied alongside group migrations for referential integrity.
  • Role tables are provisioned per entity with a groups_ prefix.
  • Event notifications are published to SMQ_ES_URL; domain events are consumed to keep group data aligned.
  • Authorization and roles are enforced through SpiceDB and shared policy middleware.
  • Optional HTTP callouts (pre-operation hooks) are controlled via SMQ_GROUPS_CALLOUT_*.
  • Observability: Jaeger tracing, Prometheus metrics at /metrics, and a /health endpoint.
Groups Table
Column Type Description
id VARCHAR(36) UUID of the group (primary key)
parent_id VARCHAR(36) Optional parent group (self-referential FK)
domain_id VARCHAR(36) Owning domain
name VARCHAR(1024) Group name
description VARCHAR(1024) Optional description
metadata JSONB Arbitrary metadata
tags TEXT[] Group tags
path LTREE Hierarchical path for fast ancestor/descendant queries
created_at TIMESTAMPTZ Creation timestamp
updated_at TIMESTAMPTZ Last update timestamp
updated_by VARCHAR(254) Actor who last updated the group
status SMALLINT 0 = enabled, 1 = disabled, 2 = deleted

Best Practices

  • Model hierarchy deliberately: keep depth reasonable and avoid cycles by design.
  • Use tags/metadata to segment groups by environment, region, or ownership for filtering.
  • Prefer disable before delete when you need reversible off-boarding.
  • Use roles sparingly and audit with list-role-members; grant only required actions.
  • Fetch children with bounded levels to keep queries efficient.
  • Limit callouts to necessary operations via SMQ_GROUPS_CALLOUT_OPERATIONS.

Versioning and Health Check

The Groups service exposes /health with status and build metadata.

curl -X GET http://localhost:9004/health \
  -H "accept: application/health+json"

Example response:

{
  "status": "pass",
  "version": "0.18.0",
  "commit": "7d6f4dc4f7f0c1fa3dc24eddfb18bb5073ff4f62",
  "description": "groups service",
  "build_time": "1970-01-01_00:00:00"
}

For full API coverage, see the Groups API documentation.

Documentation

Overview

Package groups contains the domain concept definitions needed to support SuperMQ groups functionality.

Index

Constants

View Source
const (
	MaxLevel      = uint64(20)
	MaxPathLength = 20
)

MaxLevel represents the maximum group hierarchy level.

View Source
const (
	OpViewGroup permissions.Operation = iota
	OpUpdateGroup
	OpUpdateGroupTags
	OpEnableGroup
	OpDisableGroup
	OpRetrieveGroupHierarchy
	OpAddParentGroup
	OpRemoveParentGroup
	OpAddChildrenGroups
	OpRemoveChildrenGroups
	OpRemoveAllChildrenGroups
	OpListChildrenGroups
	OpDeleteGroup
	OpGroupSetChildClient
	OpGroupRemoveChildClient
	OpGroupSetChildChannel
	OpGroupRemoveChildChannel
	OpListUserGroups
)

Group Operations.

View Source
const (
	Disabled = "disabled"
	Enabled  = "enabled"
	Deleted  = "deleted"
	All      = "all"
	Unknown  = "unknown"
)

String representation of the possible status values.

View Source
const BuiltInRoleAdmin roles.BuiltInRoleName = "admin"

Variables

View Source
var (
	// ErrInvalidStatus indicates invalid status.
	ErrInvalidStatus = errors.New("invalid groups status")

	// ErrEnableGroup indicates error in enabling group.
	ErrEnableGroup = errors.New("failed to enable group")

	// ErrDisableGroup indicates error in disabling group.
	ErrDisableGroup = errors.New("failed to disable group")
)
View Source
var (
	ErrGroupIDs = errors.New("invalid group ids")
)

Functions

func OperationDetails added in v0.18.4

func OperationDetails() map[permissions.Operation]permissions.OperationDetails

Types

type Group

type Group struct {
	ID                        string                    `json:"id"`
	Domain                    string                    `json:"domain_id,omitempty"`
	Parent                    string                    `json:"parent_id,omitempty"`
	Name                      string                    `json:"name"`
	Description               nullable.Value[string]    `json:"description,omitempty"`
	Tags                      []string                  `json:"tags,omitempty"`
	Metadata                  Metadata                  `json:"metadata,omitempty"`
	Level                     int                       `json:"level,omitempty"`
	Path                      string                    `json:"path,omitempty"`
	Children                  []*Group                  `json:"children,omitempty"`
	CreatedAt                 time.Time                 `json:"created_at"`
	UpdatedAt                 time.Time                 `json:"updated_at,omitempty"`
	UpdatedBy                 string                    `json:"updated_by,omitempty"`
	Status                    Status                    `json:"status"`
	RoleID                    string                    `json:"role_id,omitempty"`
	RoleName                  string                    `json:"role_name,omitempty"`
	Actions                   []string                  `json:"actions,omitempty"`
	AccessType                string                    `json:"access_type,omitempty"`
	AccessProviderId          string                    `json:"access_provider_id,omitempty"`
	AccessProviderRoleId      string                    `json:"access_provider_role_id,omitempty"`
	AccessProviderRoleName    string                    `json:"access_provider_role_name,omitempty"`
	AccessProviderRoleActions []string                  `json:"access_provider_role_actions,omitempty"`
	MemberId                  string                    `json:"member_id,omitempty"`
	Roles                     []roles.MemberRoleActions `json:"roles,omitempty"`
}

Group represents the group of Clients. Indicates a level in tree hierarchy. Root node is level 1. Path in a tree consisting of group IDs Paths are unique per domain.

type HierarchyPage

type HierarchyPage struct {
	HierarchyPageMeta
	Groups []Group
}

type HierarchyPageMeta

type HierarchyPageMeta struct {
	Level     uint64 `json:"level"`
	Direction int64  `json:"direction"` // ancestors (+1) or descendants (-1)
	// - `true`  - result is JSON tree representing groups hierarchy,
	// - `false` - result is JSON array of groups.
	Tree bool `json:"tree"`
}

type Member

type Member struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type MembersPage

type MembersPage struct {
	Total   uint64   `json:"total"`
	Offset  uint64   `json:"offset"`
	Limit   uint64   `json:"limit"`
	Members []Member `json:"members"`
}

Memberships contains page related metadata as well as list of memberships that belong to this page.

type Metadata

type Metadata map[string]any

Metadata represents arbitrary JSON.

type Page

type Page struct {
	PageMeta
	Groups []Group
}

Page contains page related metadata as well as list of Groups that belong to the page.

type PageMeta

type PageMeta struct {
	Total      uint64   `json:"total"`
	Offset     uint64   `json:"offset"`
	Limit      uint64   `json:"limit"`
	OnlyTotal  bool     `json:"only_total"`
	Name       string   `json:"name,omitempty"`
	ID         string   `json:"id,omitempty"`
	Dir        string   `json:"dir,omitempty"`
	Order      string   `json:"order,omitempty"`
	Path       string   `json:"path,omitempty"`
	DomainID   string   `json:"domain_id,omitempty"`
	Tag        string   `json:"tag,omitempty"`
	Metadata   Metadata `json:"metadata,omitempty"`
	Status     Status   `json:"status,omitempty"`
	RoleName   string   `json:"role_name,omitempty"`
	RoleID     string   `json:"role_id,omitempty"`
	Actions    []string `json:"actions,omitempty"`
	AccessType string   `json:"access_type,omitempty"`
	RootGroup  bool     `json:"root_group,omitempty"`
}

PageMeta contains page metadata that helps navigation.

type Repository

type Repository interface {
	// Save group.
	Save(ctx context.Context, g Group) (Group, error)

	// Update a group.
	Update(ctx context.Context, g Group) (Group, error)

	// Update a group's tags.
	UpdateTags(ctx context.Context, g Group) (Group, error)

	// RetrieveByID retrieves group by its id.
	RetrieveByID(ctx context.Context, id string) (Group, error)

	RetrieveByIDAndUser(ctx context.Context, domainID, userID, groupID string) (Group, error)

	RetrieveByIDWithRoles(ctx context.Context, groupID, memberID string) (Group, error)

	// RetrieveAll retrieves all groups.
	RetrieveAll(ctx context.Context, pm PageMeta) (Page, error)

	// RetrieveByIDs retrieves group by ids and query.
	RetrieveByIDs(ctx context.Context, pm PageMeta, ids ...string) (Page, error)

	RetrieveHierarchy(ctx context.Context, domainID, userID, groupID string, hm HierarchyPageMeta) (HierarchyPage, error)

	// ChangeStatus changes groups status to active or inactive
	ChangeStatus(ctx context.Context, group Group) (Group, error)

	// AssignParentGroup assigns parent group id to a given group id
	AssignParentGroup(ctx context.Context, parentGroupID string, groupIDs ...string) error

	// UnassignParentGroup unassign parent group id fr given group id
	UnassignParentGroup(ctx context.Context, parentGroupID string, groupIDs ...string) error

	UnassignAllChildrenGroups(ctx context.Context, id string) error

	RetrieveUserGroups(ctx context.Context, domainID, userID string, pm PageMeta) (Page, error)

	// RetrieveChildrenGroups at given level in ltree
	// Condition: startLevel == 0 and endLevel < 0, Retrieve all children groups from parent group level, Example: If we pass startLevel 0 and endLevel -1, then function will return all children of parent group
	// Condition: startLevel > 0 and endLevel == 0, Retrieve specific level of children groups from parent group level, Example: If we pass startLevel 1 and endLevel 0, then function will return children of parent group from level 1
	// Condition: startLevel > 0 and endLevel < 0,  Retrieve all children groups from specific level from parent group level, Example: If we pass startLevel 2 and endLevel -1, then function will return all children of parent group from level 2
	// Condition: startLevel > 0 and endLevel > 0, Retrieve children groups between specific level from parent group level, Example: If we pass startLevel 3 and endLevel 5, then function will return all children of parent group between level 3 and 5
	RetrieveChildrenGroups(ctx context.Context, domainID, userID, groupID string, startLevel, endLevel int64, pm PageMeta) (Page, error)

	RetrieveAllParentGroups(ctx context.Context, domainID, userID, groupID string, pm PageMeta) (Page, error)
	// Delete a group
	Delete(ctx context.Context, groupID string) error

	roles.Repository
}

Repository specifies a group persistence API.

type Service

type Service interface {
	// CreateGroup creates new  group.
	CreateGroup(ctx context.Context, session authn.Session, g Group) (Group, []roles.RoleProvision, error)

	// UpdateGroup updates the group identified by the provided ID.
	UpdateGroup(ctx context.Context, session authn.Session, g Group) (Group, error)

	// UpdateGroupTags updates the groups's tags.
	UpdateGroupTags(ctx context.Context, session authn.Session, group Group) (Group, error)

	// ViewGroup retrieves data about the group identified by ID.
	ViewGroup(ctx context.Context, session authn.Session, id string, withRoles bool) (Group, error)

	// ListGroups retrieves groups for given filters.
	ListGroups(ctx context.Context, session authn.Session, pm PageMeta) (Page, error)

	// ListGroups retrieves user accessible groups for given filters.
	ListUserGroups(ctx context.Context, session authn.Session, userID string, pm PageMeta) (Page, error)

	// EnableGroup logically enables the group identified with the provided ID.
	EnableGroup(ctx context.Context, session authn.Session, id string) (Group, error)

	// DisableGroup logically disables the group identified with the provided ID.
	DisableGroup(ctx context.Context, session authn.Session, id string) (Group, error)

	// DeleteGroup delete the given group id
	DeleteGroup(ctx context.Context, session authn.Session, id string) error

	RetrieveGroupHierarchy(ctx context.Context, session authn.Session, id string, hm HierarchyPageMeta) (HierarchyPage, error)

	AddParentGroup(ctx context.Context, session authn.Session, id, parentID string) error

	RemoveParentGroup(ctx context.Context, session authn.Session, id string) error

	AddChildrenGroups(ctx context.Context, session authn.Session, id string, childrenGroupIDs []string) error

	RemoveChildrenGroups(ctx context.Context, session authn.Session, id string, childrenGroupIDs []string) error

	RemoveAllChildrenGroups(ctx context.Context, session authn.Session, id string) error

	ListChildrenGroups(ctx context.Context, session authn.Session, id string, startLevel, endLevel int64, pm PageMeta) (Page, error)

	roles.RoleManager
}

func NewService

func NewService(repo Repository, policy policies.Service, idp supermq.IDProvider, channels grpcChannelsV1.ChannelsServiceClient, clients grpcClientsV1.ClientsServiceClient, sidProvider supermq.IDProvider, availableActions []roles.Action, builtInRoles map[roles.BuiltInRoleName][]roles.Action) (Service, error)

NewService returns a new groups service implementation.

type Status

type Status uint8

Status represents Group status.

const (
	// EnabledStatus represents enabled Group.
	EnabledStatus Status = iota
	// DisabledStatus represents disabled Group.
	DisabledStatus
	// DeletedStatus represents deleted Group.
	DeletedStatus

	// AllStatus is used for querying purposes to list groups irrespective
	// of their status - both active and inactive. It is never stored in the
	// database as the actual Group status and should always be the largest
	// value in this enumeration.
	AllStatus
)

Possible Group status values.

func ToStatus

func ToStatus(status string) (Status, error)

ToStatus converts string value to a valid Group status.

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

Custom Marshaller for Status.

func (Status) String

func (s Status) String() string

String converts group status to string literal.

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(data []byte) error

Custom Unmarshaler for Status.

Directories

Path Synopsis
api
grpc
Package grpc contains implementation of Auth service gRPC API.
Package grpc contains implementation of Auth service gRPC API.
http
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
Package events contains event source Redis client implementation.
Package events contains event source Redis client implementation.
Package middleware provides authorization, logging, metrics and tracing middleware for SuperMQ Domains service.
Package middleware provides authorization, logging, metrics and tracing middleware for SuperMQ Domains service.
Package mocks contains mocks for testing purposes.
Package mocks contains mocks for testing purposes.
Package postgres contains the database implementation of groups repository layer.
Package postgres contains the database implementation of groups repository layer.

Jump to

Keyboard shortcuts

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