admin

package
v0.1.1-0...-f9b01a3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorWrongInput is for corrupted request data.
	ErrorWrongInput = Error("Wrong input data")
	// ErrorRequestInvalidCookie is for invalid cookie.
	ErrorRequestInvalidCookie = Error("Invalid cookie")
	// ErrorInternalError is for internal errors.
	ErrorInternalError = Error("Internal error")
	// ErrorIncorrectLogin is for incorrect login and password.
	ErrorIncorrectLogin = Error("Incorrect login information")
	// ErrorNotAuthorized is for non-authorized access intents.
	ErrorNotAuthorized = Error("Not authorized")
)

Variables

This section is empty.

Functions

func CorsOption

func CorsOption(corsOptions *model.CorsOptions) func(*Router) error

CorsOption sets cors option.

func HostOption

func HostOption(host string) func(*Router) error

HostOption sets host value.

func NewRouter

NewRouter creates and initializes new admin router.

func PathPrefixOptions

func PathPrefixOptions(prefix string) func(r *Router) error

PathPrefixOptions sets path prefix options.

func RedirectURLOption

func RedirectURLOption(redirectURL string) func(*Router) error

RedirectURLOption sets redirect url value.

func ServerConfigPathOption

func ServerConfigPathOption(configPath string) func(*Router) error

ServerConfigPathOption sets path to configuration file with admin server settings.

func ServerSettingsOption

func ServerSettingsOption(settings *model.ServerSettings) func(*Router) error

ServerSettingsOption sets path to configuration file with server settings.

Types

type Error

type Error string

Error is an http level error type.

func (Error) Error

func (e Error) Error() string

Error is an implementation of std.Error interface.

type Router

type Router struct {
	ServerConfigPath string
	ServerSettings   *model.ServerSettings

	RedirectURL string
	PathPrefix  string
	Host        string
	// contains filtered or unexported fields
}

Router is a router that handles admin requests.

func (*Router) CreateApp

func (ar *Router) CreateApp() http.HandlerFunc

CreateApp adds new app to the database.

func (*Router) CreateUser

func (ar *Router) CreateUser() http.HandlerFunc

CreateUser registers new user.

func (*Router) DeleteApp

func (ar *Router) DeleteApp() http.HandlerFunc

DeleteApp deletes app from the database by id.

func (*Router) DeleteUser

func (ar *Router) DeleteUser() http.HandlerFunc

DeleteUser deletes user from the database.

func (*Router) Error

func (ar *Router) Error(w http.ResponseWriter, err error, code int, userInfo string)

Error writes an API error message to the response and logger.

func (*Router) FetchAccountSettings

func (ar *Router) FetchAccountSettings() http.HandlerFunc

FetchAccountSettings returns admin account settings.

func (*Router) FetchApps

func (ar *Router) FetchApps() http.HandlerFunc

FetchApps fetches apps from the database.

func (*Router) FetchConfigurationStorageSettings

func (ar *Router) FetchConfigurationStorageSettings() http.HandlerFunc

FetchConfigurationStorageSettings fetches configuration storage settings.

func (*Router) FetchExternalServicesSettings

func (ar *Router) FetchExternalServicesSettings() http.HandlerFunc

FetchExternalServicesSettings fetches settings for external services.

func (*Router) FetchGeneralSettings

func (ar *Router) FetchGeneralSettings() http.HandlerFunc

FetchGeneralSettings fetches server's general settings.

func (*Router) FetchLoginSettings

func (ar *Router) FetchLoginSettings() http.HandlerFunc

FetchLoginSettings fetches app's login settings.

func (*Router) FetchServerSettings

func (ar *Router) FetchServerSettings() http.HandlerFunc

FetchServerSettings returns server settings.

func (*Router) FetchSessionStorageSettings

func (ar *Router) FetchSessionStorageSettings() http.HandlerFunc

FetchSessionStorageSettings fetches session storage settings.

func (*Router) FetchStaticFilesStorageSettings

func (ar *Router) FetchStaticFilesStorageSettings() http.HandlerFunc

FetchStaticFilesStorageSettings fetches static files settings.

