account

package module
v0.0.0-...-8f634b9 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 13 Imported by: 0

README

plugins

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PluginConfig = jax.Plugin{
	Routes: Routes,
	ModelActions: map[string]any{
		"user": repository.User,
	},
	Commands: []*command.Command{
		&commands.CreateSuper,
	},
}
View Source
var Routes = []jax.Route{

	jax.Route{
		Path:    "/signup",
		Handler: handlers.Signup,
		Method:  http.MethodPost,
		Name:    "signup",
	},

	jax.Route{
		Path:    "/login",
		Handler: handlers.Login,
		Method:  http.MethodPost,
		Name:    "login",
	},

	jax.Route{
		Path: "/profile",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.Profile, "user-can_update_own"),
		),
		Method: http.MethodGet,
		Name:   "profile",
	},

	jax.Route{
		Prefix: "/group",
		Path:   "/create",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.CreateGroup, "group-can_create"),
		),
		Method: http.MethodPost,
		Name:   "create-group",
	},

	jax.Route{
		Prefix: "/group",
		Path:   "/update",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.UpdateGroup, "group-can_update"),
		),
		Method: http.MethodPut,
		Name:   "update-group",
	},

	jax.Route{
		Prefix: "/group",
		Path:   "/list",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.ListGroups, "group-can_view"),
		),
		Method: http.MethodGet,
		Name:   "list-groups",
	},

	jax.Route{
		Prefix: "/group",
		Path:   "/paginate",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.PaginateGroups, "group-can_view"),
		),
		Method: http.MethodGet,
		Name:   "paginate-groups",
	},

	jax.Route{
		Prefix: "/group",
		Path:   "/get/{name}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.GetGroup, "group-can_view"),
		),
		Method: http.MethodGet,
		Name:   "get-group",
	},
	jax.Route{
		Prefix: "/group",
		Path:   "/delete/{id}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.DeleteGroup, "group-can_delete"),
		),
		Method: http.MethodDelete,
		Name:   "delete-group",
	},

	jax.Route{
		Prefix: "/group",
		Path:   "/user/add",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.AddUserToGroup, "group-can_edit"),
		),
		Method: http.MethodPost,
		Name:   "add-user-to-group",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/create",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.CreatePermission, "permission-can_create"),
		),
		Method: http.MethodPost,
		Name:   "create-permission",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/update/{id}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.UpdatePermission, "permission-can_edit"),
		),
		Method: http.MethodPut,
		Name:   "update-permission",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/list",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.ListPermission, "permission-can_view"),
		),
		Method: http.MethodGet,
		Name:   "list-permissions",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/get/{id}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.GetPermission, "permission-can_view"),
		),
		Method: http.MethodGet,
		Name:   "get-permission",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/delete/{id}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.DeletePermission, "permission-can_delete"),
		),
		Method: http.MethodDelete,
		Name:   "delete-permission",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/group/add",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.AddPermissionsToGroup, "permission-can_edit"),
		),
		Method: http.MethodPost,
		Name:   "add-permission-to-group",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/group/remove",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.RemoveGroupPermisions, "permission-can_edit"),
		),
		Method: http.MethodPost,
		Name:   "remove-group-permission",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/group/{id}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.GetGroupPermissions, "permission-can_view"),
		),
		Method: http.MethodGet,
		Name:   "get-group-permissions",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/user/add",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.AddPermissionsToUser, "permission-can_edit"),
		),
		Method: http.MethodPost,
		Name:   "add-permissions-to-user",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/user/{id}",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.GetUserPermissions, "permission-can_view"),
		),
		Method: http.MethodGet,
		Name:   "get-user-permissions",
	},

	jax.Route{
		Prefix: "/permission",
		Path:   "/user/remove",
		Handler: auth.Protected(
			decorators.HasPermission(handlers.RemoveUserPermisions, "permission-can_edit"),
		),
		Method: http.MethodPost,
		Name:   "remove-user-permissions",
	},
}

Functions

func Plugin

func Plugin(config *AccountConfig) jax.Plugin

func SetDefaultEmailNotifierParameters

func SetDefaultEmailNotifierParameters(default_config *DefaultSmtpConfig)

func SetNotifier

func SetNotifier(notifierList map[string]notification.Notifier)

func SetRepositories

func SetRepositories(database_connection db.DBTX)

func SetSecretKet

func SetSecretKet(secret string)

Types

type AccountConfig

type AccountConfig struct {
	SecretKey          string
	DatabaseConnection db.DBTX
	Notifiers          map[string]notification.Notifier
	DefaultSmtpConfig  *DefaultSmtpConfig
}

type DefaultSmtpConfig

type DefaultSmtpConfig struct {
	EmailSender   string
	UserName      string
	Password      string
	Host          string
	ServerAddress string
}

Jump to

Keyboard shortcuts

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