Skip to content

Commit

Permalink
feat: translate organization & role management
Browse files Browse the repository at this point in the history
  • Loading branch information
daichen-daisy committed Aug 11, 2023
1 parent 64fbc4a commit 34e67d5
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 72 deletions.
4 changes: 2 additions & 2 deletions content/3.user-manual/2.basic-features/2.user-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 用户名:该字段的使用场景是系统开启了用户名和密码组合的登录方式。
* 手机号:如果系统开启了使用手机号登录或注册的方式,则此处填写的手机号会用于接收短信验证码。
* 邮箱:如果系统开启了使用邮箱登录或注册的方式,则此处填写的邮箱地址会用于接收验证码。此外,只有填写了邮箱的用户可以接收到例如账号创建、密码重置等邮件提醒。
* 角色:用户在系统里关联的角色(关于角色,会在之后的[角色管理](/advanced-features/role-management)章节中进行介绍)。
* 角色:用户在系统里关联的角色(关于角色,会在之后的[角色管理](/user-manual/advanced-features/role-management)章节中进行介绍)。
* 最后登录时间:用户最近一次登录系统的时间。
* 创建时间:该账号的创建时间。
* 状态:这里有两种状态。`正常` 是指该用户可以登录系统进行使用;`停用` 是指该用户已经被禁用,系统会拒绝其进行登录。
Expand All @@ -27,7 +27,7 @@
* 删除账号:点击删除,会有提示弹窗让您进行二次确认,确认后,账号将被永久删除。

::alert{type="info"}
注意:如果您准备禁用或删除的账号恰恰是您当前登录本系统正在使用的账号,即便您拥有用户管理下的所有权限(权限将会在[权限管理](/advanced-features/permission-management)章节进行介绍),您也无法禁用或删除该账号,因为这样的操作会使您立即失去身份并跳出系统。
注意:如果您准备禁用或删除的账号恰恰是您当前登录本系统正在使用的账号,即便您拥有用户管理下的所有权限(权限将会在[权限管理](/user-manual/advanced-features/permission-management)章节进行介绍),您也无法禁用或删除该账号,因为这样的操作会使您立即失去身份并跳出系统。
::

### 搜索、过滤及排序
Expand Down

Large diffs are not rendered by default.

57 changes: 30 additions & 27 deletions content/3.user-manual/3.advanced-features/2.role-management.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,78 @@
# 角色管理

As previously mentioned, while an organizational structure may not be necessary for a project, role management is typically utilized. Besides, we apply the role-based access control (RBAC) mechanism to limit system access, making role management a must-have feature. Two different display modes are available for it: list mode and structure mode.
在这一小节中,我们将学习角色管理相关的功能。正如我们之前所说,也许上一个小节中介绍组织管理并非大多数项目的所需,但角色管理一定是很多项目中必不可少的部分,尤其是当我们选择了在 FreeAuth 中采用了 RBAC(基于角色的访问控制)机制,因此为了最终实现权限的分配,我们必须首先了解如何创建角色和使用角色。通过左侧菜单栏中的 `角色管理` 进入到其管理界面,在这里我们提供了两种模式,从不同的维度来展示系统中的角色信息。

### List Mode
### 列表模式

Like user management, this mode has a central table listing all the role data. By default, a protected role named `系统管理员` exists in the table but cannot be deleted or deactivated, and its permissions cannot be modified. The default permission of this role is called `通配符权限`, which means once a person has this role with this permission, they can have access to anywhere in FreeAuth.
第一种显示模式是列表模式,这个模式下,界面同用户管理界面一样,中央的表格用于展示数据信息。在表格中您可以看到一个叫做 `系统管理员` 的角色,该角色是搭建系统时由系统自动生成的,也正是您当前正在使用的用户所关联的角色,这份关联也是在最初由系统自动创建的,而这个角色默认包含了一个名为 `通配符权限` 的权限,该权限覆盖了系统中其他的权限,这就意味着当一个用户关联了 `系统管理员` 角色,就拥有了系统中所有功能的访问权限。注意:`系统管理员` 角色是受保护的系统角色,不支持删除和禁用,以防因为误操作造成重要功能的无法访问。

![FreeAuth Role Management](/assets/manual/role-management.png)

To create a new role, click the button `创建角色` on the top-right of the table. A form will appear, prompting you to provide information about the new role.
除了默认系统外,您也可以创建新的角色,点击表格右上角的 `创建角色`,下图中用于创建角色的表单则会即刻弹出:

![FreeAuth Role Management - Create Form](/assets/manual/role-management-create.png)

If you already skip the organizational structure section since you have nothing to do with it in your system, you can only focus on the radio option `全局可选角色` in the form, which means any of the users in your system can be assigned this role. The native role `系统管理员` is precisely a great example of the global role.
如果您的系统或者产品中并未涉及组织架构的需求,又或者说您已经因此跳过了上一个小节,那么此处,在创建新角色时,您只需要关注 `全局可选角色` 这个选项。这类角色意味着系统中的任何用户都可以关联该角色。系统原生的 `系统管理员` 角色就是全局角色的一个很好的例子。您可以把它分配给任何一个已经存在于系统中的角色。

