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 ProjectRole ¶
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"`
}
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) IsAnonymous ¶
IsAnonymous returns true if this subject has not been authenticated.
Click to show internal directories.
Click to hide internal directories.