Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetSubject ¶
SetSubject sets the Subject into the given context.Context.
Types ¶
type ActionResource ¶ added in v0.4.0
type Project ¶
type Project struct { Resource `json:",inline"` // ReadOnlyEnvironments indicates the read-only environment list of the project. ReadOnlyEnvironments []Resource `json:"readOnlyEnvironments"` // ReadOnlyConnectors indicates the read-only connector list of the project. ReadOnlyConnectors []Resource `json:"readOnlyConnectors"` }
type ProjectRole ¶
type Resource ¶ added in v0.4.0
type Role ¶
type Role struct { // ID indicates the id of the role. ID string `json:"id"` // Policies indicates the policies of the role. Policies types.RolePolicies `json:"policies"` }
type Subject ¶
type Subject struct { // Ctx holds the request gin.Context. Ctx *gin.Context `json:"-"` // ID indicates the id of the subject. ID object.ID `json:"id"` // Domain indicates the domain of the subject. Domain string `json:"domain"` // Groups indicates all superior groups which the subject belong to. Groups []string `json:"groups"` // Name indicates the name of the subject. Name string `json:"name"` // Roles indicates the roles of the subject. Roles []Role `json:"roles"` // ProjectRoles indicates the project roles of the subject. ProjectRoles []ProjectRole `json:"projectRoles"` // ApplicableEnvironmentTypes indicates which environment type are the subject to apply. ApplicableEnvironmentTypes []string `json:"applicableEnvironmentTypes"` }
func GetSubject ¶
GetSubject gets the Subject from the given context.Context.
func MustGetSubject ¶
MustGetSubject is similar to GetSubject, but panic if error raising.
func (Subject) Enforce ¶
func (s Subject) Enforce(action string, resources []ActionResource, path string) bool
Enforce returns true if the given conditions if allowing.
func (Subject) IsAnonymous ¶
IsAnonymous returns true if this subject has not been authenticated.
func (Subject) IsApplicableEnvironmentType ¶ added in v0.4.0
IsApplicableEnvironmentType returns true if the given environment type is applicable.
Click to show internal directories.
Click to hide internal directories.