Documentation
¶
Index ¶
- Variables
- type AuthnService
- type Filter
- type MembershipService
- type PolicyService
- type Project
- type RelationService
- type Repository
- type Service
- func (s Service) Create(ctx context.Context, prj Project) (Project, error)
- func (s Service) DeleteModel(ctx context.Context, id string) error
- func (s Service) Disable(ctx context.Context, id string) error
- func (s Service) Enable(ctx context.Context, id string) error
- func (s Service) Get(ctx context.Context, idOrName string) (Project, error)
- func (s Service) List(ctx context.Context, f Filter) ([]Project, error)
- func (s *Service) SetMembershipService(ms MembershipService)
- func (s Service) Update(ctx context.Context, prj Project) (Project, error)
- type State
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotExist = errors.New("project or its relations doesn't exist") ErrInvalidUUID = errors.New("invalid syntax of uuid") ErrInvalidID = errors.New("project id is invalid") ErrConflict = errors.New("project already exist") ErrInvalidDetail = errors.New("invalid project detail") ErrInvalidPrincipalType = errors.New("invalid principal type") )
View Source
var AdminPermission = schema.DeletePermission
View Source
var MemberPermission = schema.GetPermission
View Source
var OwnerRole = schema.RoleProjectOwner
Functions ¶
This section is empty.
Types ¶
type AuthnService ¶ added in v0.7.4
type AuthnService interface {
GetPrincipal(ctx context.Context, via ...authenticate.ClientAssertion) (authenticate.Principal, error)
}
type Filter ¶
type Filter struct {
OrgID string
WithMemberCount bool
ProjectIDs []string
State State
// NonInherited filters out projects that are inherited from access given through an organization
NonInherited bool
Pagination *pagination.Pagination
// OrgIDs narrows results to projects whose org_id is in this list. Used by
// membership listing to batch-expand all projects across the orgs a
// principal can inherit project visibility from. If both OrgID and OrgIDs
// are set, projects must satisfy both (intersection) — typically yields
// no rows unless OrgID is one of OrgIDs.
OrgIDs []string
// Principal narrows results to projects on which the principal has a
// policy (direct, via group membership, or org-inheritance unless
// NonInherited is set). When combined with ProjectIDs the two are
// intersected. Resolved by membership.Service.
Principal *authenticate.Principal
}
type MembershipService ¶ added in v0.104.0
type PolicyService ¶ added in v0.7.4
type RelationService ¶
type Repository ¶
type Repository interface {
GetByID(ctx context.Context, id string) (Project, error)
GetByName(ctx context.Context, slug string) (Project, error)
Create(ctx context.Context, org Project) (Project, error)
List(ctx context.Context, f Filter) ([]Project, error)
UpdateByID(ctx context.Context, toUpdate Project) (Project, error)
UpdateByName(ctx context.Context, toUpdate Project) (Project, error)
Delete(ctx context.Context, id string) error
SetState(ctx context.Context, id string, state State) error
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repository Repository, relationService RelationService, policyService PolicyService, authnService AuthnService) *Service
func (Service) DeleteModel ¶
DeleteModel doesn't delete the nested resource, only itself
func (Service) Disable ¶
Disable is a reversible soft-stop: it flips the project's state only and deliberately leaves every SpiceDB relation in place, so Enable restores access exactly as it was. Disable is NOT a revocation — tearing down the tuples is Delete's job (see core/deleter). Authz checks that read SpiceDB directly still pass while a project is disabled, by design.
func (*Service) SetMembershipService ¶ added in v0.104.0
func (s *Service) SetMembershipService(ms MembershipService)
SetMembershipService sets the membership dependency after construction to break the circular init order between project and membership services.
Click to show internal directories.
Click to hide internal directories.