Documentation ¶
Overview ¶
Package resources provides ready-to-use SQL schemes and DAOs for attaching resource policies to any data
Index ¶
- func NewDAO(o dao.DAO, leftIdentifier string) dao.DAO
- type DAO
- type ResourcesSQL
- func (s *ResourcesSQL) AddPolicies(update bool, resourceId string, policies []*service.ResourcePolicy) error
- func (s *ResourcesSQL) AddPolicy(resourceId string, policy *service.ResourcePolicy) error
- func (s *ResourcesSQL) BuildPolicyConditionForAction(q *service.ResourcePolicyQuery, action service.ResourcePolicyAction) (expr goqu.Expression, e error)
- func (s *ResourcesSQL) DeletePoliciesBySubject(subject string) error
- func (s *ResourcesSQL) DeletePoliciesForResource(resourceId string) error
- func (s *ResourcesSQL) DeletePoliciesForResourceAndAction(resourceId string, action service.ResourcePolicyAction) error
- func (s *ResourcesSQL) GetPoliciesForResource(resourceId string) ([]*service.ResourcePolicy, error)
- func (s *ResourcesSQL) Init(options configx.Values) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DAO ¶
type DAO interface { AddPolicy(resourceId string, policy *service.ResourcePolicy) error AddPolicies(update bool, resourceId string, rules []*service.ResourcePolicy) error GetPoliciesForResource(resourceId string) ([]*service.ResourcePolicy, error) DeletePoliciesForResource(resourceId string) error DeletePoliciesForResourceAndAction(resourceId string, action service.ResourcePolicyAction) error DeletePoliciesBySubject(subject string) error BuildPolicyConditionForAction(q *service.ResourcePolicyQuery, action service.ResourcePolicyAction) (expr goqu.Expression, e error) }
DAO interface
type ResourcesSQL ¶
type ResourcesSQL struct { *sql.Handler LeftIdentifier string // contains filtered or unexported fields }
ResourcesSQL implementats the SQL interface.
func (*ResourcesSQL) AddPolicies ¶
func (s *ResourcesSQL) AddPolicies(update bool, resourceId string, policies []*service.ResourcePolicy) error
AddPolicies persists a set of policies. If update is true, it replace them by deleting existing ones
func (*ResourcesSQL) AddPolicy ¶
func (s *ResourcesSQL) AddPolicy(resourceId string, policy *service.ResourcePolicy) error
AddPolicy persists a policy in the underlying storage
func (*ResourcesSQL) BuildPolicyConditionForAction ¶
func (s *ResourcesSQL) BuildPolicyConditionForAction(q *service.ResourcePolicyQuery, action service.ResourcePolicyAction) (expr goqu.Expression, e error)
BuildPolicyConditionForAction builds an ResourcesSQL condition from claims toward the associated resource table
func (*ResourcesSQL) DeletePoliciesBySubject ¶
func (s *ResourcesSQL) DeletePoliciesBySubject(subject string) error
DeletePoliciesBySubject removes all policies for a given resource
func (*ResourcesSQL) DeletePoliciesForResource ¶
func (s *ResourcesSQL) DeletePoliciesForResource(resourceId string) error
DeletePoliciesForResource removes all policies for a given resource
func (*ResourcesSQL) DeletePoliciesForResourceAndAction ¶
func (s *ResourcesSQL) DeletePoliciesForResourceAndAction(resourceId string, action service.ResourcePolicyAction) error
DeletePoliciesForResourceAndAction removes policies for a given resource only if they have the corresponding action
func (*ResourcesSQL) GetPoliciesForResource ¶
func (s *ResourcesSQL) GetPoliciesForResource(resourceId string) ([]*service.ResourcePolicy, error)
GetPoliciesForResource finds all policies for a given resource