Documentation ¶
Overview ¶
Authorization package
Index ¶
Constants ¶
View Source
const ( // Actions ActionRead = "read" ActionList = "list" ActionUpdate = "update" ActionDelete = "delete" // Resources ResourceWorkflowContract = "workflow_contract" ResourceCASArtifact = "cas_artifact" ResourceReferrer = "referrer" )
Variables ¶
View Source
var ( PolicyWorkflowContractList = &Policy{ResourceWorkflowContract, ActionList} PolicyWorkflowContractRead = &Policy{ResourceWorkflowContract, ActionRead} PolicyWorkflowContractUpdate = &Policy{ResourceWorkflowContract, ActionUpdate} PolicyArtifactDownload = &Policy{ResourceCASArtifact, ActionRead} PolicyReferrerRead = &Policy{ResourceReferrer, ActionRead} )
Functions ¶
This section is empty.
Types ¶
type Enforcer ¶
type Enforcer struct {
*casbin.Enforcer
}
func NewDatabaseEnforcer ¶
func NewDatabaseEnforcer(c *conf.Data_Database) (*Enforcer, error)
NewDatabaseEnforcer creates a new casbin authorization enforcer based on a database backend as policies storage backend
func NewFiletypeEnforcer ¶
NewFileAdapter creates a new casbin authorization enforcer based on a CSV file as policies storage backend
func (*Enforcer) AddPolicies ¶
func (e *Enforcer) AddPolicies(sub *SubjectAPIToken, policies ...*Policy) error
func (*Enforcer) ClearPolicies ¶
func (e *Enforcer) ClearPolicies(sub *SubjectAPIToken) error
Remove all the policies for the given subject
type SubjectAPIToken ¶
type SubjectAPIToken struct {
ID string
}
func (*SubjectAPIToken) String ¶
func (t *SubjectAPIToken) String() string
Click to show internal directories.
Click to hide internal directories.