Documentation ¶
Overview ¶
Package resources provides ready-to-use SQL schemes and DAOs for attaching resource policies to any data
Index ¶
- func ModifyLogin(ctx context.Context, dao DAO, req *service.ModifyLoginRequest) (*service.ModifyLoginResponse, error)
- 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) GetPoliciesForSubject(subject string) ([]*service.ResourcePolicy, error)
- func (s *ResourcesSQL) Init(ctx context.Context, options configx.Values) error
- func (s *ResourcesSQL) ReplacePoliciesSubject(oldSubject, newSubject string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModifyLogin ¶ added in v4.2.6
func ModifyLogin(ctx context.Context, dao DAO, req *service.ModifyLoginRequest) (*service.ModifyLoginResponse, error)
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) GetPoliciesForSubject(subject string) ([]*service.ResourcePolicy, error) DeletePoliciesForResource(resourceId string) error DeletePoliciesForResourceAndAction(resourceId string, action service.ResourcePolicyAction) error DeletePoliciesBySubject(subject string) error ReplacePoliciesSubject(oldSubject, newSubject string) (int, 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
func (*ResourcesSQL) GetPoliciesForSubject ¶ added in v4.2.6
func (s *ResourcesSQL) GetPoliciesForSubject(subject string) ([]*service.ResourcePolicy, error)
GetPoliciesForSubject finds all policies with a given subject
func (*ResourcesSQL) ReplacePoliciesSubject ¶ added in v4.2.6
func (s *ResourcesSQL) ReplacePoliciesSubject(oldSubject, newSubject string) (int, error)
ReplacePoliciesSubject set a new subject to all policies with the old subject