However, what does the other radio option `指定组织类型下可选角色` mean? If you have established an organizational structure, as explained in the previous section, then you must have created some organizations and linked them with some users, which means users in your system have been grouped by organization type. Therefore, `指定组织类型下可选角色` means this role can only be assigned to the users who belong to an organization with a specific organization type.
那么,另一个选项 `指定组织类型下可选角色` 又是什么呢?首先,让我们来回忆一下之前讲到过的概念 `组织类型`,我们在上一个小节中,我不同的组织类型创建了对应的组织架构,比如上一个小节中 `供应商` 类型。也就是说,一个组织(无论是企业机构还是部门分支)都需要定义在某个 `组织类型` 下,然后我们通过添加成员到组织,相当于将用户分配到了不同的 `组织类型` 下,也就是我们在上一个小节最开始提到的“用户池”概念。当用户通过 `组织类型` 进行隔离后,我们也支持角色的隔离,也就是当您创建的是 `指定组织类型下可选角色` 时,该角色只能被归属于同一个 `组织类型` 的用户所关联。这个功能并非是所有系统的所需,还需要您结合具体情况进行使用。

![FreeAuth Role Management - Organizational Role](/assets/manual/role-management-organizational.png)

To better understand `指定组织类型下可选角色` , let's create a new role with this type together. Firstly, select `指定组织类型下可选角色` in the form. Except for the name, code, and description of the role, there is a selector named `所属组织类型` for pointing to a particular organization type. For instance, if you select the option `供应商` we created in the previous section, only the users under an organization with the type `供应商` can be assigned this role. Let's make two roles with the type `供应商`, namely `业务员` and `财务`.
为了更好地理解 `指定组织类型下可选角色`,让我们来实际操作一下。首先,在创建角色的表单中选中 `指定组织类型下可选角色`,下方除了角色名称、角色代码和角色描述的输入框以外,还有一个名为 `所属组织类型` 的选择器,点击后,下拉框中会提供所有组织类型选项。比如,我们选择在上一个小节中创建的 `供应商`,完成信息填写后保存提交,由此生成的角色则只能被 `供应商` 下的用户所关联。如下图所示,我们在 `供应商` 下创建了两个角色,分别是 `业务员` `财务`

![FreeAuth Role Management - New Role](/assets/manual/role-management-create-result.png)

Therefore, when you try to assign roles to a user who is under the type `供应商`, only `供应商`'s roles and global roles can be options. Roles under other organization types are not available.
因此,当你为一个 `供应商` 下的用户关联角色时,您只可以搜索到全局角色和属于 `供应商` 的角色进行关联,其他组织类型下的角色将不会呈现。具体如何关联用户与角色,我们会在本小节的最后一个部分进行详细的介绍。

![FreeAuth User Details Page - Set Roles](/assets/manual/user-details-set-roles.png)

In conclusion, the organization type is more like a container that holds a group of users, an organization structure, and a few roles.
总之,我们可以把组织类型看作是一个大的容器,包含了属于它的用户、组织架构以及一些特定的角色。注意:一个用户或者一个组织或者一个角色,都只能关联一个组织类型。

Again, if your system doesn't involve the concept of organizational structure, you don't have to bother with which type to choose when creating e a role. Using `全局可选角色` is way enough.
再次强调,如果您的系统或者产品并不包含涉及组织架构的功能,您只需要关心 `全局可选角色`

Suppose you want to operate a piece of role data. Similarly, you can either click the last cell of the target role's row to expand the actions menu or click its name cell to enter its details page for further processes.
同理,如果您需要对某个角色的数据进行操作,您可以既通过该角色在表格里最后一列的行操作来完成,也可以通过点击其名称列,进入其详情页来完成相应的操作。

![FreeAuth Role Management - Row Actions](/assets/manual/role-management-row-actions.png)
![FreeAuth Role Details Page - Actions](/assets/manual/role-details-actions.png)

### Structure Mode
### 架构模式

To get a better view of the relationships among users, organizations, and roles under a specific organization type in your system, try using the structure mode.
为了能更好地展示某个组织类型下用户、组织和角色间的关系,我们可以使用架构模式进行查阅。

To switch to this mode, click the icon behind the button `创建角色` on the top-right of the role table. Once you do, you will see a central panel with three parts:
点击列表模式下数据表格右上角 `创建角色` 按钮右侧的小图标,即可进入到架构模式进行浏览。该模式下的页面被分为了三个部分:

