Documentation
¶
Overview ¶
Package dto is the wire shape of a grant: one request body for every shareable record, with the subject's kind a field rather than a choice of endpoint.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShareRequest ¶
type ShareRequest struct {
}
ShareRequest grants one principal access to the resource named in the path.
There is no resource field: the path says what is being shared, so a request cannot name one resource in the URL and open up another in the body. PrincipalType is what used to be the choice between two endpoints.
func (*ShareRequest) Grant ¶
func (r *ShareRequest) Grant() model.AccessPermission
Grant returns the permission to store, defaulting to READ. Read-only is the safe default for a share: widening it is a deliberate act.
func (*ShareRequest) Subject ¶
func (r *ShareRequest) Subject() model.PrincipalType
Subject returns the principal type being granted to. Validation has already rejected a nil or unrecognised one.
func (*ShareRequest) Validate ¶
func (r *ShareRequest) Validate() []httpx.FieldError
Validate implements httpx.Validator.
type ShareResponse ¶
type ShareResponse struct {
}
ShareResponse is the read model for one share.
The resource is echoed back even though the caller named it in the path: a listing is a set of rows, and a row that did not say what it opened up would be ambiguous once it left the response it arrived in.
func ToShareResponse ¶
func ToShareResponse(s *model.Sharing) ShareResponse
func ToShareResponses ¶
func ToShareResponses(in []model.Sharing) []ShareResponse
type ShareUpdate ¶
type ShareUpdate struct {
}
ShareUpdate changes what an existing share grants. The subject is fixed at creation; only the permission is editable, because moving a share to a different principal would be a revoke and a grant wearing one id.
func (*ShareUpdate) Grant ¶
func (r *ShareUpdate) Grant() model.AccessPermission
Grant returns the permission to store.
func (*ShareUpdate) Validate ¶
func (r *ShareUpdate) Validate() []httpx.FieldError
Validate implements httpx.Validator.