Identity and permissions

Roles and the permission model

One permission table carries directories, menus, buttons and endpoints; multi-role RBAC; annotations are the single source of truth.

The model

One permission table carries four kinds of node — directory / menu / button / endpoint — and users relate to roles many-to-many. A button and the endpoint behind it share the same permission code, with no mapping configuration in between.

TableRole
sys_useruser master table, the root of the permission system
sys_roleroles
sys_user_rolemany-to-many relation between users and roles
sys_permissionpermission-code contract layer: buttons and endpoints
sys_role_permissiongrants between roles and permission codes
sys_menupresentation layer: visibility and order of directories and menus
sys_user_identitythird-party identities (WeChat unionid/openid, QQ openid)

Tip: permission codes are the contract layer; menus are only the presentation layer. Visibility is decided by permission codes; menus decide where it sits and in what order.

Authorization

  • @SaCheckPermission on the server is the single source of truth; the front end only shows and hides, it never decides permissions.
  • Deny by default: an endpoint without an auth annotation fails at startup. It never silently becomes a public endpoint.
  • Not signed in returns a fixed error code; lacking permission returns the fixed permission code — never the "system busy" fallback.

Ways to sign in

  • Account and password: BCrypt is the fixed password scheme, no weak-hash option is offered.
  • Email code: codes use SecureRandom, and sending is confined to infra/mail.
  • Third-party login: WeChat and QQ are abstracted behind one identity interface, with no extra security framework.
Last updated 2026-10-09Edit this page →