Documentation ¶
Index ¶
- type Check
- type DirectInvoker
- func (invoker *DirectInvoker) Check(ctx context.Context, request *base.PermissionCheckRequest) (response *base.PermissionCheckResponse, err error)
- func (invoker *DirectInvoker) Expand(ctx context.Context, request *base.PermissionExpandRequest) (response *base.PermissionExpandResponse, err error)
- func (invoker *DirectInvoker) LookupEntity(ctx context.Context, request *base.PermissionLookupEntityRequest) (response *base.PermissionLookupEntityResponse, err error)
- func (invoker *DirectInvoker) LookupEntityStream(ctx context.Context, request *base.PermissionLookupEntityRequest, ...) (err error)
- func (invoker *DirectInvoker) LookupSubject(ctx context.Context, request *base.PermissionLookupSubjectRequest) (response *base.PermissionLookupSubjectResponse, err error)
- func (invoker *DirectInvoker) SubjectPermission(ctx context.Context, request *base.PermissionSubjectPermissionRequest) (response *base.PermissionSubjectPermissionResponse, err error)
- type Expand
- type Invoker
- type LookupEntity
- type LookupSubject
- type SubjectPermission
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check interface {
Check(ctx context.Context, request *base.PermissionCheckRequest) (response *base.PermissionCheckResponse, err error)
}
Check is an interface that defines a method for checking permissions. It requires an implementation of InvokeCheck that takes a context and a PermissionCheckRequest, and returns a PermissionCheckResponse and an error if any.
type DirectInvoker ¶
type DirectInvoker struct {
// contains filtered or unexported fields
}
DirectInvoker is a struct that implements the Invoker interface. It holds references to various engines needed for permission-related operations.
func NewDirectInvoker ¶
func NewDirectInvoker( schemaReader storage.SchemaReader, relationshipReader storage.RelationshipReader, cc Check, ec Expand, le LookupEntity, ls LookupSubject, sp SubjectPermission, meter api.Meter, ) *DirectInvoker
NewDirectInvoker is a constructor for DirectInvoker. It takes pointers to CheckEngine, ExpandEngine, LookupSchemaEngine, and LookupEntityEngine as arguments and returns an Invoker instance.
func (*DirectInvoker) Check ¶
func (invoker *DirectInvoker) Check(ctx context.Context, request *base.PermissionCheckRequest) (response *base.PermissionCheckResponse, err error)
Check is a method that implements the Check interface. It calls the Run method of the CheckEngine with the provided context and PermissionCheckRequest, and returns a PermissionCheckResponse and an error if any.
func (*DirectInvoker) Expand ¶
func (invoker *DirectInvoker) Expand(ctx context.Context, request *base.PermissionExpandRequest) (response *base.PermissionExpandResponse, err error)
Expand is a method that implements the Expand interface. It calls the Run method of the ExpandEngine with the provided context and PermissionExpandRequest, and returns a PermissionExpandResponse and an error if any.
func (*DirectInvoker) LookupEntity ¶
func (invoker *DirectInvoker) LookupEntity(ctx context.Context, request *base.PermissionLookupEntityRequest) (response *base.PermissionLookupEntityResponse, err error)
LookupEntity is a method that implements the LookupEntity interface. It calls the Run method of the LookupEntityEngine with the provided context and PermissionLookupEntityRequest, and returns a PermissionLookupEntityResponse and an error if any.
func (*DirectInvoker) LookupEntityStream ¶
func (invoker *DirectInvoker) LookupEntityStream(ctx context.Context, request *base.PermissionLookupEntityRequest, server base.Permission_LookupEntityStreamServer) (err error)
LookupEntityStream is a method that implements the LookupEntityStream interface. It calls the Stream method of the LookupEntityEngine with the provided context, PermissionLookupEntityRequest, and Permission_LookupEntityStreamServer, and returns an error if any.
func (*DirectInvoker) LookupSubject ¶ added in v0.4.1
func (invoker *DirectInvoker) LookupSubject(ctx context.Context, request *base.PermissionLookupSubjectRequest) (response *base.PermissionLookupSubjectResponse, err error)
LookupSubject is a method of the DirectInvoker structure. It handles the task of looking up subjects and returning the results in a response.
func (*DirectInvoker) SubjectPermission ¶ added in v0.4.7
func (invoker *DirectInvoker) SubjectPermission(ctx context.Context, request *base.PermissionSubjectPermissionRequest) (response *base.PermissionSubjectPermissionResponse, err error)
SubjectPermission is a method of the DirectInvoker structure. It handles the task of subject's permissions and returning the results in a response.
type Expand ¶
type Expand interface {
Expand(ctx context.Context, request *base.PermissionExpandRequest) (response *base.PermissionExpandResponse, err error)
}
Expand is an interface that defines a method for expanding permissions. It requires an implementation of InvokeExpand that takes a context and a PermissionExpandRequest, and returns a PermissionExpandResponse and an error if any.
type Invoker ¶
type Invoker interface { Check Expand LookupEntity LookupSubject SubjectPermission }
Invoker is an interface that groups multiple permission-related interfaces. It is used to define a common contract for invoking various permission operations.
type LookupEntity ¶
type LookupEntity interface { LookupEntity(ctx context.Context, request *base.PermissionLookupEntityRequest) (response *base.PermissionLookupEntityResponse, err error) LookupEntityStream(ctx context.Context, request *base.PermissionLookupEntityRequest, server base.Permission_LookupEntityStreamServer) (err error) }
LookupEntity is an interface that defines a method for looking up entities with permissions. It requires an implementation of InvokeLookupEntity that takes a context and a PermissionLookupEntityRequest, and returns a PermissionLookupEntityResponse and an error if any.
type LookupSubject ¶ added in v0.4.1
type LookupSubject interface {
LookupSubject(ctx context.Context, request *base.PermissionLookupSubjectRequest) (response *base.PermissionLookupSubjectResponse, err error)
}
LookupSubject -
type SubjectPermission ¶ added in v0.4.7
type SubjectPermission interface {
SubjectPermission(ctx context.Context, request *base.PermissionSubjectPermissionRequest) (response *base.PermissionSubjectPermissionResponse, err error)
}
SubjectPermission -