1. Organizational Structure Tree: It's just like the one in organization management.
2. Role List: It lists all available roles that can be used under the selected organization type, including organization-specific and global roles.
3. User Table: It displays all users who are related to any organization under the selected organization type.
Since we have established more data under the organization type `供应商`, let's select the option `供应商` in the type selector on the top of the leftmost part.
1. 组织架构树形图:这部分内容与 `组织管理` 页面中左侧的组织架构树形图一样。
2. 角色列表:上半部分显示了所有属于左侧所选组织类型的角色;下半部分显示了所有全局角色。也就是所有可以在当前所选组织类型下被用户关联的角色。
3. 用户数据表格:表格展示了所有属于左侧所选组织类型的用户,或者说这些用户关联的组织,都属于左侧所选的组织类型。

考虑到,我们已经在 `供应商` 下录入了一些用户及组织数据,我们现在可以将左侧最上方的组织类型切换到 `供应商`,以便更好的理解数据间的关系。

![FreeAuth Role Management - Structure View](/assets/manual/role-management-structure-view.png)

As you can see from the image above, this mode makes it easier to check the relationship between users and roles with a specific organization type. To add multiple users to a role, click the icon after each role item in the middle part. To assign various roles to a user, click the icon `···` at the end of the user row, the dialog for binding will fade in.
从上图可见,这个模式下的视图更有助于我们查阅某个组织类型下用户和角色之间的关系。您可以通过点击中间角色列表栏内某个角色尾部的“添加图标”进入到该角色的详情页,为其一次性关联多个用户;也可以通过用户数据表格中某个用户行尾部的操作栏为该用户一次性配置多个角色,如下图所示:

![FreeAuth Role Management - Set Roles](/assets/manual/role-management-set-roles-1.png)

![FreeAuth Role Management - Set Roles](/assets/manual/role-management-set-roles.png)
为用户配置角色时,您可以在上图的表单中录入所需角色名的关键字,系统则会通过模糊匹配在下拉框中列出所有结果。注意:这里仅可以搜索出全局角色及该用户所在组织类型下的角色。选择角色保存后,该用户拥有该角色的关系会即刻得到更新,通过用户数据表格中的角色列进行呈现。

Enter the keyword for the roles in the search box and select all the roles you want to assign. Once you have done this, save the form, and then you will see the role data get updated in the leftmost table.
![FreeAuth Role Management - Set Roles](/assets/manual/role-management-set-roles-2.png)

![FreeAuth Role Management - Set Roles Result](/assets/manual/role-management-set-roles-result.png)

As for other features, we encourage you to explore them yourself, as FreeAuth prioritizes consistency in user experience. It shouldn't be a challenge.
至于这个模式下的其他功能,我们就不在这里赘述了,我们相信基于 FreeAuth 的交互设计和用户体验,探索更多功能对您将不会成为一个问题。

### Bind/Unbind User
### 绑定/解绑用户

To manage the relationships between users and roles, you can make it on either the role details page or the user details page.
那么,如何绑定或者解绑用户和某个角色之间的关系呢?

On the role details page, switch to the tab `关联主体`. You can add users to the current role by clicking the blue button `添加主体` in the top right corner or remove a user from the current role by clicking `移除主体` in the action cell of the user's row.
第一种方式是在角色的详情页中,您可以在角色管理表格中点击角色名称进入到该页面。进入后,将位于上方的选项卡切换至 `关联主体`,所有拥有该角色的用户将会被列举在其下方。点击用户列表右上方的蓝色按钮 `添加主体`,则一次性关联多个用户。点击用户列表中用户行的最后一列操作栏中的 `移除主体` 则可解除该用户与当前角色之间的关联。

![FreeAuth Role Details Page - Associated Users](/assets/manual/role-details-associated-users.png)

On the user details page, switch to the tab `角色信息`. You can change the current user's roles by clicking the bottom button `配置角色`. Here, multiple roles can be selected and saved at a time.
第二种方式是在用户的详情页中,您可以在用户管理表格中点击用户名称进入到该页面。进入后,将位于上方的选项卡切换至 `角色信息`,该用户所关联的角色将会被列举在其下方。点击列表左下角的 `配置角色`,即可完成对该用户关联角色的变更。这这里,您可以一次性关联或解绑多个角色。

![FreeAuth User Details Page - Change Roles](/assets/manual/user-details-change-roles.png)

If you need to remove a role from the current user, click the last cell, the action cell of its row. You will see the button `移除角色`, which can be clicked to unbind the connection.
如果您想从该用户关联的角色中移除某一个角色,除了上述的 `配置角色`,您也可以在当前页面的角色列表中找到该角色,并点击其所在行最后一列操作栏中的 `移除角色`,操作后,该角色将从列表中移除,随之解除与该用户的关联关系。

![FreeAuth User Details Page - Unbind Roles](/assets/manual/user-details-unbind-roles.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/assets/manual/role-management-set-roles-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/assets/manual/role-management-set-roles.png
Binary file not shown.
Binary file modified static/assets/manual/role-management-structure-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 34e67d5

Please sign in to comment.