authz

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Code generated by spicegen. DO NOT EDIT

Code generated by spicegen. DO NOT EDIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRelationshipOptions

type AddRelationshipOptions struct {
	Caveat                  *pb.ContextualizedCaveat
	OptionalSubjectRelation string
}

type CheckPermissionOptions

type CheckPermissionOptions struct {
	Context *structpb.Struct
}

type Client

type Client struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Client is a SpiceDB client that can be used to check permissions on resources. It is safe for concurrent use. This client implements SpiceGenClient.

func (*Client) AddDocumentRelationship

func (c *Client) AddDocumentRelationship(ctx context.Context, resource DocumentResource, relation document.DocumentRelation, subject Resource, opts *AddRelationshipOptions) error

func (*Client) AddOrganizationRelationship

func (c *Client) AddOrganizationRelationship(ctx context.Context, resource OrganizationResource, relation organization.OrganizationRelation, subject Resource, opts *AddRelationshipOptions) error

func (*Client) AddRelationship

func (c *Client) AddRelationship(ctx context.Context, resource Resource, relation string, subject Resource, opts *AddRelationshipOptions) error

func (*Client) AddTeamRelationship added in v0.1.7

func (c *Client) AddTeamRelationship(ctx context.Context, resource TeamResource, relation team.TeamRelation, subject Resource, opts *AddRelationshipOptions) error

func (*Client) CheckDocumentPermission

func (c *Client) CheckDocumentPermission(ctx context.Context, subject Resource, permission document.DocumentPermission, resource DocumentResource, opts *CheckPermissionOptions) (bool, error)

func (*Client) CheckOrganizationPermission

func (c *Client) CheckOrganizationPermission(ctx context.Context, subject Resource, permission organization.OrganizationPermission, resource OrganizationResource, opts *CheckPermissionOptions) (bool, error)

func (*Client) CheckPermission

func (c *Client) CheckPermission(ctx context.Context, subject Resource, permission string, resource Resource, opts *CheckPermissionOptions) (bool, error)

func (*Client) DeleteDocumentRelationship

func (c *Client) DeleteDocumentRelationship(ctx context.Context, resource DocumentResource, relation document.DocumentRelation, subject Resource, opts *DeleteRelationshipOptions) error

func (*Client) DeleteOrganizationRelationship

func (c *Client) DeleteOrganizationRelationship(ctx context.Context, resource OrganizationResource, relation organization.OrganizationRelation, subject Resource, opts *DeleteRelationshipOptions) error

func (*Client) DeleteRelationship

func (c *Client) DeleteRelationship(ctx context.Context, resource Resource, relation string, subject Resource, opts *DeleteRelationshipOptions) error

func (*Client) DeleteTeamRelationship added in v0.1.7

func (c *Client) DeleteTeamRelationship(ctx context.Context, resource TeamResource, relation team.TeamRelation, subject Resource, opts *DeleteRelationshipOptions) error

func (*Client) LookupDocumentResources added in v0.1.3

func (c *Client) LookupDocumentResources(ctx context.Context, subject Resource, permission document.DocumentPermission, opts *LookupResourcesOptions) ([]string, string, error)

func (*Client) LookupDocumentSubjects added in v0.2.0

func (c *Client) LookupDocumentSubjects(ctx context.Context, resourceID string, subjectType ResourceType, permission document.DocumentPermission, opts *LookupSubjectsOptions) ([]string, string, error)

func (*Client) LookupOrganizationResources added in v0.1.3

func (c *Client) LookupOrganizationResources(ctx context.Context, subject Resource, permission organization.OrganizationPermission, opts *LookupResourcesOptions) ([]string, string, error)

func (*Client) LookupOrganizationSubjects added in v0.2.0

func (c *Client) LookupOrganizationSubjects(ctx context.Context, resourceID string, subjectType ResourceType, permission organization.OrganizationPermission, opts *LookupSubjectsOptions) ([]string, string, error)

func (*Client) LookupResources added in v0.1.3

func (c *Client) LookupResources(ctx context.Context, resourceType ResourceType, subject Resource, permission string, opts *LookupResourcesOptions) ([]string, string, error)

func (*Client) LookupSubjects added in v0.2.0

func (c *Client) LookupSubjects(ctx context.Context, resource Resource, subjectType ResourceType, permission string, opts *LookupSubjectsOptions) ([]string, string, error)

type DeleteRelationshipOptions added in v0.1.7

type DeleteRelationshipOptions struct {
	Pagination              Pagination
	OptionalSubjectRelation string
}

type DocumentResource

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

func NewDocumentResource

func NewDocumentResource(ID string) DocumentResource

func (DocumentResource) ID

func (r DocumentResource) ID() string

func (DocumentResource) ResourceType

func (r DocumentResource) ResourceType() ResourceType

type LookupResourcesOptions added in v0.1.3

type LookupResourcesOptions struct {
	Pagination              Pagination
	OptionalSubjectRelation string
}

type LookupSubjectsOptions added in v0.2.0

type LookupSubjectsOptions struct {
	Pagination              Pagination
	OptionalSubjectRelation string
}

type OrganizationResource

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

func NewOrganizationResource

func NewOrganizationResource(ID string) OrganizationResource

func (OrganizationResource) ID

func (OrganizationResource) ResourceType

func (r OrganizationResource) ResourceType() ResourceType

type Pagination added in v0.2.0

type Pagination struct {
	Limit int
	Token string
}

type Resource

type Resource interface {
	ResourceType() ResourceType
	ID() string
}

func NewResource added in v0.1.3

func NewResource(resourceType ResourceType, ID string) (Resource, error)

type ResourceType

type ResourceType string
const (
	Document     ResourceType = "document"
	User         ResourceType = "user"
	Team         ResourceType = "team"
	Organization ResourceType = "organization"
)

type SpiceDBClient added in v0.1.3

type SpiceDBClient interface {
	pb.PermissionsServiceClient
	pb.SchemaServiceClient
}

SpiceDBClient is the interface that the spicegen generated client wraps.

type SpiceGenClient added in v0.1.3

type SpiceGenClient interface {
	CheckDocumentPermission(ctx context.Context, subject Resource, permission document.DocumentPermission, resource DocumentResource, opts *CheckPermissionOptions) (bool, error)
	CheckOrganizationPermission(ctx context.Context, subject Resource, permission organization.OrganizationPermission, resource OrganizationResource, opts *CheckPermissionOptions) (bool, error)

	AddDocumentRelationship(ctx context.Context, resource DocumentResource, relation document.DocumentRelation, subject Resource, opts *AddRelationshipOptions) error
	AddTeamRelationship(ctx context.Context, resource TeamResource, relation team.TeamRelation, subject Resource, opts *AddRelationshipOptions) error
	AddOrganizationRelationship(ctx context.Context, resource OrganizationResource, relation organization.OrganizationRelation, subject Resource, opts *AddRelationshipOptions) error

	DeleteDocumentRelationship(ctx context.Context, resource DocumentResource, relation document.DocumentRelation, subject Resource, opts *DeleteRelationshipOptions) error
	DeleteTeamRelationship(ctx context.Context, resource TeamResource, relation team.TeamRelation, subject Resource, opts *DeleteRelationshipOptions) error
	DeleteOrganizationRelationship(ctx context.Context, resource OrganizationResource, relation organization.OrganizationRelation, subject Resource, opts *DeleteRelationshipOptions) error

	LookupDocumentResources(ctx context.Context, subject Resource, permission document.DocumentPermission, opts *LookupResourcesOptions) ([]string, string, error)
	LookupDocumentSubjects(ctx context.Context, resourceID string, subjectType ResourceType, permission document.DocumentPermission, opts *LookupSubjectsOptions) ([]string, string, error)
	LookupOrganizationResources(ctx context.Context, subject Resource, permission organization.OrganizationPermission, opts *LookupResourcesOptions) ([]string, string, error)
	LookupOrganizationSubjects(ctx context.Context, resourceID string, subjectType ResourceType, permission organization.OrganizationPermission, opts *LookupSubjectsOptions) ([]string, string, error)
}

func NewClient

func NewClient(spicedbClient SpiceDBClient) SpiceGenClient

type TeamResource added in v0.1.7

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

func NewTeamResource added in v0.1.7

func NewTeamResource(ID string) TeamResource

func (TeamResource) ID added in v0.1.7

func (r TeamResource) ID() string

func (TeamResource) ResourceType added in v0.1.7

func (r TeamResource) ResourceType() ResourceType

type UserResource

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

func NewUserResource

func NewUserResource(ID string) UserResource

func (UserResource) ID

func (r UserResource) ID() string

func (UserResource) ResourceType

func (r UserResource) ResourceType() ResourceType

Directories

Path Synopsis
permissions
document
Code generated by spicegen.
Code generated by spicegen.
organization
Code generated by spicegen.
Code generated by spicegen.
team
Code generated by spicegen.
Code generated by spicegen.
user
Code generated by spicegen.
Code generated by spicegen.

Jump to

Keyboard shortcuts

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