func (*Router) FetchStorageSettings

func (ar *Router) FetchStorageSettings() http.HandlerFunc

FetchStorageSettings fetches server's general settings.

func (*Router) FetchUsers

func (ar *Router) FetchUsers() http.HandlerFunc

FetchUsers fetches users from the database.

func (*Router) GetApp

func (ar *Router) GetApp() http.HandlerFunc

GetApp fetches app by ID from the database.

func (*Router) GetStringifiedFile

func (ar *Router) GetStringifiedFile() http.HandlerFunc

GetStringifiedFile fetches static file from the static files storage, and returns its string representation.

func (*Router) GetUser

func (ar *Router) GetUser() http.HandlerFunc

GetUser fetches user by ID from the database.

func (*Router) IsLoggedIn

func (ar *Router) IsLoggedIn() http.HandlerFunc

IsLoggedIn checks if admin is logged in.

func (*Router) Login

func (ar *Router) Login() http.HandlerFunc

Login logins admin with admin name and password.

func (*Router) Logout

func (ar *Router) Logout() http.HandlerFunc

Logout logs admin out.

func (*Router) RestartServer

func (ar *Router) RestartServer() http.HandlerFunc

RestartServer restarts server with new settings.

func (*Router) ServeHTTP

func (ar *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements identifo.Router interface.

func (*Router) ServeJSON

func (ar *Router) ServeJSON(w http.ResponseWriter, code int, v interface{})

ServeJSON sends status code, headers and data back to the user.

func (*Router) Session

func (ar *Router) Session() negroni.HandlerFunc

Session is a middleware to check if admin is logged in with valid cookie. If all checks succeeded, prolongs existing session. If not, forces to login.

func (*Router) TestDatabaseConnection

func (ar *Router) TestDatabaseConnection() http.HandlerFunc

TestDatabaseConnection tests database connection.

func (*Router) UpdateAccountSettings

func (ar *Router) UpdateAccountSettings() http.HandlerFunc

UpdateAccountSettings updates admin account settings.

func (*Router) UpdateApp

func (ar *Router) UpdateApp() http.HandlerFunc

UpdateApp updates app in the database.

func (*Router) UpdateConfigurationStorageSettings

func (ar *Router) UpdateConfigurationStorageSettings() http.HandlerFunc

UpdateConfigurationStorageSettings changes storage connection settings.

func (*Router) UpdateExternalServicesSettings

func (ar *Router) UpdateExternalServicesSettings() http.HandlerFunc

UpdateExternalServicesSettings changes settings for external services.

func (*Router) UpdateGeneralSettings

func (ar *Router) UpdateGeneralSettings() http.HandlerFunc

UpdateGeneralSettings changes server's general settings.

func (*Router) UpdateLoginSettings

func (ar *Router) UpdateLoginSettings() http.HandlerFunc

UpdateLoginSettings changes app's login settings.

func (*Router) UpdateSessionStorageSettings

func (ar *Router) UpdateSessionStorageSettings() http.HandlerFunc

UpdateSessionStorageSettings changes admin session storage connection settings.

func (*Router) UpdateStaticFilesStorageSettings

func (ar *Router) UpdateStaticFilesStorageSettings() http.HandlerFunc

UpdateStaticFilesStorageSettings changes static files settings.

func (*Router) UpdateStorageSettings

func (ar *Router) UpdateStorageSettings() http.HandlerFunc

UpdateStorageSettings changes storage connection settings.

func (*Router) UpdateUser

func (ar *Router) UpdateUser() http.HandlerFunc

UpdateUser updates user in the database.

func (*Router) UploadADDAFile

func (ar *Router) UploadADDAFile() http.HandlerFunc

UploadADDAFile is for uploading Apple Developer Domain Association File.

func (*Router) UploadJWTKeys

func (ar *Router) UploadJWTKeys() http.HandlerFunc

UploadJWTKeys is for uploading public and private keys used for signing JWTs.

func (*Router) UploadStringifiedFile

func (ar *Router) UploadStringifiedFile() http.HandlerFunc

UploadStringifiedFile uploads stringified static file to the storage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL