grant

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 146

Documentation

Index

Constants

View Source
const UnknownGrantId string = "🧸_UNKNOWN_GRANT_ID"

Sometimes C1 doesn't have the grant ID, but does have the principal and entitlement.

Variables

This section is empty.

Functions

func AppendGrantReplaced added in v0.9.12

func AppendGrantReplaced(annos annotations.Annotations, replacedGrantID string) annotations.Annotations

AppendGrantReplaced appends a GrantReplaced annotation to the given annotations slice and returns the updated slice. Convenience wrapper around NewGrantReplaced for the common case where the caller is building a response annotations slice inline.

func NewGrant

func NewGrant(resource *v2.Resource, entitlementName string, principal GrantPrincipal, grantOptions ...GrantOption) *v2.Grant

NewGrant returns a new grant for the given entitlement on the resource for the provided principal resource ID.

func NewGrantID added in v0.2.84

func NewGrantID(principal GrantPrincipal, entitlement *v2.Entitlement) string

func NewGrantReplaced added in v0.9.12

func NewGrantReplaced(replacedGrantID string) *v2.GrantReplaced

NewGrantReplaced returns a GrantReplaced annotation suitable for appending to the annotations slice returned from a Grant provisioning call.

replacedGrantID is the ID of the grant that the new grant atomically replaced. ConductorOne marks it revoked without dispatching a separate Revoke RPC.

Typical use:

annos := annotations.Annotations{}
annos.Append(grant.NewGrantReplaced(currentGrant.GetId()))
return newGrants, annos, nil

Types

type GrantOption

type GrantOption func(*v2.Grant) error

func WithAnnotation

func WithAnnotation(msgs ...proto.Message) GrantOption

func WithExternalPrincipalID added in v0.1.15

func WithExternalPrincipalID(externalID *v2.ExternalId) GrantOption

WithExternalPrincipalID: Deprecated. This field is no longer used.

func WithGrantMetadata added in v0.1.1

func WithGrantMetadata(metadata map[string]interface{}) GrantOption

type GrantPrincipal added in v0.0.20

type GrantPrincipal interface {
	proto.Message
	GetBatonResource() bool
}

Jump to

Keyboard shortcuts

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