Expand description
Group management service.
Provides business logic for group operations within an organization. Groups enable team collaboration through shared memory graphs.
§Features
- Group Management: Create, list, and delete groups
- Member Management: Add/remove members with role-based permissions
- Invite System: Token-based invites with expiration and usage limits
§Permissions
| Operation | Required Role |
|---|---|
| Create group | Org member |
| Delete group | Group admin |
| Add member | Group admin |
| Remove member | Group admin (cannot remove last admin) |
| Update role | Group admin (cannot demote last admin) |
| Create invite | Group admin |
| List members | Group member |
| Join via invite | Anyone with valid token |
| Leave group | Self (cannot leave if last admin) |
§Example
ⓘ
use subcog::services::GroupService;
use subcog::storage::GroupStorageFactory;
let backend = GroupStorageFactory::create_in_memory()?;
let service = GroupService::new(backend);
// Create a group
let group = service.create_group("my-org", "engineering", "Engineering team", "alice@example.com")?;
// Add a member
service.add_member(&group.id, "bob@example.com", GroupRole::Write, "alice@example.com")?;
// Create an invite
let (invite, token) = service.create_invite(&group.id, GroupRole::Read, "alice@example.com", None, None)?;
println!("Share this invite: {token}");Structs§
- Group
Service - Service for group management operations.