Documentation ¶
Index ¶
- Constants
- Variables
- func Csrf_token(method string, hostname string, path string, url string, username string) (string, string)
- func FileUIApplyModOpts(cui PfUI, file *pf.PfFile)
- func FileUIApplyModOptsM(cui PfUI, files []pf.PfFile)
- func H_NoAccess(cui PfUI)
- func H_errmsg(cui PfUI, err error)
- func H_errmsgs(cui PfUI, msg []string)
- func H_error(cui PfUI, status int)
- func H_errtxt(cui PfUI, txt string)
- func H_file(cui PfUI)
- func H_file_list_file(cui PfUI)
- func H_group_member_profile(cui PfUI)
- func H_msg(cui PfUI)
- func H_user_pwreset(cui PfUI)
- func H_wiki(cui PfUI)
- func LogAccess_start() (err error)
- func LogAccess_stop()
- func NewlineBR(val string) (safe template.HTML)
- func Setup(toolname string, securecookies bool) (err error)
- func TFErr(cui PfUI, str string) (o string, buttons string, neditable int, subs []string, multipart bool)
- func UIInit(securecookies bool, cookie_name string) error
- func WikiUI_ApplyModOpts(cui PfUI, wiki *pf.PfWikiPage)
- func WikiUI_ApplyModOptsMulti(cui PfUI, wikis []pf.PfWikiPage)
- type CSRFClaims
- type PfLink
- type PfLinkCol
- type PfLoginPage
- type PfNewUI
- type PfPage
- type PfRootUI
- type PfRootUIS
- type PfUI
- type PfUIFunc
- type PfUILoginI
- type PfUIMentry
- type PfUIMenu
- func (menu *PfUIMenu) Add(m ...PfUIMentry)
- func (menu *PfUIMenu) AddPerms(uri string, perms pf.Perm)
- func (menu *PfUIMenu) DelPerms(uri string, perms pf.Perm)
- func (menu *PfUIMenu) Filter(allowedURI []string)
- func (menu *PfUIMenu) Remove(uri string)
- func (menu *PfUIMenu) Replace(uri string, fun PfUIFunc)
- func (menu *PfUIMenu) SetPerms(uri string, perms pf.Perm)
- func (menu *PfUIMenu) ToLinkCol(cui PfUI, depth int) (links PfLinkCol)
- func (menu *PfUIMenu) ToLinkColPfx(cui PfUI, depth int, pfx string) (links PfLinkCol)
- type PfUIMenuI
- type PfUIS
- func (cui *PfUIS) AddCrumb(link string, desc string, long string)
- func (cui *PfUIS) AddHeader(h string, v string)
- func (cui *PfUIS) DelCrumb() (link string, desc string, long string)
- func (cui *PfUIS) Flush()
- func (cui *PfUIS) FormValue(key string) (val string, err error)
- func (cui *PfUIS) FormValueM(key string) (vals []string, err error)
- func (cui *PfUIS) FormValueNoCSRF(key string) (val string, err error)
- func (cui *PfUIS) GetArg(key string) (val string)
- func (cui *PfUIS) GetArgCSRF(key string) (val string)
- func (cui *PfUIS) GetBody() (body []byte)
- func (cui *PfUIS) GetCrumbParts() (path []string)
- func (cui *PfUIS) GetCrumbPath() (path string)
- func (cui *PfUIS) GetFormFile(key string, maxsize string, b64 bool) (val string, err error)
- func (cui *PfUIS) GetFormFileReader(key string) (file io.ReadCloser, filename string, err error)
- func (cui *PfUIS) GetFullPath() (path string)
- func (cui *PfUIS) GetFullURL() (path string)
- func (cui *PfUIS) GetHTTPHeader(name string) (val string)
- func (cui *PfUIS) GetHTTPHost() (host string)
- func (cui *PfUIS) GetMethod() (method string)
- func (cui *PfUIS) GetPath() (path []string)
- func (cui *PfUIS) GetPathString() (path string)
- func (cui *PfUIS) GetSubPath() (path string)
- func (cui *PfUIS) HandleCmd(cmd string, args []string) (msg string, err error)
- func (cui *PfUIS) HandleForm(cmd string, args []string, obj interface{}) (msg string, err error)
- func (cui *PfUIS) HandleFormS(cmd string, autoop bool, args []string, obj interface{}) (msg string, err error)
- func (cui *PfUIS) InitToken()
- func (cui *PfUIS) IsGET() (isget bool)
- func (cui *PfUIS) IsPOST() (ispost bool)
- func (cui *PfUIS) JSONAnswer(status string, message string)
- func (cui *PfUIS) MenuPath(menu PfUIMenu, path *[]string)
- func (cui *PfUIS) NoSubs() bool
- func (cui *PfUIS) OutUnbuffered(txt string)
- func (cui *PfUIS) Page_def() (p *PfPage)
- func (cui *PfUIS) Page_show(name string, data interface{})
- func (cui *PfUIS) ParseClientIP(remaddr string, xff string, xffc []*net.IPNet) (ip net.IP, addr string, err error)
- func (cui *PfUIS) QueryArgSet(q string) (ok bool)
- func (cui *PfUIS) SetBearerAuth(t bool)
- func (cui *PfUIS) SetClientIP() (err error)
- func (cui *PfUIS) SetContentType(ctype string)
- func (cui *PfUIS) SetExpired()
- func (cui *PfUIS) SetExpires(minutes int)
- func (cui *PfUIS) SetFileName(fname string)
- func (cui *PfUIS) SetHeader(h string, v string)
- func (cui *PfUIS) SetJSON(json []byte)
- func (cui *PfUIS) SetPageMenu(menu *PfUIMenu)
- func (cui *PfUIS) SetPath(path []string)
- func (cui *PfUIS) SetRaw(raw []byte)
- func (cui *PfUIS) SetRedirect(path string, status int)
- func (cui *PfUIS) SetStaticFile(file string)
- func (cui *PfUIS) SetSubPath(path string)
- func (cui *PfUIS) UIInit(w http.ResponseWriter, r *http.Request) (err error)
- func (cui *PfUIS) UIMainMenuOverride(menu *PfUIMenu)
- func (cui *PfUIS) UIMenu(menu PfUIMenu)
- func (cui *PfUIS) UISubMenuOverride(menu *PfUIMenu)
- type PfUIi
- type PfUserDetailForm
- type PfUserLanguageForm
- type TFATok
- type VerifiedEM
Constants ¶
const ( StatusMovedPermanently = http.StatusMovedPermanently /* 301 */ StatusFound = http.StatusFound /* 302 */ StatusSeeOther = http.StatusSeeOther /* 303 */ StatusBadRequest = http.StatusBadRequest /* 400 */ StatusForbidden = http.StatusForbidden /* 403 */ StatusNotFound = http.StatusNotFound /* 404*/ StatusInternalServerError = http.StatusInternalServerError /* 500 */ StatusNotImplemented = http.StatusNotImplemented /* 501 */ )
Aliases
const ( PERM_NOTHING = pf.PERM_NOTHING PERM_NONE = pf.PERM_NONE PERM_GUEST = pf.PERM_GUEST PERM_USER = pf.PERM_USER PERM_USER_SELF = pf.PERM_USER_SELF PERM_USER_NOMINATE = pf.PERM_USER_NOMINATE PERM_USER_VIEW = pf.PERM_USER_VIEW PERM_GROUP_MEMBER = pf.PERM_GROUP_MEMBER PERM_GROUP_ADMIN = pf.PERM_GROUP_ADMIN PERM_GROUP_WIKI = pf.PERM_GROUP_WIKI PERM_GROUP_FILE = pf.PERM_GROUP_FILE PERM_GROUP_CALENDAR = pf.PERM_GROUP_CALENDAR PERM_SYS_ADMIN = pf.PERM_SYS_ADMIN PERM_SYS_ADMIN_CAN = pf.PERM_SYS_ADMIN_CAN PERM_CLI = pf.PERM_CLI PERM_API = pf.PERM_API PERM_OAUTH = pf.PERM_OAUTH PERM_LOOPBACK = pf.PERM_LOOPBACK PERM_HIDDEN = pf.PERM_HIDDEN PERM_NOCRUMB = pf.PERM_NOCRUMB PERM_NOSUBS = pf.PERM_NOSUBS PERM_NOBODY = pf.PERM_NOBODY )
Keep in sync with lib/ctx
const CSRF_TOKENNAME = "pfCSRF"
const PFFORM_READONLY = "readonly"
Variables ¶
var ErrInvalidCSRF = errors.New("Invalid CSRF Token")
var ErrMissingValue = errors.New("Missing value")
var ErrNoRows = pf.ErrNoRows
Import this to avoid having to type too much
var ErrNotPOST = errors.New("Not a POST request")
Constants
Name of the cookies we set
Functions ¶
func Csrf_token ¶
func FileUIApplyModOpts ¶
func FileUIApplyModOptsM ¶
func H_NoAccess ¶
func H_NoAccess(cui PfUI)
func H_file_list_file ¶
func H_file_list_file(cui PfUI)
func H_group_member_profile ¶
func H_group_member_profile(cui PfUI)
func H_user_pwreset ¶
func H_user_pwreset(cui PfUI)
func LogAccess_start ¶
func LogAccess_start() (err error)
func LogAccess_stop ¶
func LogAccess_stop()
func WikiUI_ApplyModOpts ¶
func WikiUI_ApplyModOpts(cui PfUI, wiki *pf.PfWikiPage)
func WikiUI_ApplyModOptsMulti ¶
func WikiUI_ApplyModOptsMulti(cui PfUI, wikis []pf.PfWikiPage)
Types ¶
type CSRFClaims ¶
type PfLoginPage ¶
type PfLoginPage struct { *PfPage Login login }
type PfPage ¶
type PfPage struct { URL string Title string PageTitle string Menu PfLinkCol SubMenu PfLinkCol Crumbs PfLinkCol LogoImg string HeaderImg string AdminName string AdminEmail string AdminEmailPublic bool CopyYears string TheUser *pf.PfUser NoIndex bool CSS []string Javascript []string SysName string Version string PublicURL string PeopleDomain string RenderStamp string UI PfUI }
type PfRootUI ¶
type PfRootUI interface {
H_root(w http.ResponseWriter, r *http.Request)
}
func NewPfRootUI ¶
type PfRootUIS ¶
type PfRootUIS struct { PfRootUI // contains filtered or unexported fields }
type PfUILoginI ¶
type PfUILoginI func(cui PfUI, lp *PfLoginPage) (p interface{}, err error)
type PfUIMentry ¶
func NewPfUIMentry ¶
type PfUIMenu ¶
type PfUIMenu struct {
M []PfUIMentry
}
func (*PfUIMenu) Add ¶
func (menu *PfUIMenu) Add(m ...PfUIMentry)
Add a menu item (to the end of the menu)
type PfUIS ¶
type PfUIS struct { pf.PfCtx /* Pitchfork Context (not really embedded, a pointer) */ // contains filtered or unexported fields }
func (*PfUIS) FormValue ¶
* Gets argument from POST values only - mandatory CSRF check * The function to use for single items
func (*PfUIS) FormValueM ¶
* Gets argument from POST values only - mandatory CSRF check * The function to use for multiple returns (eg a map)
func (*PfUIS) FormValueNoCSRF ¶
* Gets argument from POST values only - skip CSRF check * * *AVOID* using this as much as possible: only when known that an * outside thing might do a direct POST. * * Currently that is only the Oauth2 code.
func (*PfUIS) GetCrumbParts ¶
func (*PfUIS) GetCrumbPath ¶
func (*PfUIS) GetFormFile ¶
Returns a base64 encoded representation of a file
func (*PfUIS) GetFormFileReader ¶
func (*PfUIS) GetFullPath ¶
func (*PfUIS) GetFullURL ¶
func (*PfUIS) GetHTTPHeader ¶
func (*PfUIS) GetHTTPHost ¶
func (*PfUIS) GetPathString ¶
func (*PfUIS) GetSubPath ¶
func (*PfUIS) HandleCmd ¶
* Command handler - directly call a command with arguments * * Use this for form posts with specific parameters * The parameters are matched to the command
func (*PfUIS) HandleForm ¶
* Form handler - called for form submissions * * Use this in combination with 'object set <form-element> <value>' style commands * For each matching form-element (name) the command is executed
func (*PfUIS) HandleFormS ¶
func (cui *PfUIS) HandleFormS(cmd string, autoop bool, args []string, obj interface{}) (msg string, err error)
* When autoop is false, the operand is already in the 'cmd'. * * When autoop is true, we determine the op based on the 'submit' button. * When 'submit' is 'Add'/'Remove' the op becomes that and in lowercase * appended to the cmd. * * When autoop is true, we ignore slices unless the op is add or remove.
func (*PfUIS) JSONAnswer ¶
func (*PfUIS) OutUnbuffered ¶
func (*PfUIS) ParseClientIP ¶
func (cui *PfUIS) ParseClientIP(remaddr string, xff string, xffc []*net.IPNet) (ip net.IP, addr string, err error)
* Note: addr will always contain the full XFF * as received, but only the right hand side will be valid * we do not discard the components that are untrusted * as they might have forensic value * * The 'ip' returned is the trusted value though
func (*PfUIS) QueryArgSet ¶
func (*PfUIS) SetBearerAuth ¶
func (*PfUIS) SetClientIP ¶
func (*PfUIS) SetContentType ¶
func (*PfUIS) SetExpired ¶
func (cui *PfUIS) SetExpired()
func (*PfUIS) SetExpires ¶
func (*PfUIS) SetFileName ¶
func (*PfUIS) SetPageMenu ¶
func (*PfUIS) SetRedirect ¶
func (*PfUIS) SetStaticFile ¶
func (*PfUIS) SetSubPath ¶
func (*PfUIS) UIMainMenuOverride ¶
func (*PfUIS) UISubMenuOverride ¶
type PfUIi ¶
type PfUIi interface { UIInit(w http.ResponseWriter, r *http.Request) (err error) FormValue(key string) (val string, err error) FormValueM(key string) (vals []string, err error) FormValueNoCSRF(key string) (val string, err error) GetMethod() (method string) IsGET() (isget bool) IsPOST() (ispost bool) GetHTTPHost() string GetHTTPHeader(name string) (val string) GetPath() (path []string) GetPathString() (path string) SetPath(path []string) GetSubPath() (path string) SetSubPath(path string) GetFullPath() (path string) GetFullURL() (path string) GetArg(key string) (val string) GetArgCSRF(key string) (val string) ParseClientIP(remaddr string, xff string, xffc []*net.IPNet) (ip net.IP, addr string, err error) NoSubs() bool SetClientIP() (err error) SetBearerAuth(t bool) AddHeader(h string, v string) SetHeader(h string, v string) Flush() SetExpired() SetExpires(minutes int) SetContentType(ctype string) SetFileName(fname string) SetStaticFile(file string) SetRaw(raw []byte) SetJSON(json []byte) JSONAnswer(status string, message string) AddCrumb(link string, desc string, long string) DelCrumb() (link string, desc string, long string) GetCrumbPath() (path string) GetCrumbParts() (path []string) Page_def() (p *PfPage) Page_show(name string, data interface{}) SetRedirect(path string, status int) GetBody() (body []byte) GetFormFileReader(key string) (file io.ReadCloser, filename string, err error) GetFormFile(key string, maxsize string, b64 bool) (val string, err error) QueryArgSet(q string) (ok bool) HandleForm(cmd string, args []string, obj interface{}) (msg string, err error) HandleFormS(cmd string, autoop bool, args []string, obj interface{}) (msg string, err error) HandleCmd(cmd string, args []string) (msg string, err error) SetPageMenu(menu *PfUIMenu) MenuPath(menu PfUIMenu, path *[]string) UIMenu(menu PfUIMenu) InitToken() // contains filtered or unexported methods }
type PfUserDetailForm ¶
type PfUserDetailForm struct { Type string `label:"Detail Type" pfreq:"yes" hint:"Select the detail you would like to set" options:"GetTypeOpts"` Value string `label:"Value" pfreq:"yes" hint:"Value of the detail"` Button string `label:"Add Detail" pftype:"submit"` }
func NewPfUserDetailForm ¶
func NewPfUserDetailForm() (df *PfUserDetailForm)
func (*PfUserDetailForm) GetTypeOpts ¶
func (df *PfUserDetailForm) GetTypeOpts(obj interface{}) (kvs keyval.KeyVals, err error)
type PfUserLanguageForm ¶
type PfUserLanguageForm struct { Language string `label:"Language" pfreq:"yes" hint:"Select the language to add" options:"GetLanguageOpts"` Skill string `label:"Skill Level" pfreq:"yes" hint:"Select the appropriate skill level" options:"GetSkillOpts"` Button string `label:"Add Language" pftype:"submit"` }
func NewPfUserLanguageForm ¶
func NewPfUserLanguageForm() (lf *PfUserLanguageForm)
func (*PfUserLanguageForm) GetLanguageOpts ¶
func (lf *PfUserLanguageForm) GetLanguageOpts(obj interface{}) (kvs keyval.KeyVals, err error)
func (*PfUserLanguageForm) GetSkillOpts ¶
func (n *PfUserLanguageForm) GetSkillOpts(obj interface{}) (kvs keyval.KeyVals, err error)
type TFATok ¶
type TFATok struct { CurPassword string `label:"Current Password" pfreq:"yes" hint:"Your current password" pftype:"password"` Descr string `label:"Description" pfreq:"yes" hint:"iPhone, Android etc."` Type string `label:"OTP Type" pfreq:"yes" hint:"The Two Factor Token Type" options:"GetTypeOpts"` Button string `label:"Create" pftype:"submit"` // contains filtered or unexported fields }
func (*TFATok) GetTypeOpts ¶
func (*TFATok) ObjectContext ¶
func (tok *TFATok) ObjectContext() (obj interface{})
type VerifiedEM ¶
type VerifiedEM struct { Action string `label:"set" pftype:"hidden"` EmailAddr string `label:"Email Address" pfreq:"yes" pfset:"user" hint:"Select the address to use for this group" options:"GetEmailOpts"` GroupName string `label:"groupname" pftype:"hidden"` GroupDesc string `label:"groupdesc" pftype:"hidden"` GroupState string `label:"groupstate" pftype:"hidden"` Button string `label:"Select Address" pftype:"submit"` // contains filtered or unexported fields }
func (VerifiedEM) GetEmailOpts ¶
func (vem VerifiedEM) GetEmailOpts(obj interface{}) (kvs keyval.KeyVals, err error)
func (VerifiedEM) ObjectContext ¶
func (vem VerifiedEM) ObjectContext() (obj interface{})