Documentation ¶
Index ¶
- Constants
- Variables
- func AddUserInGroup(usrID, grpID int64) error
- func AddUserInOrg(usrID, orgID int64) error
- func Connect(url string) error
- func CountUsersForNamespace(id int64) (int, error)
- func CountUsersInGroup(grpID int64) (int, error)
- func CreateAdministrator(nsID, usrID int64) error
- func CreateGroup(name string, nsID int64) (int64, error)
- func CreateNamespace(name, ttl, refreshTTL, algo string, accessKey, refreshKey []byte, ...) (int64, error)
- func CreateOrg(name string) (int64, error)
- func CreateQuidAdminIfMissing(username, password string) error
- func CreateTablesIndexesIfMissing() error
- func CreateUser(name, password string, nsID int64) (server.User, error)
- func CreateUserFromNameAndPassword(name, passwordHash string, nsID int64) (int64, error)
- func DeleteAdministrator(usrID, nsID int64) error
- func DeleteGroup(id int64) error
- func DeleteOrg(id int64) error
- func DeleteUser(id int64) error
- func DropDatabase(dbName string) error
- func DropTablesIndexes() error
- func EnableNsEndpoint(id int64, enable bool) error
- func GroupExists(name string, nsID int64) (bool, error)
- func IsUserAnAdmin(usrID, nsID int64) (bool, error)
- func IsUserInAdminGroup(uID, nsID int64) (bool, error)
- func IsUserInGroup(usrID, grpID int64) (bool, error)
- func NamespaceExists(name string) (bool, error)
- func OrgExists(name string) (bool, error)
- func RemoveUserFromGroup(usrID, grpID int64) error
- func RemoveUserFromOrg(usrID, orgID int64) error
- func SelectAllGroups() ([]server.Group, error)
- func SelectAllNamespaces() ([]server.Namespace, error)
- func SelectAllOrgs() ([]server.Org, error)
- func SelectAllUsers() ([]server.User, error)
- func SelectEnabledUser(name string, nsID int64) (server.User, error)
- func SelectGroup(name string, nsID int64) (server.Group, error)
- func SelectGroupsForUser(usrID int64) ([]server.Group, error)
- func SelectGroupsNamesForUser(usrID int64) ([]string, error)
- func SelectNsFromName(nsName string) (server.Namespace, error)
- func SelectNsGroups(nsID int64) ([]server.Group, error)
- func SelectNsID(name string) (int64, error)
- func SelectNsStartsWith(name string) ([]server.Namespace, error)
- func SelectNsUsers(nsID int64) ([]server.User, error)
- func SelectOrg(name string) (server.Org, error)
- func SelectOrgStartsWith(name string) ([]server.Org, error)
- func SelectOrgsForUser(usrID int64) ([]server.Org, error)
- func SelectOrgsNamesForUser(usrID int64) ([]string, error)
- func SelectVerificationKeyDER(id int64) (found bool, algo string, der []byte, _ error)
- func UpdateNsRefreshMaxTTL(id int64, refreshMaxTTL string) error
- func UpdateNsTokenMaxTTL(id int64, maxTTL string) error
- func UserExists(name string, nsID int64) (bool, error)
- type Administrator
- type NonAdmin
- type QueryError
- type QueryResult
- type UserType
Constants ¶
const ( UserNoAdmin = iota NsAdmin QuidAdmin )
Variables ¶
var ( ErrUsernameTooShort = errors.New("username must have more than 2 characters") ErrPasswordTooShort = errors.New("password must have more than 5 characters") )
Functions ¶
func AddUserInGroup ¶
AddUserInGroup : add a user into a group.
func AddUserInOrg ¶
AddUserInOrg : add a user into an org.
func CountUsersForNamespace ¶
CountUsersForNamespace : count users in a namespace.
func CountUsersInGroup ¶
CountUsersInGroup : count the users in a group.
func CreateAdministrator ¶
CreateAdministrator : create an admin user.
func CreateGroup ¶
CreateGroup : create a group.
func CreateNamespace ¶
func CreateNamespace(name, ttl, refreshTTL, algo string, accessKey, refreshKey []byte, endpoint bool) (int64, error)
CreateNamespace : create a namespace.
func CreateTablesIndexesIfMissing ¶
func CreateTablesIndexesIfMissing() error
CreateTablesIndexesIfMissing : execute the schema.
func CreateUser ¶
CreateUser : create a user.
func CreateUserFromNameAndPassword ¶
CreateUserFromNameAndPassword : create a user.
func DeleteAdministrator ¶
DeleteAdministrator : delete an admin user for a namespace.
func DropDatabase ¶
DropDatabase executes "DROP DATABASE $POSTGRES_DB;".
func DropTablesIndexes ¶
func DropTablesIndexes() error
DropTablesIndexes deletes all tables and indexes from DB.
func EnableNsEndpoint ¶
EnableNsEndpoint : enable or disable public endpoint.
func GroupExists ¶
GroupExists : check if an group exists.
func IsUserAnAdmin ¶
IsUserAnAdmin : check if an admin user exists.
func IsUserInAdminGroup ¶
IsUserInAdminGroup : check if a user is in quid admin group
func IsUserInGroup ¶
IsUserInGroup : check if a user is in a group.
func NamespaceExists ¶
NamespaceExists : check if a namespace exists.
func RemoveUserFromGroup ¶
RemoveUserFromGroup : remove a user from a group.
func RemoveUserFromOrg ¶
RemoveUserFromOrg : remove a user from an org.
func SelectAllGroups ¶
SelectAllGroups : get all the groups.
func SelectAllNamespaces ¶
SelectAllNamespaces : get the namespaces.
func SelectEnabledUser ¶
SelectEnabledUser : get a user from it's name.
func SelectGroup ¶
SelectGroup : get a group.
func SelectGroupsForUser ¶
SelectGroupsForUser : get the groups for a user.
func SelectGroupsNamesForUser ¶
SelectGroupsNamesForUser : get the groups for a user.
func SelectNsFromName ¶
SelectNsFromName : get a namespace.
func SelectNsGroups ¶
SelectNsGroups : get the groups for a namespace.
func SelectNsStartsWith ¶
SelectNsStartsWith : get a namespace.
func SelectNsUsers ¶
SelectNsUsers : get the users in a namespace.
func SelectOrgStartsWith ¶
SelectOrgStartsWith : get a namespace.
func SelectOrgsForUser ¶
SelectOrgsForUser : get the orgs for a user.
func SelectOrgsNamesForUser ¶
SelectOrgsNamesForUser : get the orgs for a user.
func SelectVerificationKeyDER ¶
SelectVerificationKeyDER get the AccessToken key (in DER form) for a namespace.
func UpdateNsRefreshMaxTTL ¶
UpdateNsRefreshMaxTTL : update a max refresh token ttl for a namespace.
func UpdateNsTokenMaxTTL ¶
UpdateNsTokenMaxTTL : update a max access token ttl for a namespace.
Types ¶
type Administrator ¶
type Administrator struct { ID int64 `json:"id" db:"id"` Name string `json:"name" db:"name"` UsrID int64 `json:"usr_id" db:"usr_id"` NsID int64 `json:"ns_id" db:"ns_id"` }
Administrator : base model.
func SelectAdministrators ¶
func SelectAdministrators(nsID int64) ([]Administrator, error)
SelectAdministrators : get the admin users in a namespace.
type NonAdmin ¶
type NonAdmin struct { Name string `json:"name" db:"name"` UsrID int64 `json:"usr_id" db:"usr_id"` NsID int64 `json:"ns_id" db:"ns_id"` }
NonAdmin : base model.
type QueryResult ¶
type QueryResult struct { Error QueryError HasError bool }
QueryResult :.
func DeleteNamespace ¶
func DeleteNamespace(id int64) QueryResult
DeleteNamespace : delete a namespace.