Documentation ¶
Index ¶
- Constants
- func SetRbacResourceValidator(h RbacResourceValidator)
- func SetRbacServiceValidator(v RbacServiceValidator)
- type Method
- type Permission
- type RBACConfig
- type RBACMap
- type RBACMapBuilder
- type RBACPermission
- type RBACPermissionValidator
- type RBACResource
- type RBACService
- type RBACVerb
- type RbacFile
- type RbacResourceValidator
- type RbacServiceValidator
- type RbacVerbValidator
- type Route
Constants ¶
const (
RBACPermissionUndefined = RBACPermission("")
)
RBACPermissionUndefined represent the undefined permission
Variables ¶
This section is empty.
Functions ¶
func SetRbacResourceValidator ¶
func SetRbacResourceValidator(h RbacResourceValidator)
func SetRbacServiceValidator ¶
func SetRbacServiceValidator(v RbacServiceValidator)
SetRbacServiceValidator set the service validator function that will be called when loading the rbac mapping. v is the validator function.
Types ¶
type Permission ¶
type Permission string
type RBACConfig ¶
type RBACConfig struct { // Skipper function to skip for some request if necessary Skipper echo_middleware.Skipper // Prefix for the permission map Prefix string // PermissionMap has the mapping between {route,method}=>permission PermissionMap RBACMap // Client for rbac access Client rbac_client.Rbac }
type RBACMap ¶
type RBACMap map[Route]map[Method]RBACPermission
RBACMap mapping type
func RBACMapLoad ¶
func (*RBACMap) GetPermission ¶
func (r *RBACMap) GetPermission(prefix, route, method string) (RBACPermission, error)
GetPermission
type RBACMapBuilder ¶
type RBACMapBuilder interface { Build() RBACMap Add(r Route, m Method, p RBACPermission) RBACMapBuilder }
RBACMapBuilder represent the builder for the rbac mapping
func NewRBACMapBuilder ¶
func NewRBACMapBuilder() RBACMapBuilder
NewRBACMap create a builder to generate a RBACMap
type RBACPermission ¶
type RBACPermission string
RBACPermission
func NewRbacPermission ¶
func NewRbacPermission(service RBACService, resource RBACResource, verb RBACVerb) RBACPermission
NewRbacPermission
type RBACPermissionValidator ¶
type RBACPermissionValidator func(p RBACPermission) RBACPermission
RBACPermissionValidator
type RBACResource ¶
type RBACResource string
RBACResource
const ( RBACResourceUndefined RBACResource = "" RBACResourceAny RBACResource = "*" )
func DefaultRbacResourceValidator ¶
func DefaultRbacResourceValidator(r RBACResource) RBACResource
type RBACService ¶
type RBACService string
RBACService
const ( RBACServiceUndefined RBACService = "" RBACServiceAny RBACService = "*" )
func DefaultRbacServiceValidator ¶
func DefaultRbacServiceValidator(s RBACService) RBACService
type RBACVerb ¶
type RBACVerb string
const ( RbacVerbUndefined RBACVerb = "" RbacVerbAny RBACVerb = "*" RbacVerbRead RBACVerb = "read" RbacVerbWrite RBACVerb = "write" RbacVerbCreate RBACVerb = "create" RbacVerbUpdate RBACVerb = "update" RbacVerbDelete RBACVerb = "delete" RbacVerbLink RBACVerb = "link" RbacVerbUnlink RBACVerb = "unlink" RbacVerbOrder RBACVerb = "order" RbacVerbExecute RBACVerb = "execute" )
The following constants result from the schema below https://github.com/RedHatInsights/rbac-config/blob/master/schemas/permissions.schema
type RbacResourceValidator ¶
type RbacResourceValidator func(r RBACResource) RBACResource
RbacResourceValidator validate the provided resource and panic if something is wrong, else return the provided value.
func NewRbacResourceValidator ¶
func NewRbacResourceValidator(resources ...RBACResource) RbacResourceValidator
NewRbacResourceValidator return a handler to manage this scenario
type RbacServiceValidator ¶
type RbacServiceValidator func(s RBACService) RBACService
func NewRbacServiceValidator ¶
func NewRbacServiceValidator(myService RBACService) RbacServiceValidator