types

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types exposes domain types for permissions-api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.1.4

type Action struct {
	Name          string
	Conditions    []Condition
	ConditionSets []ConditionSet
}

Action represents a named thing a subject can do.

type Condition added in v0.1.4

type Condition struct {
	RoleBinding        *ConditionRoleBinding
	RoleBindingV2      *ConditionRoleBindingV2
	RelationshipAction *ConditionRelationshipAction
}

Condition represents a required condition for performing an action.

type ConditionRelationshipAction added in v0.1.4

type ConditionRelationshipAction struct {
	Relation   string
	ActionName string
}

ConditionRelationshipAction represents a condition where an action must be able to be performed on another resource along a relation to perform an action.

type ConditionRoleBinding added in v0.1.4

type ConditionRoleBinding struct{}

ConditionRoleBinding represents a condition where a role binding is necessary to perform an action.

type ConditionRoleBindingV2 added in v0.5.0

type ConditionRoleBindingV2 struct{}

ConditionRoleBindingV2 represents a condition where a role binding is necessary to perform an action. This is the new version of the condition, and it is used to support the new role binding resource type.

type ConditionSet added in v0.5.0

type ConditionSet struct {
	Conditions []Condition
}

ConditionSet is a set of conditions that must be met for the action to be performed.

type Relationship

type Relationship struct {
	Resource Resource
	Relation string
	Subject  Resource
}

Relationship represents a named association between a resource and a subject.

type Resource

type Resource struct {
	Type string
	ID   gidx.PrefixedID
}

Resource is the object to be acted upon by an subject

type ResourceType

type ResourceType struct {
	Name          string
	IDPrefix      string
	Relationships []ResourceTypeRelationship
	Actions       []Action
}

ResourceType defines a type of resource managed by the api

type ResourceTypeRelationship

type ResourceTypeRelationship struct {
	Relation string
	Types    []TargetType
}

ResourceTypeRelationship is a relationship for a resource type.

type Role

type Role struct {
	ID      gidx.PrefixedID
	Name    string
	Manager string
	Actions []string

	ResourceID gidx.PrefixedID
	CreatedBy  gidx.PrefixedID
	UpdatedBy  gidx.PrefixedID
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Role is a collection of permissions.

type RoleBinding added in v0.5.0

type RoleBinding struct {
	ID         gidx.PrefixedID
	ResourceID gidx.PrefixedID
	Manager    string
	RoleID     gidx.PrefixedID
	SubjectIDs []gidx.PrefixedID

	CreatedBy gidx.PrefixedID
	UpdatedBy gidx.PrefixedID
	CreatedAt time.Time
	UpdatedAt time.Time
}

RoleBinding represents a role binding between a role and a resource.

type RoleBindingSubject added in v0.5.0

type RoleBindingSubject struct {
	SubjectResource Resource
}

RoleBindingSubject is the object that represents the subject of a role binding.

type TargetType added in v0.5.0

type TargetType struct {
	Name              string
	SubjectIdentifier string
	SubjectRelation   string
}

TargetType represents a relationship target, as defined in spiceDB's schema reference: https://authzed.com/docs/reference/schema-lang#relations

Jump to

Keyboard shortcuts

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