organization

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

README

Organization Plugin

The Organization plugin provides Clerk.js-style user-created organizations (workspaces) for AuthSome. It allows authenticated users to create their own organizations, invite members, manage teams, and control access through role-based permissions.

Features

  • User-Created Organizations: Any authenticated user can create their own organization
  • Member Management: Invite users, manage roles (owner, admin, member)
  • Team Management: Create teams within organizations for better structure
  • Role-Based Access Control: Owner, Admin, and Member roles with appropriate permissions
  • Invitation System: Secure token-based invitations with expiry
  • Multi-Organization Support: Users can belong to multiple organizations
  • Slug-Based Access: Access organizations via unique slugs

Architecture

This plugin is separate from the platform-level App (formerly Organization in multitenancy plugin). The hierarchy is:

Platform App (managed by multitenancy plugin)
└── User Organizations (managed by this plugin)
    ├── Members (users with roles)
    └── Teams (groups of members)

Models

Organization

User-created workspace/organization that belongs to a platform App.

type Organization struct {
    ID        xid.ID
    AppID     xid.ID  // Platform app this org belongs to
    Name      string
    Slug      string  // Unique slug for URL access
    Logo      *string
    Metadata  map[string]interface{}
    CreatedBy xid.ID  // User who created it
    // ... timestamps
}
OrganizationMember

Represents a user's membership in an organization.

type OrganizationMember struct {
    ID             xid.ID
    OrganizationID xid.ID
    UserID         xid.ID
    Role           string  // owner, admin, member
    Status         string  // active, suspended, pending
    // ... timestamps
}
OrganizationTeam

Teams within an organization for better member organization.

type OrganizationTeam struct {
    ID             xid.ID
    OrganizationID xid.ID
    Name           string
    Description    *string
    Metadata       map[string]interface{}
    // ... timestamps
}
OrganizationInvitation

Invitation to join an organization.

type OrganizationInvitation struct {
    ID             xid.ID
    OrganizationID xid.ID
    Email          string
    Role           string
    Token          string  // Secure invitation token
    Status         string  // pending, accepted, declined, expired
    InvitedBy      xid.ID
    ExpiresAt      time.Time
    // ... timestamps
}

Roles

Owner
  • Full control over the organization
  • Can delete the organization
  • Can manage all members and teams
  • Cannot be removed or have role changed
  • Assigned to creator automatically
Admin
  • Can invite and manage members
  • Can create and manage teams
  • Can update organization settings
  • Cannot delete organization
Member
  • Can view organization
  • Can view members and teams
  • Limited modification rights

API Endpoints

Organization Management
POST   /api/organizations                          # Create organization
GET    /api/organizations                          # List user's organizations
GET    /api/organizations/:id                      # Get organization details
GET    /api/organizations/slug/:slug               # Get organization by slug
PATCH  /api/organizations/:id                      # Update organization
DELETE /api/organizations/:id                      # Delete organization (owner only)
Member Management
GET    /api/organizations/:id/members              # List members
POST   /api/organizations/:id/members/invite       # Invite member
PATCH  /api/organizations/:id/members/:memberId   # Update member role
DELETE /api/organizations/:id/members/:memberId   # Remove member
Team Management
GET    /api/organizations/:id/teams                # List teams
POST   /api/organizations/:id/teams                # Create team
PATCH  /api/organizations/:id/teams/:teamId       # Update team
DELETE /api/organizations/:id/teams/:teamId       # Delete team
Invitations
POST   /api/organization-invitations/:token/accept    # Accept invitation
POST   /api/organization-invitations/:token/decline   # Decline invitation

Configuration

auth:
  organization:
    maxOrganizationsPerUser: 5       # Max orgs a user can create
    maxMembersPerOrganization: 50    # Max members per org
    maxTeamsPerOrganization: 20      # Max teams per org
    enableUserCreation: true         # Allow users to create orgs
    requireInvitation: true          # Require invitation to join
    invitationExpiryHours: 72        # Invitation validity (3 days)

Usage

Installation
import (
    "github.com/xraph/authsome"
    "github.com/xraph/authsome/plugins/organization"
)

