Documentation ¶
Index ¶
- func DBUserToDetailedUser(dbUser user.User, store *user.Store) user.DetailedUser
- func DBUsersToUsersTemplateFormat(dbUsers []user.User) []user.StrippedUser
- type Config
- type Context
- type InternalContext
- type InternalTemplate
- type JWTClaims
- type ManageAPITemplate
- type Notification
- type PermissionTemplate
- type PermissionsTemplate
- type RoleTemplate
- type RolesTemplate
- type SMTPConfig
- type SecurityConfig
- type SettingsTemplate
- type Sort
- type TemplateHelper
- type UserSignup
- type UserTemplate
- type UsersTemplate
- type Views
- func (v *Views) AssumeUserFunc(c echo.Context) error
- func (v *Views) ChangePasswordFunc(c echo.Context) error
- func (v *Views) CustomHTTPErrorHandler(err error, c echo.Context)
- func (v *Views) Error404(c echo.Context) error
- func (v *Views) ForgotFunc(c echo.Context) error
- func (v *Views) IndexFunc(c echo.Context) error
- func (v *Views) InternalFunc(c echo.Context) error
- func (v *Views) LoginFunc(c echo.Context) error
- func (v *Views) LogoutFunc(c echo.Context) error
- func (v *Views) ManageAPIFunc(c echo.Context) error
- func (v *Views) PermissionAddFunc(c echo.Context) error
- func (v *Views) PermissionDeleteFunc(c echo.Context) error
- func (v *Views) PermissionEditFunc(c echo.Context) error
- func (v *Views) PermissionFunc(c echo.Context) error
- func (v *Views) PermissionsFunc(c echo.Context) error
- func (v *Views) ReleaseUserFunc(c echo.Context) error
- func (v *Views) RequirePermission(p permissions.Permissions) echo.MiddlewareFunc
- func (v *Views) RequiresLogin(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) RequiresLoginJSON(next echo.HandlerFunc) echo.HandlerFunc
- func (v *Views) ResetURLFunc(c echo.Context) error
- func (v *Views) ResetUserPasswordFunc(c echo.Context) error
- func (v *Views) RoleAddFunc(c echo.Context) error
- func (v *Views) RoleAddPermissionFunc(c echo.Context) error
- func (v *Views) RoleAddUserFunc(c echo.Context) error
- func (v *Views) RoleDeleteFunc(c echo.Context) error
- func (v *Views) RoleEditFunc(c echo.Context) error
- func (v *Views) RoleFunc(c echo.Context) error
- func (v *Views) RoleRemovePermissionFunc(c echo.Context) error
- func (v *Views) RoleRemoveUserFunc(c echo.Context) error
- func (v *Views) RolesFunc(c echo.Context) error
- func (v *Views) SetTokenHandler(c echo.Context) error
- func (v *Views) SettingsFunc(c echo.Context) error
- func (v *Views) SignUpFunc(c echo.Context) error
- func (v *Views) TestAPITokenFunc(c echo.Context) error
- func (v *Views) TokenAddFunc(c echo.Context) error
- func (v *Views) TokenDeleteFunc(c echo.Context) error
- func (v *Views) UserAddFunc(c echo.Context) error
- func (v *Views) UserDeleteFunc(c echo.Context) error
- func (v *Views) UserEditFunc(c echo.Context) error
- func (v *Views) UserFunc(c echo.Context) error
- func (v *Views) UserToggleEnabledFunc(c echo.Context) error
- func (v *Views) UsersFunc(c echo.Context) error
- func (v *Views) ValidateToken(token string) (bool, *JWTClaims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DBUserToDetailedUser ¶ added in v0.7.1
DBUserToDetailedUser handles all the little details for the users front end
func DBUsersToUsersTemplateFormat ¶ added in v0.7.1
func DBUsersToUsersTemplateFormat(dbUsers []user.User) []user.StrippedUser
DBUsersToUsersTemplateFormat converts from the DB layer type to the user template type
Types ¶
type Config ¶
type Config struct { Version string Debug bool Address string DatabaseURL string BaseDomainName string DomainName string LogoutEndpoint string SessionCookieName string Mail SMTPConfig Security SecurityConfig }
Config the global web-auth configuration
type Context ¶
type Context struct { // TitleText is used for sending pages to the user with custom titles TitleText string // Message is used for sending a message back to the user trying to log in, might decide to move later as it may not be needed Message string // MsgType is the bulma.io class used to indicate what should be displayed MsgType string // Callback is the address to redirect the user to Callback string // User is the stored logged-in user User user.User // Version is the version that is running Version string Assumed bool // contains filtered or unexported fields }
Context is a struct that is applied to the templates.
type InternalContext ¶ added in v0.7.1
type InternalTemplate ¶
type InternalTemplate struct { UserID int Nickname string LastLogin string CountAll user.CountUsers TemplateHelper }
InternalTemplate represents the context for the internal template
type JWTClaims ¶
type JWTClaims struct { UserID int `json:"id"` Permissions []string `json:"perms"` jwt.RegisteredClaims }
JWTClaims represents basic identifiable/useful claims
type ManageAPITemplate ¶ added in v0.7.1
type ManageAPITemplate struct { Tokens []api.Token AddedJWT string TemplateHelper }
ManageAPITemplate returns the data to the front end
type Notification ¶ added in v0.7.1
Notification template for messages
type PermissionTemplate ¶ added in v0.7.1
type PermissionTemplate struct { Permission user.PermissionTemplate TemplateHelper }
PermissionTemplate is for the permission front end
type PermissionsTemplate ¶ added in v0.7.1
type PermissionsTemplate struct { Permissions []permission.Permission TemplateHelper }
PermissionsTemplate is for the permissions front end
type RoleTemplate ¶ added in v0.7.1
type RoleTemplate struct { Role user.RoleTemplate PermissionsNotInRole []permission.Permission UsersNotInRole []user.User TemplateHelper }
RoleTemplate is for the role front end
type RolesTemplate ¶ added in v0.7.1
type RolesTemplate struct { Roles []role.Role TemplateHelper }
RolesTemplate is for the roles front end
type SMTPConfig ¶
SMTPConfig stores the SMTP Mailer configuration
type SecurityConfig ¶
SecurityConfig stores the security configuration
type SettingsTemplate ¶ added in v0.7.1
type SettingsTemplate struct { User user.User LastLogin string Gravatar string TemplateHelper }
SettingsTemplate is for the settings front end
type Sort ¶ added in v0.7.1
type Sort struct { Pages int Size int PageNumber int Column string Direction string Search string Enabled string Deleted string }
Sort is the parameters for how to sort a users request
type TemplateHelper ¶ added in v0.7.1
type TemplateHelper struct { UserPermissions []permission.Permission ActivePage string Assumed bool }
type UserSignup ¶
type UserSignup struct { Firstname string `db:"first_name" schema:"firstname" validate:"required,gte=3"` Lastname string `db:"last_name" schema:"lastname" validate:"required,gte=3"` Email string `db:"email" schema:"email" validate:"required,email"` Password string `db:"password" schema:"password" validate:"required,gte=8"` ConfirmPassword string `schema:"confirmpassword" validate:"required,eqfield=Password,gte=8"` }
UserSignup represents the HTML form
type UserTemplate ¶ added in v0.7.1
type UserTemplate struct { User user.DetailedUser TemplateHelper }
UserTemplate is for the user front end
type UsersTemplate ¶
type UsersTemplate struct { Users []user.StrippedUser CurPage int NextPage int PrevPage int LastPage int Sort Sort TemplateHelper }
UsersTemplate represents the context for the user template
type Views ¶
Views encapsulates our view dependencies
func (*Views) AssumeUserFunc ¶ added in v0.7.1
func (*Views) ChangePasswordFunc ¶ added in v0.7.1
ChangePasswordFunc handles the password change from a user
func (*Views) CustomHTTPErrorHandler ¶ added in v0.7.1
func (*Views) ForgotFunc ¶
ForgotFunc handles sending a reset email
func (*Views) InternalFunc ¶
InternalFunc handles a request to the internal template
func (*Views) LoginFunc ¶
LoginFunc implements the login functionality, will add a cookie to the cookie store for managing authentication
func (*Views) LogoutFunc ¶
LogoutFunc Implements the logout functionality. Will delete the session information from the cookie store
func (*Views) ManageAPIFunc ¶ added in v0.7.1
ManageAPIFunc is the main home page for API management
func (*Views) PermissionAddFunc ¶ added in v0.7.1
PermissionAddFunc handles an add permission request
func (*Views) PermissionDeleteFunc ¶ added in v0.7.1
PermissionDeleteFunc handles a delete permission request
func (*Views) PermissionEditFunc ¶ added in v0.7.1
PermissionEditFunc handles an edit permission request
func (*Views) PermissionFunc ¶ added in v0.7.1
PermissionFunc handles a permission request
func (*Views) PermissionsFunc ¶ added in v0.7.1
PermissionsFunc handles a permissions request
func (*Views) ReleaseUserFunc ¶ added in v0.7.1
func (*Views) RequirePermission ¶ added in v0.7.1
func (v *Views) RequirePermission(p permissions.Permissions) echo.MiddlewareFunc
func (*Views) RequiresLogin ¶
func (v *Views) RequiresLogin(next echo.HandlerFunc) echo.HandlerFunc
RequiresLogin is a middleware which will be used for each httpHandler to check if there is any active session
func (*Views) RequiresLoginJSON ¶ added in v0.7.1
func (v *Views) RequiresLoginJSON(next echo.HandlerFunc) echo.HandlerFunc
RequiresLoginJSON is a middleware which is used for each httpHandler to check if there is any active session and returns json if not
func (*Views) ResetURLFunc ¶ added in v0.7.1
func (*Views) ResetUserPasswordFunc ¶ added in v0.7.1
func (*Views) RoleAddFunc ¶ added in v0.7.1
RoleAddFunc handles a role add request
func (*Views) RoleAddPermissionFunc ¶ added in v0.7.1
RoleAddPermissionFunc handles a rolePermission add request
func (*Views) RoleAddUserFunc ¶ added in v0.7.1
RoleAddUserFunc handles a roleUser add request
func (*Views) RoleDeleteFunc ¶ added in v0.7.1
RoleDeleteFunc handles a role delete request
func (*Views) RoleEditFunc ¶ added in v0.7.1
RoleEditFunc handles a role edit request
func (*Views) RoleRemovePermissionFunc ¶ added in v0.7.1
RoleRemovePermissionFunc handles a rolePermission remove request
func (*Views) RoleRemoveUserFunc ¶ added in v0.7.1
RoleRemoveUserFunc handles a roleUser remove request
func (*Views) SetTokenHandler ¶
SetTokenHandler sets a valid JWT in a cookie instead of returning a string
func (*Views) SettingsFunc ¶ added in v0.7.1
SettingsFunc handles a request to the internal template
func (*Views) SignUpFunc ¶
SignUpFunc will enable new users to sign up to our service
func (*Views) TestAPITokenFunc ¶ added in v0.7.1
TestAPITokenFunc returns a JSON object if the JWT in the Authorization header is valid.
func (*Views) TokenAddFunc ¶ added in v0.7.1
TokenAddFunc adds a token to be used by the user
func (*Views) TokenDeleteFunc ¶ added in v0.7.1
TokenDeleteFunc deletes a token
func (*Views) UserAddFunc ¶ added in v0.7.1
UserAddFunc handles an add user request
func (*Views) UserDeleteFunc ¶ added in v0.7.1
UserDeleteFunc handles an delete user request
func (*Views) UserEditFunc ¶ added in v0.7.1
UserEditFunc handles an edit user request
func (*Views) UserToggleEnabledFunc ¶ added in v0.7.1
UserToggleEnabledFunc handles an toggle enable user request