Skip to main content

配置终端用户角色

¥Configuring end-user roles

终端用户是使用 Strapi 应用创建和管理并显示在前端应用(例如网站、移动应用、连接设备等)上的内容的用户。与管理员不同,他们无权访问管理面板。

¥End-users are the users who consume the content that is created and managed with a Strapi application and displayed on front-end applications (e.g. websites, mobile applications, connected devices etc.). Unlike the administrators, they do not have access to the admin panel.

激活 用户和权限插件 后,可以管理终端用户。然而,该插件并非完全从管理面板的同一位置进行管理和配置:终端用户账户通过内容管理器进行管理(参见 管理终端用户账户),但终端用户角色和权限在设置界面中进行管理。

¥With the Users & Permissions plugin activated, it is possible to manage end users. This plugin is however not entirely managed and configured from one same place of the admin panel: end-user accounts are managed from the Content Manager (see Managing end-user accounts) but end-user roles and permissions are managed in the Settings interface.

终端用户角色和权限的配置可在 设置子导航中的用户和权限插件部分中找到。

¥The configurations of the end-user roles and permissions are available in the Users & Permissions plugin section of the Settings sub navigation.

End-users roles interfaceEnd-users roles interface

用户和权限插件的角色子部分显示为 Strapi 应用的终端用户创建的所有角色。

¥The Roles sub-section of Users & Permissions plugin displays all created roles for the end users of your Strapi application.

通过该界面,可以:

¥From this interface, it is possible to:

提示

单击表格上方的搜索按钮 以使用文本搜索并更快地找到你的管理员角色之一!

¥Click the search button above the table to use a text search and find one of your administrator roles more quickly!

默认情况下,为任何 Strapi 应用定义 2 个终端用户角色:

¥By default, 2 end-user roles are defined for any Strapi application:

  • 已验证:仅当终端用户登录到前端应用时才能访问内容。

    ¥Authenticated: for end users to access content only if they are logged in to a front-end application.

  • 民众:供终端用户无需登录前端应用即可访问内容。

    ¥Public: for end users to access content without being logged in to a front-end application.

注意

默认情况下归属于所有新终端用户的终端用户角色可以在用户和权限插件的高级设置子部分中定义(请参阅 配置高级设置)。

¥The end-user role attributed by default to all new end users can be defined in the Advanced settings sub-section of Users & Permissions plugin (see Configuring advanced settings).

创建新角色

¥Creating a new role

在“用户和权限”插件 >“角色”界面的右上角,会显示“添加新角色”按钮。它允许为 Strapi 应用的终端用户创建新角色。

¥On the top right side of the Users & Permissions plugin > Roles interface, an Add new role button is displayed. It allows to create a new role for end users of your Strapi application.

要创建新角色,请单击“添加新角色”按钮。单击“添加新角色”按钮会将你重定向到角色编辑界面,你可以在其中编辑角色的详细信息并配置其权限(参见 编辑角色)。

¥To create a new role, click on the Add new role button. Clicking on the Add new role button will redirect you to the roles edition interface, where you will be able to edit the role's details and configure its permissions (see Editing a role).

删除角色

¥Deleting a role

尽管无法删除 2 个默认终端用户角色,但其他角色可以删除,只要没有终端用户仍将此角色归属于其账户即可。

¥Although the 2 default end-user roles cannot be deleted, the other ones can, as long as no end user still has this role attributed to their account.

删除角色:

¥To delete a role:

  1. 点击角色记录右侧的删除按钮

    ¥Click on the delete button on the right side of the role's record.

  2. 在删除窗口中,点击确认按钮确认删除。

    ¥In the deletion window, click on the Confirm button to confirm the deletion.

编辑角色

¥Editing a role

Configuring a role for end usersConfiguring a role for end users

角色编辑界面允许编辑终端用户角色的详细信息以及详细配置访问前端应用内容的权限。可通过用户和权限插件 > 角色访问,方法是单击角色记录右侧的编辑按钮 ,或单击添加新角色按钮(参见 创建新角色)。

¥The role edition interface allows to edit the details of an end-user role as well as to configure in detail the permissions to access the content of a front-end application. It is accessible from Users & Permissions plugin > Roles either after clicking on the edit button on the right side of a role's record, or after clicking on the Add new role button (see Creating a new role).

编辑角色详细信息

¥Editing role's details

终端用户角色编辑界面的详细信息区域允许定义角色的名称,并为其提供描述,以帮助管理员了解角色授予的访问权限。

¥The details area of an end-user role editing interface allows to define the name of the role, and to give it a description that should help administrators understand what the role gives access to.

要编辑角色的详细信息,请按照下表中的说明进行操作:

¥To edit a role's details, follow the instructions from the table below:

角色详情指示
名称在文本框中写入角色的新名称。
描述在文本框中写下角色的描述。

配置角色的权限

¥Configuring role's permissions

终端用户角色编辑界面的权限区域允许配置 Strapi 应用的内容类型和可用插件的所有可能的操作和访问。

¥The permissions area of an end-user role editing interface allows to configure all possible actions and accesses for content-types and available plugins of the Strapi application.

要配置终端用户角色的权限:

¥To configure permissions for an end-user role:

  1. 单击要配置的权限类别的名称(例如应用、内容管理器、电子邮件等)。

    ¥Click on the name of the permission category to configure (e.g. Application, Content-Manager, Email etc.).

  2. 勾选要授予该角色的操作和权限的框。

    ¥Tick the boxes of the actions and permissions to grant for the role.

  3. 单击“保存”按钮。

    ¥Click on the Save button.

提示

当勾选某个操作或权限框时,界面右侧会显示该 API 的相关绑定路由。

¥When ticking an action or permission box, related bound routes of the API are displayed in the right side of the interface.