auth := authsome.New(
    // ... other options
    authsome.WithPlugins(
        organization.NewPlugin(
            organization.WithMaxOrganizationsPerUser(10),
            organization.WithMaxMembersPerOrganization(100),
            organization.WithEnableUserCreation(true),
        ),
    ),
)
Creating an Organization
POST /api/organizations
Content-Type: application/json

{
  "name": "Acme Corporation",
  "slug": "acme",
  "logo": "https://example.com/logo.png",
  "metadata": {
    "industry": "Technology"
  }
}
Inviting a Member
POST /api/organizations/:orgId/members/invite
Content-Type: application/json

{
  "email": "user@example.com",
  "role": "member"
}
Accepting an Invitation
POST /api/organization-invitations/:token/accept

Permissions

Action Owner Admin Member
View organization
Update organization
Delete organization
Invite members
Remove members
Update member roles
Create teams
Manage teams

Integration with Other Plugins

SCIM Plugin

The SCIM plugin will be updated to provision users into organizations:

/scim/v2/organizations/:orgId/Users
/scim/v2/organizations/:orgId/Groups
Subscription Plugin (Future)

Organizations can be linked to subscriptions for billing:

type OrganizationSubscription struct {
    OrganizationID xid.ID
    PlanID         string
    Status         string
    // ...
}

Database Tables

  • user_organizations - Organization entities
  • user_organization_members - Member relationships
  • user_organization_teams - Team entities
  • user_organization_team_members - Team-member relationships (many-to-many)
  • user_organization_invitations - Invitation tokens

Differences from Platform Apps

Feature Platform App (Multitenancy) User Organization
Created by Platform admin Any authenticated user
Scope Platform-wide tenant User workspace
Members All platform users Invited users only
SCIM Platform-level provisioning Org-scoped provisioning
Billing Platform subscription Per-org subscription

TODO

  • Implement repository layer
  • Add middleware for organization context
  • Integrate with user service for user ID extraction
  • Add organization switcher API
  • Add organization statistics/metrics
  • Add audit log for organization actions
  • Add webhooks for organization events
  • Add organization settings/preferences

License

Same as AuthSome project.

Documentation

Index

Constants

View Source
const (
	RoleOwner  = organization.RoleOwner
	RoleAdmin  = organization.RoleAdmin
	RoleMember = organization.RoleMember
)

Organization member roles

View Source
const (
	StatusActive    = organization.StatusActive
	StatusSuspended = organization.StatusSuspended
	StatusPending   = organization.StatusPending
)

Organization member statuses

View Source
const (
	InvitationStatusPending   = organization.InvitationStatusPending
	InvitationStatusAccepted  = organization.InvitationStatusAccepted
	InvitationStatusExpired   = organization.InvitationStatusExpired
	InvitationStatusCancelled = organization.InvitationStatusCancelled
	InvitationStatusDeclined  = organization.InvitationStatusDeclined
)

Organization invitation statuses

Variables

View Source
var (
	ErrOrganizationNotFound    = organization.ErrOrganizationNotFound
	ErrMemberNotFound          = organization.ErrMemberNotFound
	ErrTeamNotFound            = organization.ErrTeamNotFound
	ErrInvalidRole             = organization.ErrInvalidRole
	ErrInvalidStatus           = organization.ErrInvalidStatus
	ErrOrganizationSlugExists  = organization.ErrOrganizationSlugExists
	ErrMemberAlreadyExists     = organization.ErrMemberAlreadyExists
	ErrNotOwner                = organization.ErrNotOwner
	ErrNotAdmin                = organization.ErrNotAdmin
	ErrCannotRemoveOwner       = organization.ErrCannotRemoveOwner
	ErrMaxOrganizationsReached = organization.ErrMaxOrganizationsReached
)

Errors for organization plugin operations

Functions

func NewService

func NewService(
	orgRepo Repository,
	memberRepo MemberRepository,
	teamRepo TeamRepository,
	inviteRepo InvitationRepository,
	config Config,
	rbacSvc *rbac.Service,
) *organization.Service

NewService creates a new organization service

Types

type Config

type Config = organization.Config

Config holds the organization service configuration

type CreateOrganizationRequest

type CreateOrganizationRequest = organization.CreateOrganizationRequest

CreateOrganizationRequest represents the request to create an organization

type CreateTeamRequest

type CreateTeamRequest = organization.CreateTeamRequest

CreateTeamRequest represents the request to create a team

type DashboardExtension

type DashboardExtension struct {
	// contains filtered or unexported fields
}

DashboardExtension implements the ui.DashboardExtension interface This allows the organization plugin to add its own screens to the dashboard

func NewDashboardExtension

func NewDashboardExtension(plugin *Plugin) *DashboardExtension

NewDashboardExtension creates a new dashboard extension for organization

func (*DashboardExtension) AddCustomPermission

func (e *DashboardExtension) AddCustomPermission(c forge.Context) error

AddCustomPermission handles creating custom permissions inline

func (*DashboardExtension) CancelInvitation

func (e *DashboardExtension) CancelInvitation(c forge.Context) error

CancelInvitation handles invitation cancellation

func (*DashboardExtension) CreateOrganization

func (e *DashboardExtension) CreateOrganization(c forge.Context) error

CreateOrganization handles organization creation

func (*DashboardExtension) CreateRoleTemplate

func (e *DashboardExtension) CreateRoleTemplate(c forge.Context) error

CreateRoleTemplate handles role template creation

func (*DashboardExtension) CreateTeam

func (e *DashboardExtension) CreateTeam(c forge.Context) error

CreateTeam handles team creation

func (*DashboardExtension) DashboardWidgets

func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget

DashboardWidgets returns widgets to show on the main dashboard

func (*DashboardExtension) DeleteOrganization

func (e *DashboardExtension) DeleteOrganization(c forge.Context) error

DeleteOrganization handles organization deletion

func (*DashboardExtension) DeleteRoleTemplate

func (e *DashboardExtension) DeleteRoleTemplate(c forge.Context) error

DeleteRoleTemplate handles role template deletion

func (*DashboardExtension) DeleteTeam

func (e *DashboardExtension) DeleteTeam(c forge.Context) error

DeleteTeam handles team deletion

func (*DashboardExtension) ExtensionID

func (e *DashboardExtension) ExtensionID() string

ExtensionID returns the unique identifier for this extension

func (*DashboardExtension) InviteMember

func (e *DashboardExtension) InviteMember(c forge.Context) error

InviteMember handles member invitation

func (*DashboardExtension) NavigationItems

func (e *DashboardExtension) NavigationItems() []ui.NavigationItem

NavigationItems returns navigation items to register

func (*DashboardExtension) RemoveMember

func (e *DashboardExtension) RemoveMember(c forge.Context) error

RemoveMember handles member removal

func (*DashboardExtension) RenderDashboardWidget

func (e *DashboardExtension) RenderDashboardWidget(basePath string, currentApp *app.App) g.Node

Dashboard widget rendering

func (*DashboardExtension) RenderSettingsSection

func (e *DashboardExtension) RenderSettingsSection(basePath string, currentApp *app.App) g.Node

Settings rendering

func (*DashboardExtension) Routes

func (e *DashboardExtension) Routes() []ui.Route

Routes returns routes to register under /dashboard/app/:appId/

func (*DashboardExtension) SavePluginSettings

func (e *DashboardExtension) SavePluginSettings(c forge.Context) error

SavePluginSettings handles plugin settings updates

func (*DashboardExtension) ServeCreateOrganizationPage

func (e *DashboardExtension) ServeCreateOrganizationPage(c forge.Context) error

ServeCreateOrganizationPage renders the create organization page

func (*DashboardExtension) ServeCreateRoleTemplate

func (e *DashboardExtension) ServeCreateRoleTemplate(c forge.Context) error

ServeCreateRoleTemplate renders the create role template form

func (*DashboardExtension) ServeEditRoleTemplate

func (e *DashboardExtension) ServeEditRoleTemplate(c forge.Context) error

ServeEditRoleTemplate renders the edit role template form

func (*DashboardExtension) ServeOrganizationDetailPage

func (e *DashboardExtension) ServeOrganizationDetailPage(c forge.Context) error

