authz

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxObjectTypes = 1000
	MaxEdges       = 5000
)

Variables

View Source
var ErrInvalidQuery = errors.New("invalid query")

Functions

func LastIdSpecToString

func LastIdSpecToString(lastIdSpec LastIdSpec) (string, error)

func QueryHandler

func QueryHandler(svc QueryService, w http.ResponseWriter, r *http.Request) error

Types

type ByObjectIdAsc

type ByObjectIdAsc []QueryResult

func (ByObjectIdAsc) Len

func (res ByObjectIdAsc) Len() int

func (ByObjectIdAsc) Less

func (res ByObjectIdAsc) Less(i, j int) bool

func (ByObjectIdAsc) Swap

func (res ByObjectIdAsc) Swap(i, j int)

type ByObjectIdDesc

type ByObjectIdDesc []QueryResult

func (ByObjectIdDesc) Len

func (res ByObjectIdDesc) Len() int

func (ByObjectIdDesc) Less

func (res ByObjectIdDesc) Less(i, j int) bool

func (ByObjectIdDesc) Swap

func (res ByObjectIdDesc) Swap(i, j int)

type ByObjectTypeAsc

type ByObjectTypeAsc []QueryResult

func (ByObjectTypeAsc) Len

func (res ByObjectTypeAsc) Len() int

func (ByObjectTypeAsc) Less

func (res ByObjectTypeAsc) Less(i, j int) bool

func (ByObjectTypeAsc) Swap

func (res ByObjectTypeAsc) Swap(i, j int)

type ByObjectTypeDesc

type ByObjectTypeDesc []QueryResult

func (ByObjectTypeDesc) Len

func (res ByObjectTypeDesc) Len() int

func (ByObjectTypeDesc) Less

func (res ByObjectTypeDesc) Less(i, j int) bool

func (ByObjectTypeDesc) Swap

func (res ByObjectTypeDesc) Swap(i, j int)

type LastIdSpec

type LastIdSpec struct {
	ObjectType string `json:"objectType"`
	ObjectId   string `json:"objectId"`
}

func StringToLastIdSpec

func StringToLastIdSpec(base64Str string) (*LastIdSpec, error)

type Query

type Query struct {
	Expand         bool
	SelectSubjects *SelectSubjects
	SelectObjects  *SelectObjects
	Context        *baseWarrant.PolicyContext
	// contains filtered or unexported fields
}

func NewQueryFromString

func NewQueryFromString(queryString string) (*Query, error)

func (Query) String added in v0.54.0

func (q Query) String() string

type QueryHaving

type QueryHaving struct {
	ObjectType  string `json:"objectType,omitempty"`
	ObjectId    string `json:"objectId,omitempty"`
	Relation    string `json:"relation,omitempty"`
	SubjectType string `json:"subjectType,omitempty"`
	SubjectId   string `json:"subjectId,omitempty"`
}

type QueryListParamParser

type QueryListParamParser struct{}

func (QueryListParamParser) GetDefaultSortBy

func (parser QueryListParamParser) GetDefaultSortBy() string

func (QueryListParamParser) GetSupportedSortBys

func (parser QueryListParamParser) GetSupportedSortBys() []string

func (QueryListParamParser) ParseValue

func (parser QueryListParamParser) ParseValue(val string, sortBy string) (interface{}, error)

type QueryResult

type QueryResult struct {
	ObjectType string                  `json:"objectType"`
	ObjectId   string                  `json:"objectId"`
	Warrant    baseWarrant.WarrantSpec `json:"warrant"`
	IsImplicit bool                    `json:"isImplicit"`
	Meta       map[string]interface{}  `json:"meta,omitempty"`
}

type QueryService

type QueryService struct {
	service.BaseService
	// contains filtered or unexported fields
}

func NewService

func NewService(env service.Env, objectTypeSvc objecttype.Service, warrantSvc warrant.Service, objectSvc object.Service) QueryService

func (QueryService) Query

func (svc QueryService) Query(ctx context.Context, query *Query, listParams service.ListParams) (*Result, error)

func (QueryService) Routes

func (svc QueryService) Routes() ([]service.Route, error)

type Resource

type Resource struct {
	Type string
	Id   string
}

type Result

type Result struct {
	Results []QueryResult `json:"results"`
	LastId  string        `json:"lastId,omitempty"`
}

type ResultSet

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

func NewResultSet

func NewResultSet() *ResultSet

func (*ResultSet) Add

func (rs *ResultSet) Add(objectType string, objectId string, warrant warrant.WarrantSpec)

func (ResultSet) Get

func (rs ResultSet) Get(objectType string, objectId string) *ResultSetNode

func (ResultSet) Has

func (rs ResultSet) Has(objectType string, objectId string) bool

func (ResultSet) Intersect

func (rs ResultSet) Intersect(other *ResultSet) *ResultSet

func (ResultSet) Len

func (rs ResultSet) Len() int

func (ResultSet) List

func (rs ResultSet) List() *ResultSetNode

func (ResultSet) String

func (rs ResultSet) String() string

func (ResultSet) Union

func (rs ResultSet) Union(other *ResultSet) *ResultSet

type ResultSetNode

type ResultSetNode struct {
	ObjectType string
	ObjectId   string
	Warrant    warrant.WarrantSpec
	// contains filtered or unexported fields
}

func (ResultSetNode) Next

func (node ResultSetNode) Next() *ResultSetNode

type SelectObjects

type SelectObjects struct {
	ObjectTypes  []string
	Relations    []string
	WhereSubject *Resource
}

type SelectSubjects

type SelectSubjects struct {
	ForObject    *Resource
	Relations    []string
	SubjectTypes []string
}

Jump to

Keyboard shortcuts

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