Documentation
¶
Overview ¶
Package pinterface provides interface types for the xyproto/simple* and xyproto/permission* packages + terminar/permissionsqlite
Index ¶
Constants ¶
View Source
const Version = 5.3
Version is the API version. The API is stable within the same major version number
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICreator ¶
type ICreator interface {
NewHashMap(id string) (IHashMap, error)
NewKeyValue(id string) (IKeyValue, error)
NewList(id string) (IList, error)
NewSet(id string) (ISet, error)
}
Data structure creator
type IHashMap ¶
type IHashMap interface {
All() ([]string, error)
Clear() error
DelKey(owner, key string) error
Del(key string) error
Exists(owner string) (bool, error)
Get(owner, key string) (string, error)
Has(owner, key string) (bool, error)
Keys(owner string) ([]string, error)
Remove() error
Set(owner, key, value string) error
}
type IHashMap2 ¶
type IHashMap2 interface {
All() ([]string, error)
AllWhere(key, value string) ([]string, error)
Clear() error
Count() (int64, error)
DelKey(owner, key string) error
Del(key string) error
Empty() (bool, error)
Exists(owner string) (bool, error)
GetMap(owner string, keys []string) (map[string]string, error)
Get(owner, key string) (string, error)
Has(owner, key string) (bool, error)
Keys(owner string) ([]string, error)
Remove() error
SetLargeMap(all map[string]map[string]string) error
SetMap(owner string, m map[string]string) error
Set(owner, key, value string) error
}
type IPermissions ¶
type IPermissions interface {
AddAdminPath(prefix string)
AddPublicPath(prefix string)
AddUserPath(prefix string)
Clear()
DenyFunction() http.HandlerFunc
Rejected(w http.ResponseWriter, req *http.Request) bool
ServeHTTP(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
SetAdminPath(pathPrefixes []string)
SetDenyFunction(f http.HandlerFunc)
SetPublicPath(pathPrefixes []string)
SetUserPath(pathPrefixes []string)
UserState() IUserState
}
Middleware for permissions
type IRedisCreator ¶
type IRedisCreator interface {
SelectDatabase(dbindex int)
}
Redis data structure creator
type IRedisHost ¶
type IRedisHost interface {
DatabaseIndex()
Pool()
}
Redis host (implemented structures can also be an IHost, of course)
type IUserState ¶
type IUserState interface {
AddUnconfirmed(username, confirmationCode string)
AddUser(username, password, email string)
AdminRights(req *http.Request) bool
AllUnconfirmedUsernames() ([]string, error)
AllUsernames() ([]string, error)
AlreadyHasConfirmationCode(confirmationCode string) bool
BooleanField(username, fieldname string) bool
ClearCookie(w http.ResponseWriter)
ConfirmationCode(username string) (string, error)
ConfirmUserByConfirmationCode(confirmationcode string) error
Confirm(username string)
CookieSecret() string
CookieTimeout(username string) int64
CorrectPassword(username, password string) bool
Email(username string) (string, error)
FindUserByConfirmationCode(confirmationcode string) (string, error)
GenerateUniqueConfirmationCode() (string, error)
HashPassword(username, password string) string
HasUser(username string) bool
IsAdmin(username string) bool
IsConfirmed(username string) bool
IsLoggedIn(username string) bool
Login(w http.ResponseWriter, username string) error
Logout(username string)
MarkConfirmed(username string)
PasswordAlgo() string
PasswordHash(username string) (string, error)
RemoveAdminStatus(username string)
RemoveUnconfirmed(username string)
RemoveUser(username string)
SetAdminStatus(username string)
SetBooleanField(username, fieldname string, val bool)
SetCookieSecret(cookieSecret string)
SetCookieTimeout(cookieTime int64)
SetLoggedIn(username string)
SetLoggedOut(username string)
SetMinimumConfirmationCodeLength(length int)
SetPasswordAlgo(algorithm string) error
SetPassword(username, password string)
SetUsernameCookie(w http.ResponseWriter, username string) error
UsernameCookie(req *http.Request) (string, error)
Username(req *http.Request) string
UserRights(req *http.Request) bool
Creator() ICreator
Host() IHost
Users() IHashMap
}
Interface for making it possible to depend on different versions of the permission package, or other packages that implement userstates.
Click to show internal directories.
Click to hide internal directories.