Documentation ¶
Index ¶
Constants ¶
View Source
const ( UserPrivileges = "userPrivilege" GlobalPrivileges = "globalPrivilege" DatabasePrivileges = "databasePrivilege" CollectionPrivileges = "collectionPrivilege" )
View Source
const ( Allowed = true Denied = false )
View Source
const ( CreateUser = "createUser" GrantRole = "grantRole" LoginUser = "loginUser" CreateRole = "createRole" UpdateRole = "updateRole" ListRole = "listRole" )
View Source
const ( CreateDatabase = "createDatabase" ReadDatabase = "readDatabase" UpdateDatabase = "updateDatabase" DeleteDatabase = "deleteDatabase" CreateCollection = "createCollection" ReadCollection = "readCollection" UpdateCollection = "updateCollection" DeleteCollection = "deleteCollection" AddData = "addData" ReadData = "readData" UpdateData = "updateData" DeleteData = "deleteData" )
View Source
const (
Wildcard = "*"
)
Variables ¶
View Source
var PrivilegeScope = map[string]string{ CreateRole: GlobalPrivileges, CreateDatabase: GlobalPrivileges, LoginUser: GlobalPrivileges, ListRole: GlobalPrivileges, GrantRole: UserPrivileges, UpdateRole: UserPrivileges, ReadDatabase: DatabasePrivileges, UpdateDatabase: DatabasePrivileges, DeleteDatabase: DatabasePrivileges, CreateCollection: DatabasePrivileges, ReadCollection: CollectionPrivileges, UpdateCollection: CollectionPrivileges, DeleteCollection: CollectionPrivileges, AddData: CollectionPrivileges, ReadData: CollectionPrivileges, UpdateData: CollectionPrivileges, DeleteData: CollectionPrivileges, }
TODO: merge PrivilegeScope and PrivilegeType maps into on map/struct and use same everywhere, eg:
map[string]struct{ Scope PrivilegeScopeType Type PrivilegeActionType }
View Source
var PrivilegeType = map[string]PrivilegeActionType{ CreateRole: WildcardPrivilege, LoginUser: WildcardPrivilege, GrantRole: WildcardPrivilege, UpdateRole: WildcardPrivilege, ListRole: WildcardPrivilege, ReadDatabase: ReadPrivilege, ReadCollection: ReadPrivilege, ReadData: ReadPrivilege, CreateDatabase: WritePrivilege, UpdateDatabase: WritePrivilege, DeleteDatabase: WritePrivilege, CreateCollection: WritePrivilege, UpdateCollection: WritePrivilege, DeleteCollection: WritePrivilege, AddData: WritePrivilege, UpdateData: WritePrivilege, DeleteData: WritePrivilege, }
Functions ¶
func IsAvailable ¶
Types ¶
type PrivilegeActionType ¶ added in v1.2.0
type PrivilegeActionType string
Read, Write, Wildcard Action Type
var ( WildcardPrivilege PrivilegeActionType = "wildcardPrivilege" WritePrivilege PrivilegeActionType = "writePrivilege" ReadPrivilege PrivilegeActionType = "readPrivilege" )
func GetPrivilegeType ¶ added in v1.2.0
func GetPrivilegeType(privilege string) PrivilegeActionType
type PrivilegeScopeType ¶ added in v1.2.0
type PrivilegeScopeType string
Scope of Privilege Type TODO: Use for below Privileges (ref. L14-21)
Click to show internal directories.
Click to hide internal directories.