Documentation ¶
Index ¶
- Constants
- Variables
- type AdministrationResp
- type Attribute
- type AttributeId
- type AttributeKind
- type AuthorizationReq
- type AuthorizationResp
- type Condition
- type CreateInheritanceRelReq
- type CreatePolicyReq
- type CreateResourceReq
- type DeleteAttributeReq
- type DeleteInheritanceRelReq
- type DeletePolicyReq
- type DeleteResourceReq
- type EvalResult
- type GetApplicablePoliciesReq
- type GetApplicablePoliciesResp
- type GetAttributeReq
- type GetAttributeResp
- type GetGrantedPermissionsReq
- type GetGrantedPermissionsResp
- type GetPermissionHierarchyReq
- type GetPermissionHierarchyResp
- type GetResourceReq
- type GetResourceResp
- type GrantedPermission
- type Permission
- type PermissionEvalRequest
- type PermissionHierarchy
- type PermissionKind
- type PermissionLevel
- type PermissionObjHierarchy
- type PermissionPriority
- type Policy
- type PutAttributeReq
- type RHABACRepo
- type Resource
Constants ¶
View Source
const ( SubVarNamePrefix = "sub_" ObjVarNamePrefix = "obj_" EnvVarNamePrefix = "env_" )
View Source
const DefaultEvalResult = EvalResultDenied
Variables ¶
View Source
var ( ErrInvalidOperation = errors.New("expression operation invalid") ErrInvalidVariableName = errors.New("expression variable name invalid") ErrInvalidNode = errors.New("expression nodes must be literals, variable names or supported operations") ErrParsing = errors.New("not an expression") )
View Source
var (
RootResource = Resource{resourceId{"", "root"}, nil}
)
Functions ¶
This section is empty.
Types ¶
type AdministrationResp ¶
type AdministrationResp struct {
Error error
}
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
func NewAttribute ¶
func NewAttribute(id AttributeId, kind AttributeKind, value interface{}) (*Attribute, error)
func (Attribute) Kind ¶
func (attr Attribute) Kind() AttributeKind
type AttributeId ¶
type AttributeId struct {
// contains filtered or unexported fields
}
func NewAttributeId ¶
func NewAttributeId(name string) (*AttributeId, error)
func (AttributeId) Name ¶
func (attr AttributeId) Name() string
type AttributeKind ¶
type AttributeKind int64
const ( Int64 AttributeKind = iota Float64 String Bool )
type AuthorizationReq ¶
type AuthorizationResp ¶
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
func NewCondition ¶
func (Condition) Expression ¶
type CreateInheritanceRelReq ¶
type CreatePolicyReq ¶
type CreatePolicyReq struct { SubjectScope, ObjectScope Resource Permission Permission }
type CreateResourceReq ¶
type CreateResourceReq struct {
Resource Resource
}
type DeleteAttributeReq ¶
type DeleteAttributeReq struct { Resource Resource AttributeId AttributeId }
type DeleteInheritanceRelReq ¶
type DeletePolicyReq ¶
type DeletePolicyReq struct { SubjectScope, ObjectScope Resource Permission Permission }
type DeleteResourceReq ¶
type DeleteResourceReq struct {
Resource Resource
}
type EvalResult ¶
type EvalResult int
const ( EvalResultAllowed EvalResult = iota EvalResultDenied EvalResultNonEvaluative )
type GetApplicablePoliciesReq ¶
type GetApplicablePoliciesReq struct {
Subject Resource
}
type GetAttributeReq ¶
type GetAttributeReq struct {
Resource Resource
}
type GetAttributeResp ¶
type GetGrantedPermissionsResp ¶
type GetGrantedPermissionsResp struct { Permissions []GrantedPermission Error error }
type GetPermissionHierarchyResp ¶
type GetPermissionHierarchyResp struct { Hierarchy PermissionHierarchy Error error }
type GetResourceReq ¶
type GetResourceReq struct {
Resource Resource
}
type GetResourceResp ¶
type GrantedPermission ¶
type Permission ¶
type Permission struct {
// contains filtered or unexported fields
}
func NewPermission ¶
func NewPermission(name string, kind PermissionKind, condition Condition) (*Permission, error)
func (Permission) Condition ¶
func (p Permission) Condition() Condition
func (Permission) Kind ¶
func (p Permission) Kind() PermissionKind
func (Permission) Name ¶
func (p Permission) Name() string
type PermissionEvalRequest ¶
type PermissionHierarchy ¶
type PermissionHierarchy map[PermissionPriority]PermissionObjHierarchy
func (PermissionHierarchy) Eval ¶
func (hierarchy PermissionHierarchy) Eval(req PermissionEvalRequest) EvalResult
type PermissionKind ¶
type PermissionKind int
const ( PermissionKindAllow PermissionKind = iota PermissionKindDeny )
type PermissionLevel ¶
type PermissionLevel []Permission
type PermissionObjHierarchy ¶
type PermissionObjHierarchy map[PermissionPriority]PermissionLevel
type PermissionPriority ¶
type PermissionPriority int
type PutAttributeReq ¶
type RHABACRepo ¶
type RHABACRepo interface { CreateResource(req CreateResourceReq) AdministrationResp DeleteResource(req DeleteResourceReq) AdministrationResp GetResource(req GetResourceReq) GetResourceResp PutAttribute(req PutAttributeReq) AdministrationResp DeleteAttribute(req DeleteAttributeReq) AdministrationResp CreateInheritanceRel(req CreateInheritanceRelReq) AdministrationResp DeleteInheritanceRel(req DeleteInheritanceRelReq) AdministrationResp CreatePolicy(req CreatePolicyReq) AdministrationResp DeletePolicy(req DeletePolicyReq) AdministrationResp GetPermissionHierarchy(req GetPermissionHierarchyReq) GetPermissionHierarchyResp GetApplicablePolicies(req GetApplicablePoliciesReq) GetApplicablePoliciesResp }
type Resource ¶
type Resource struct { Attributes []Attribute // contains filtered or unexported fields }
func NewResource ¶
func NewResourceFromName ¶
Click to show internal directories.
Click to hide internal directories.