biz

package
v10.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Login

type Login struct {
	Cache       cachex.Cacher
	Auth        jwtx.Auther
	UserDAL     *dal.User
	UserRoleDAL *dal.UserRole
	MenuDAL     *dal.Menu
	UserBIZ     *User
}

Login management for RBAC

func (*Login) GetCaptcha

func (a *Login) GetCaptcha(ctx context.Context) (*schema.Captcha, error)

This function generates a new captcha ID and returns it as a `schema.Captcha` struct. The length of the captcha is determined by the `config.C.Util.Captcha.Length` configuration value.

func (*Login) GetUserInfo

func (a *Login) GetUserInfo(ctx context.Context) (*schema.User, error)

Get user info

func (*Login) Login

func (a *Login) Login(ctx context.Context, formItem *schema.LoginForm) (*schema.LoginToken, error)

func (*Login) Logout

func (a *Login) Logout(ctx context.Context) error

func (*Login) ParseUserID

func (a *Login) ParseUserID(c *gin.Context) (string, error)

func (*Login) QueryMenus

func (a *Login) QueryMenus(ctx context.Context) (schema.Menus, error)

Query menus based on user permissions

func (*Login) RefreshToken

func (a *Login) RefreshToken(ctx context.Context) (*schema.LoginToken, error)

func (*Login) ResponseCaptcha

func (a *Login) ResponseCaptcha(ctx context.Context, w http.ResponseWriter, id string, reload bool) error

Response captcha image

func (*Login) UpdatePassword

func (a *Login) UpdatePassword(ctx context.Context, updateItem *schema.UpdateLoginPassword) error

Change login password

func (*Login) UpdateUser

func (a *Login) UpdateUser(ctx context.Context, updateItem *schema.UpdateCurrentUser) error

Update current user info

type Menu struct {
	Trans           *util.Trans
	MenuDAL         *dal.Menu
	MenuResourceDAL *dal.MenuResource
	RoleMenuDAL     *dal.RoleMenu
}

Menu management for RBAC

func (a *Menu) Create(ctx context.Context, formItem *schema.MenuForm) (*schema.Menu, error)

Create a new menu in the data access object.

func (a *Menu) Delete(ctx context.Context, id string) error

Delete the specified menu from the data access object.

func (a *Menu) Get(ctx context.Context, id string) (*schema.Menu, error)

Get the specified menu from the data access object.

func (a *Menu) InitFromFile(ctx context.Context, menuFile string) error

Query menus from the data access object based on the provided parameters and options.

func (a *Menu) Update(ctx context.Context, id string, formItem *schema.MenuForm) error

Update the specified menu in the data access object.

type Role

type Role struct {
	Cache       cachex.Cacher
	Trans       *util.Trans
	RoleDAL     *dal.Role
	RoleMenuDAL *dal.RoleMenu
	UserRoleDAL *dal.UserRole
}

Role management for RBAC

func (*Role) Create

func (a *Role) Create(ctx context.Context, formItem *schema.RoleForm) (*schema.Role, error)

Create a new role in the data access object.

func (*Role) Delete

func (a *Role) Delete(ctx context.Context, id string) error

Delete the specified role from the data access object.

func (*Role) Get

func (a *Role) Get(ctx context.Context, id string) (*schema.Role, error)

Get the specified role from the data access object.

func (*Role) Query

Query roles from the data access object based on the provided parameters and options.

func (*Role) Update

func (a *Role) Update(ctx context.Context, id string, formItem *schema.RoleForm) error

Update the specified role in the data access object.

type User

type User struct {
	Cache       cachex.Cacher
	Trans       *util.Trans
	UserDAL     *dal.User
	UserRoleDAL *dal.UserRole
}

User management for RBAC

func (*User) Create

func (a *User) Create(ctx context.Context, formItem *schema.UserForm) (*schema.User, error)

Create a new user in the data access object.

func (*User) Delete

func (a *User) Delete(ctx context.Context, id string) error

Delete the specified user from the data access object.

func (*User) Get

func (a *User) Get(ctx context.Context, id string) (*schema.User, error)

Get the specified user from the data access object.

func (*User) GetRoleIDs

func (a *User) GetRoleIDs(ctx context.Context, id string) ([]string, error)

func (*User) Query

Query users from the data access object based on the provided parameters and options.

func (*User) ResetPassword

func (a *User) ResetPassword(ctx context.Context, id string) error

func (*User) Update

func (a *User) Update(ctx context.Context, id string, formItem *schema.UserForm) error

Update the specified user in the data access object.

Jump to

Keyboard shortcuts

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