ServeOrganizationDetailPage renders the organization detail page

func (*DashboardExtension) ServeOrganizationInvitationsPage

func (e *DashboardExtension) ServeOrganizationInvitationsPage(c forge.Context) error

ServeOrganizationInvitationsPage renders the invitations page

func (*DashboardExtension) ServeOrganizationMembersPage

func (e *DashboardExtension) ServeOrganizationMembersPage(c forge.Context) error

ServeOrganizationMembersPage renders the members management page

func (*DashboardExtension) ServeOrganizationSettings

func (e *DashboardExtension) ServeOrganizationSettings(c forge.Context) error

ServeOrganizationSettings renders the organization settings page

func (*DashboardExtension) ServeOrganizationTeamsPage

func (e *DashboardExtension) ServeOrganizationTeamsPage(c forge.Context) error

ServeOrganizationTeamsPage renders the teams management page

func (*DashboardExtension) ServeOrganizationsListPage

func (e *DashboardExtension) ServeOrganizationsListPage(c forge.Context) error

ServeOrganizationsListPage renders the organizations list page

func (*DashboardExtension) ServeRoleTemplatesSettings

func (e *DashboardExtension) ServeRoleTemplatesSettings(c forge.Context) error

ServeRoleTemplatesSettings renders the role templates settings page

func (*DashboardExtension) SetRegistry

func (e *DashboardExtension) SetRegistry(registry *dashboard.ExtensionRegistry)

SetRegistry sets the extension registry reference (called by dashboard after registration)

func (*DashboardExtension) SettingsPages

func (e *DashboardExtension) SettingsPages() []ui.SettingsPage

SettingsPages returns full settings pages for the new sidebar layout

func (*DashboardExtension) SettingsSections

func (e *DashboardExtension) SettingsSections() []ui.SettingsSection

SettingsSections returns settings sections to add to the settings page Deprecated: Use SettingsPages() instead

func (*DashboardExtension) UpdateMemberRole

func (e *DashboardExtension) UpdateMemberRole(c forge.Context) error

UpdateMemberRole handles member role updates

func (*DashboardExtension) UpdateOrganization

func (e *DashboardExtension) UpdateOrganization(c forge.Context) error

UpdateOrganization handles organization updates

func (*DashboardExtension) UpdateRoleTemplate

func (e *DashboardExtension) UpdateRoleTemplate(c forge.Context) error

UpdateRoleTemplate handles role template updates

func (*DashboardExtension) UpdateTeam

func (e *DashboardExtension) UpdateTeam(c forge.Context) error

UpdateTeam handles team updates

type ErrorResponse

type ErrorResponse = responses.ErrorResponse

DTOs for organization routes - use shared responses from core

type InvitationRepository

type InvitationRepository = organization.InvitationRepository

InvitationRepository type alias

type InvitationResponse

type InvitationResponse struct {
	Invitation *organization.Invitation `json:"invitation"`
	Message    string                   `json:"message,omitempty"`
}

type InviteMemberRequest

type InviteMemberRequest = organization.InviteMemberRequest

InviteMemberRequest represents the request to invite a member

type MemberRepository

type MemberRepository = organization.MemberRepository

MemberRepository type alias

type MembersListResponse

type MembersListResponse []schema.OrganizationMember

MembersListResponse represents a list of members

type MembersResponse

type MembersResponse struct {
	Members []*organization.Member `json:"members"`
	Total   int                    `json:"total,omitempty"`
}

type MessageResponse

type MessageResponse = responses.MessageResponse

Response types Use shared response type

type MockService

type MockService struct {

	// Error injection for testing
	CreateOrgError        error
	FindOrgError          error
	AddMemberError        error
	InviteMemberError     error
	AcceptInvitationError error
	// contains filtered or unexported fields
}

MockService provides a mock implementation of organization.Service for testing

func NewMockService

func NewMockService() *MockService

NewMockService creates a new mock organization service

func (*MockService) AcceptInvitation

func (m *MockService) AcceptInvitation(ctx context.Context, token string, userID xid.ID) (*organization.Member, error)

func (*MockService) AddMember

func (m *MockService) AddMember(ctx context.Context, orgID, userID xid.ID, role string) (*organization.Member, error)

