Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CtxGlobal = contextType("global") CtxApp = contextType("app") CtxTeam = contextType("team") CtxPool = contextType("pool") CtxIaaS = contextType("iaas") CtxServiceInstance = contextType("service-instance") )
View Source
var ( PermAll = PermissionRegistry.get("") PermApp = PermissionRegistry.get("app") PermAppCreate = PermissionRegistry.get("app.create") PermAppDelete = PermissionRegistry.get("app.delete") PermAppDeploy = PermissionRegistry.get("app.deploy") PermAppRead = PermissionRegistry.get("app.read") PermAppUpdate = PermissionRegistry.get("app.update") PermAppUpdateEnv = PermissionRegistry.get("app.update.env") PermAppUpdateEnvSet = PermissionRegistry.get("app.update.env.set") PermAppUpdateEnvUnset = PermissionRegistry.get("app.update.env.unset") PermAppUpdateRestart = PermissionRegistry.get("app.update.restart") PermIaas = PermissionRegistry.get("iaas") PermIaasRead = PermissionRegistry.get("iaas.read") PermNode = PermissionRegistry.get("node") PermNodeCreate = PermissionRegistry.get("node.create") PermNodeDelete = PermissionRegistry.get("node.delete") PermNodeRead = PermissionRegistry.get("node.read") PermNodeUpdate = PermissionRegistry.get("node.update") PermServiceInstance = PermissionRegistry.get("service-instance") PermServiceInstanceCreate = PermissionRegistry.get("service-instance.create") PermServiceInstanceDelete = PermissionRegistry.get("service-instance.delete") PermServiceInstanceRead = PermissionRegistry.get("service-instance.read") PermServiceInstanceUpdate = PermissionRegistry.get("service-instance.update") PermServiceInstanceUpdateBind = PermissionRegistry.get("service-instance.update.bind") PermServiceInstanceUpdateGrant = PermissionRegistry.get("service-instance.update.grant") PermServiceInstanceUpdateRevoke = PermissionRegistry.get("service-instance.update.revoke") PermServiceInstanceUpdateUnbind = PermissionRegistry.get("service-instance.update.unbind") PermTeam = PermissionRegistry.get("team") PermTeamCreate = PermissionRegistry.get("team.create") PermTeamDelete = PermissionRegistry.get("team.delete") PermTeamUpdate = PermissionRegistry.get("team.update") PermTeamUpdateAddMember = PermissionRegistry.get("team.update.add-member") PermTeamUpdateRemoveMember = PermissionRegistry.get("team.update.remove-member") PermUser = PermissionRegistry.get("user") PermUserCreate = PermissionRegistry.get("user.create") PermUserDelete = PermissionRegistry.get("user.delete") PermUserList = PermissionRegistry.get("user.list") PermUserUpdate = PermissionRegistry.get("user.update") )
View Source
var ( ErrRoleNotFound = errors.New("role not found") ErrRoleAlreadyExists = errors.New("role already exists") )
View Source
var PermissionRegistry = (®istry{}).addWithCtx( "app", []contextType{CtxApp, CtxTeam, CtxPool}, ).addWithCtx( "app.create", []contextType{CtxTeam, CtxPool}, ).add( "app.update.env.set", "app.update.env.unset", "app.update.restart", "app.deploy", "app.read", "app.delete", ).addWithCtx( "node", []contextType{CtxPool}, ).add( "node.create", "node.read", "node.update", "node.delete", ).addWithCtx( "iaas.read", []contextType{CtxIaaS}, ).addWithCtx( "team", []contextType{CtxTeam}, ).addWithCtx( "team.create", []contextType{}, ).add( "team.delete", "team.update.add-member", "team.update.remove-member", ).add( "user.create", "user.delete", "user.list", "user.update", ).addWithCtx( "service-instance", []contextType{CtxServiceInstance, CtxTeam}, ).addWithCtx( "service-instance.create", []contextType{}, ).add( "service-instance.read", "service-instance.delete", "service-instance.update.bind", "service-instance.update.unbind", "service-instance.update.grant", "service-instance.update.revoke", )
Functions ¶
func DestroyRole ¶
Types ¶
type Permission ¶
type Permission struct { Scheme *permissionScheme Context Context }
type PermissionSchemeList ¶
type PermissionSchemeList []*permissionScheme
func (PermissionSchemeList) Len ¶
func (l PermissionSchemeList) Len() int
func (PermissionSchemeList) Less ¶
func (l PermissionSchemeList) Less(i, j int) bool
func (PermissionSchemeList) Swap ¶
func (l PermissionSchemeList) Swap(i, j int)
type Role ¶
type Role struct { Name string `bson:"_id" json:"name"` ContextType contextType `json:"context"` SchemeNames []string `json:"scheme_names,omitempty"` }
func (*Role) AddPermissions ¶
func (*Role) PermisionsFor ¶
func (r *Role) PermisionsFor(contextValue string) []Permission
func (*Role) RemovePermissions ¶
type Token ¶
type Token interface {
Permissions() ([]Permission, error)
}
Click to show internal directories.
Click to hide internal directories.