Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
Authorizer an RBAC authorizer
func NewAuthorizer ¶
func NewAuthorizer(conf string, db *gorm.DB, userHandler func(r *http.Request) (string, error)) (*Authorizer, error)
NewAuthorizer returns the authorizer
func (*Authorizer) Auth ¶
func (a *Authorizer) Auth() gin.HandlerFunc
Auth returns the authorizer handler
func (*Authorizer) LoadPolicy ¶
func (a *Authorizer) LoadPolicy() error
LoadPolicy load the policy from the adaptor
type Permission ¶
type Permission struct { gorm.Model RoleID uint Role *Role `gorm:"foreignKey:RoleID"` Resource string Method string }
Permission ...
func (*Permission) RoleName ¶
func (p *Permission) RoleName() (name string)
RoleName get role name of current permission
func (*Permission) TableName ¶
func (p *Permission) TableName() string
TableName return the table name
Click to show internal directories.
Click to hide internal directories.