AddMember mocks adding a member

func (*MockService) AddTeamMember

func (m *MockService) AddTeamMember(ctx context.Context, teamID, memberID, adderUserID xid.ID) error

func (*MockService) CancelInvitation

func (m *MockService) CancelInvitation(ctx context.Context, id, cancellerUserID xid.ID) error

func (*MockService) CleanupExpiredInvitations

func (m *MockService) CleanupExpiredInvitations(ctx context.Context) (int, error)

func (*MockService) CreateOrganization

func (m *MockService) CreateOrganization(ctx context.Context, req *organization.CreateOrganizationRequest, creatorUserID, appID, environmentID xid.ID) (*organization.Organization, error)

CreateOrganization mocks creating an organization

func (*MockService) CreateTeam

func (m *MockService) CreateTeam(ctx context.Context, orgID xid.ID, req *organization.CreateTeamRequest, creatorUserID xid.ID) (*organization.Team, error)

func (*MockService) DeclineInvitation

func (m *MockService) DeclineInvitation(ctx context.Context, token string) error

func (*MockService) DeleteOrganization

func (m *MockService) DeleteOrganization(ctx context.Context, id, userID xid.ID) error

DeleteOrganization mocks deleting an organization

func (*MockService) DeleteTeam

func (m *MockService) DeleteTeam(ctx context.Context, id, deleterUserID xid.ID) error

func (*MockService) FindInvitationByID

func (m *MockService) FindInvitationByID(ctx context.Context, id xid.ID) (*organization.Invitation, error)

func (*MockService) FindInvitationByToken

func (m *MockService) FindInvitationByToken(ctx context.Context, token string) (*organization.Invitation, error)

func (*MockService) FindMember

func (m *MockService) FindMember(ctx context.Context, orgID, userID xid.ID) (*organization.Member, error)

FindMember mocks finding a member by org and user ID

func (*MockService) FindMemberByID

func (m *MockService) FindMemberByID(ctx context.Context, id xid.ID) (*organization.Member, error)

FindMemberByID mocks finding a member by ID

func (*MockService) FindOrganizationByID

func (m *MockService) FindOrganizationByID(ctx context.Context, id xid.ID) (*organization.Organization, error)

FindOrganizationByID mocks finding an organization by ID

func (*MockService) FindOrganizationBySlug

func (m *MockService) FindOrganizationBySlug(ctx context.Context, appID, environmentID xid.ID, slug string) (*organization.Organization, error)

FindOrganizationBySlug mocks finding an organization by slug

func (*MockService) FindTeamByID

func (m *MockService) FindTeamByID(ctx context.Context, id xid.ID) (*organization.Team, error)

func (*MockService) FindTeamByName

func (m *MockService) FindTeamByName(ctx context.Context, orgID xid.ID, name string) (*organization.Team, error)

func (*MockService) GetUserMemberships

func (m *MockService) GetUserMemberships(ctx context.Context, userID xid.ID, filter *pagination.PaginationParams) (*pagination.PageResponse[*organization.Member], error)

GetUserMemberships mocks getting user memberships

func (*MockService) InviteMember

func (m *MockService) InviteMember(ctx context.Context, orgID xid.ID, req *organization.InviteMemberRequest, inviterUserID xid.ID) (*organization.Invitation, error)

func (*MockService) IsAdmin

func (m *MockService) IsAdmin(ctx context.Context, orgID, userID xid.ID) (bool, error)

IsAdmin mocks checking admin status

func (*MockService) IsMember

func (m *MockService) IsMember(ctx context.Context, orgID, userID xid.ID) (bool, error)

IsMember mocks checking membership

func (*MockService) IsOwner

func (m *MockService) IsOwner(ctx context.Context, orgID, userID xid.ID) (bool, error)

IsOwner mocks checking ownership

func (*MockService) IsTeamMember

func (m *MockService) IsTeamMember(ctx context.Context, teamID, memberID xid.ID) (bool, error)

func (*MockService) ListMembers

ListMembers mocks listing members

func (*MockService) ListOrganizations

ListOrganizations mocks listing organizations

