Server Development Guide Of Each Part#

Permission#

Session Operation Permission#

Definition Location#

Please refer to the server/migration/src/m20241229_022701_add_role_for_session.rs file, and add your own permissions and roles to PredefinedPermissions and PredefinedRoles.

In general, if you define a new permission, you need to consider which existing roles to add it to. For example, regardless of what permission you add, Admin always has this permission.

Then, please note that you should not directly modify the init_role_table function, to prevent database migration related problems, the correct way is to use sea migrate generate xxx, and then write new permission-related code in it.

Permission Related Operations#

  • if_permission_exist: Check if a permission exists

  • get_all_roles_of_session: Get all roles defined in a session

  • query_session_role: Get all users with a specific role in a session