domain

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service manages domain lifecycle operations.

func NewService

func NewService(client *ent.Client, logger logging.Logger) *Service

NewService creates a new Domain service.

func (*Service) AddMembership

func (s *Service) AddMembership(ctx context.Context, domainID, subjectID uuid.UUID, memberRole string, isDefault bool) error

AddMembership creates a domain membership record.

func (*Service) CheckMembership

func (s *Service) CheckMembership(ctx context.Context, domainID, subjectID uuid.UUID) (bool, error)

CheckMembership returns true if subject belongs to the given domain.

func (*Service) EnsureDomain

func (s *Service) EnsureDomain(ctx context.Context, typeCode, key, displayName string) (*core.ResolvedDomain, error)

EnsureDomain creates or returns a domain by type_code + key. Returns *core.ResolvedDomain to satisfy core.DomainWriter interface.

func (*Service) EnsureDomainType

func (s *Service) EnsureDomainType(ctx context.Context, code, displayName string) (*ent.DomainType, error)

EnsureDomainType creates or updates a domain type by code.

func (*Service) GetDomainString

func (s *Service) GetDomainString(typeCode, key string) string

GetDomainString returns the Casbin-compatible domain string "<type_code>:<key>".

func (*Service) GetUserDefaultDomain

func (s *Service) GetUserDefaultDomain(ctx context.Context, userID uuid.UUID) (*core.ResolvedDomain, error)

GetUserDefaultDomain returns the user's default domain.

func (*Service) ListUserDomains

func (s *Service) ListUserDomains(ctx context.Context, userID uuid.UUID) ([]*core.UserDomainInfo, error)

ListUserDomains returns all active domains the user is a member of.

func (*Service) RemoveMembership

func (s *Service) RemoveMembership(ctx context.Context, domainID, subjectID uuid.UUID) error

RemoveMembership soft-deletes a domain membership record.

func (*Service) ResolveDomain

func (s *Service) ResolveDomain(ctx context.Context, typeCode, key string) (*core.ResolvedDomain, error)

ResolveDomain looks up a domain by type_code + key and returns a ResolvedDomain.

func (*Service) ResolveDomainByID

func (s *Service) ResolveDomainByID(ctx context.Context, domainID uuid.UUID) (*core.ResolvedDomain, error)

ResolveDomainByID looks up a domain by its UUID.

Jump to

Keyboard shortcuts

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