func (*MockService) ListTeams

func (*MockService) ListUserOrganizations

func (m *MockService) ListUserOrganizations(ctx context.Context, userID xid.ID, filter *pagination.PaginationParams) (*pagination.PageResponse[*organization.Organization], error)

ListUserOrganizations mocks listing user organizations

func (*MockService) RemoveMember

func (m *MockService) RemoveMember(ctx context.Context, id, removerUserID xid.ID) error

RemoveMember mocks removing a member

func (*MockService) RemoveTeamMember

func (m *MockService) RemoveTeamMember(ctx context.Context, teamID, memberID, removerUserID xid.ID) error

func (*MockService) RemoveUserFromAllOrganizations

func (m *MockService) RemoveUserFromAllOrganizations(ctx context.Context, userID xid.ID) error

RemoveUserFromAllOrganizations mocks removing user from all orgs

func (*MockService) RequireAdmin

func (m *MockService) RequireAdmin(ctx context.Context, orgID, userID xid.ID) error

RequireAdmin mocks requiring admin status

func (*MockService) RequireOwner

func (m *MockService) RequireOwner(ctx context.Context, orgID, userID xid.ID) error

RequireOwner mocks requiring owner status

func (*MockService) ResendInvitation

func (m *MockService) ResendInvitation(ctx context.Context, id, resenderUserID xid.ID) (*organization.Invitation, error)

func (*MockService) UpdateMember

func (m *MockService) UpdateMember(ctx context.Context, id xid.ID, req *organization.UpdateMemberRequest, updaterUserID xid.ID) (*organization.Member, error)

UpdateMember mocks updating a member

func (*MockService) UpdateOrganization

UpdateOrganization mocks updating an organization

func (*MockService) UpdateTeam

func (m *MockService) UpdateTeam(ctx context.Context, id xid.ID, req *organization.UpdateTeamRequest, updaterUserID xid.ID) (*organization.Team, error)

type OrganizationHandler

type OrganizationHandler struct {
	// contains filtered or unexported fields
}

OrganizationHandler handles organization-related HTTP requests

func NewOrganizationHandler

func NewOrganizationHandler(orgService *organization.Service) *OrganizationHandler

NewOrganizationHandler creates a new organization handler

func (*OrganizationHandler) AcceptInvitation

func (h *OrganizationHandler) AcceptInvitation(c forge.Context) error

AcceptInvitation handles invitation acceptance requests

func (*OrganizationHandler) CreateOrganization

func (h *OrganizationHandler) CreateOrganization(c forge.Context) error

CreateOrganization handles organization creation requests

func (*OrganizationHandler) CreateTeam

func (h *OrganizationHandler) CreateTeam(c forge.Context) error

CreateTeam handles team creation requests

func (*OrganizationHandler) DeclineInvitation

func (h *OrganizationHandler) DeclineInvitation(c forge.Context) error

DeclineInvitation handles invitation decline requests

func (*OrganizationHandler) DeleteOrganization

func (h *OrganizationHandler) DeleteOrganization(c forge.Context) error

DeleteOrganization handles organization deletion requests

func (*OrganizationHandler) DeleteTeam

func (h *OrganizationHandler) DeleteTeam(c forge.Context) error

DeleteTeam handles team deletion requests

func (*OrganizationHandler) GetOrganization

func (h *OrganizationHandler) GetOrganization(c forge.Context) error

GetOrganization handles get organization requests

func (*OrganizationHandler) GetOrganizationBySlug

func (h *OrganizationHandler) GetOrganizationBySlug(c forge.Context) error

GetOrganizationBySlug handles get organization by slug requests

func (*OrganizationHandler) InviteMember

func (h *OrganizationHandler) InviteMember(c forge.Context) error

InviteMember handles member invitation requests

func (*OrganizationHandler) ListMembers

func (h *OrganizationHandler) ListMembers(c forge.Context) error

ListMembers handles list organization members requests

func (*OrganizationHandler) ListOrganizations

func (h *OrganizationHandler) ListOrganizations(c forge.Context) error

