Documentation
¶
Index ¶
- type Service
- func (s *Service) AddMembership(ctx context.Context, domainID, subjectID uuid.UUID, memberRole string, ...) error
- func (s *Service) CheckMembership(ctx context.Context, domainID, subjectID uuid.UUID) (bool, error)
- func (s *Service) EnsureDomain(ctx context.Context, typeCode, key, displayName string) (*core.ResolvedDomain, error)
- func (s *Service) EnsureDomainType(ctx context.Context, code, displayName string) (*ent.DomainType, error)
- func (s *Service) GetDomainString(typeCode, key string) string
- func (s *Service) GetUserDefaultDomain(ctx context.Context, userID uuid.UUID) (*core.ResolvedDomain, error)
- func (s *Service) ListUserDomains(ctx context.Context, userID uuid.UUID) ([]*core.UserDomainInfo, error)
- func (s *Service) RemoveMembership(ctx context.Context, domainID, subjectID uuid.UUID) error
- func (s *Service) ResolveDomain(ctx context.Context, typeCode, key string) (*core.ResolvedDomain, error)
- func (s *Service) ResolveDomainByID(ctx context.Context, domainID uuid.UUID) (*core.ResolvedDomain, error)
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 ¶
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 ¶
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 ¶
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 ¶
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.