ListOrganizations handles list organizations requests (user's organizations)

func (*OrganizationHandler) ListTeams

func (h *OrganizationHandler) ListTeams(c forge.Context) error

ListTeams handles list teams requests

func (*OrganizationHandler) RemoveMember

func (h *OrganizationHandler) RemoveMember(c forge.Context) error

RemoveMember handles member removal requests

func (*OrganizationHandler) UpdateMember

func (h *OrganizationHandler) UpdateMember(c forge.Context) error

UpdateMember handles member update requests

func (*OrganizationHandler) UpdateOrganization

func (h *OrganizationHandler) UpdateOrganization(c forge.Context) error

UpdateOrganization handles organization update requests

func (*OrganizationHandler) UpdateTeam

func (h *OrganizationHandler) UpdateTeam(c forge.Context) error

UpdateTeam handles team update requests

type OrganizationsListResponse

type OrganizationsListResponse []schema.Organization

OrganizationsListResponse represents a list of organizations

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements the user-created organizations plugin

func NewPlugin

func NewPlugin(opts ...PluginOption) *Plugin

NewPlugin creates a new organization plugin instance with optional configuration

func (*Plugin) DashboardExtension

func (p *Plugin) DashboardExtension() ui.DashboardExtension

DashboardExtension returns the dashboard extension interface implementation

func (*Plugin) ID

func (p *Plugin) ID() string

ID returns the plugin identifier

func (*Plugin) Init

func (p *Plugin) Init(authInstance core.Authsome) error

Init initializes the plugin with dependencies

func (*Plugin) Migrate

func (p *Plugin) Migrate() error

Migrate runs the plugin's database migrations

func (*Plugin) RegisterHooks

func (p *Plugin) RegisterHooks(hooks *hooks.HookRegistry) error

RegisterHooks registers the plugin's hooks

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(router forge.Router) error

RegisterRoutes registers the plugin's HTTP routes

func (*Plugin) RegisterServiceDecorators

func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error

RegisterServiceDecorators registers service decorators

type PluginOption

type PluginOption func(*Plugin)

PluginOption is a functional option for configuring the plugin

func WithDefaultConfig

func WithDefaultConfig(cfg Config) PluginOption

WithDefaultConfig sets the default configuration for the plugin

func WithEnableUserCreation

func WithEnableUserCreation(enabled bool) PluginOption

WithEnableUserCreation sets whether user creation is enabled

func WithInvitationExpiryHours

func WithInvitationExpiryHours(hours int) PluginOption

WithInvitationExpiryHours sets the invitation expiry hours

func WithMaxMembersPerOrganization

func WithMaxMembersPerOrganization(max int) PluginOption

WithMaxMembersPerOrganization sets the maximum members per organization

func WithMaxOrganizationsPerUser

func WithMaxOrganizationsPerUser(max int) PluginOption

WithMaxOrganizationsPerUser sets the maximum organizations per user

func WithMaxTeamsPerOrganization

func WithMaxTeamsPerOrganization(max int) PluginOption

WithMaxTeamsPerOrganization sets the maximum teams per organization

func WithRequireInvitation

func WithRequireInvitation(required bool) PluginOption

WithRequireInvitation sets whether invitation is required

type Repository

Repository type aliases for core organization repositories

type Service

type Service = organization.Service

Service wraps the core organization service

type StatusResponse

type StatusResponse = responses.StatusResponse

type TeamRepository

type TeamRepository = organization.TeamRepository

TeamRepository type alias

type TeamsListResponse

type TeamsListResponse []schema.OrganizationTeam

TeamsListResponse represents a list of teams

type TeamsResponse

type TeamsResponse struct {
	Teams []*organization.Team `json:"teams"`
	Total int                  `json:"total,omitempty"`
}

type UpdateMemberRequest

type UpdateMemberRequest = organization.UpdateMemberRequest

UpdateMemberRequest represents the request to update a member

type UpdateOrganizationRequest

type UpdateOrganizationRequest = organization.UpdateOrganizationRequest

UpdateOrganizationRequest represents the request to update an organization

type UpdateTeamRequest

type UpdateTeamRequest = organization.UpdateTeamRequest

UpdateTeamRequest represents the request to update a team

Jump to

Keyboard shortcuts

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