# RBAC权限系统

> 本系统为管理后台的权限系统，本系统的意图是让站长可以安全，便捷，明确的给予不同管理人员对应的权限来帮助管理。

## 角色 - Role

{% hint style="warning" %}
面板自带：`超级管理员 - Super Admin` 请勿修改！
{% endhint %}

**超级管理员**：如其名，检查角色是否有操作权限时，会自动判断为有权限！即该角色有面板的**全部权限**；与原先用户编辑中的是否是管理选项相当！\
注意：**给这个角色添加权限属于鸡助行为**！因为该角色默认所有权限时直接在后台处理文件中赋予的！

原则：一人可饰多角

## 权限 - Permission

每一个权限都有其对应管理范围；

原则：一角可有多权

### 权限行为

面板自带权限行为可参考：<https://demo.proxypanel.ml/admin/permission>

一下我们将解释如何看待/运用面板的权限！

### 基础 (小白必看)

#### 权限是怎么划分出来的？

本项目权限基于管理路由（直观点 就是访问的网页链接&请求方法）的权限，来判断用户是否有权访问/修改。

例：

在【[`权限行为列表`](https://demo.proxypanel.ml/admin/permission)】页面中，你可以看到`admin.aff.index`，其名称为：`【推广系统】提现管理列表` 通俗点表示<https://demo.proxypanel.ml/admin/aff> 这个页面的访问权。

#### 相似的行为有什么快速区分的方法吗？

以`admin.goods.create,store`为例，`admin.goods.`为路径，`create,store`为行为；两者以最后一&#x4E2A;**`·点`**&#x4E3A;分界线；其中行为中 `，逗号` 为`和 &`的意思。

| 后缀     | 通常意味着             |
| ------ | ----------------- |
| index  | 访问xx的页面、列表        |
| create | 访问xx的添加页面         |
| store  | 将添加页面中内容添加至数据库的操作 |
| show   | 访问xx中xxx的详细内容     |
| edit   | 访问编辑页面            |
| update | 将编辑页面中内容保存至数据库的操作 |
| \*     | 该路径全部权限；          |
| 其他     |                   |

注意：`admin.goods.*` 等于 `admin.goods`；无论`admin.goods` &#x7684;**`·点`**&#x4E4B;后带什么，它都包含其权限！\
例：`admin.goods.* = admin.goods > admin.goods.items > admin.goods.items.index,create > admin.goods.items.index`

### 进阶

按照行为，我们认为访问`编辑页面和编辑操作`，`添加页面和添加操作` 为并列行为，所以面板提供的默认行为列表是合并在一起的，你可以通过上面的讲解，以及参考其他行为书写形式进行**拆分**或**兼并**。

#### 更多权限行为依据

使用**ssh**，在**网站的根目录**下，运行

```
php artisan route:list
```

以上指令，可以让你看到网站使用的完整路由/链接列表。出现的表格中，URI为链接格式，name为路由名称，也是权限中的行为。

注意：本系统只对管理面板，即后台，有效。对用户所使用的前端是不带任何作用。一般管理的路由名称以`admin.`开头！

## 特殊权限

| 名称                      | 描述                                    |
| ----------------------- | ------------------------------------- |
| 【用户系统】赋予角色权限 give roles | 给予用户角色的操作, 拥有这个权限的角色可以赋予其他用户，其所拥有的角色。 |

更多建议，请开issue并详细描述想法，使用场景等，请求开发者考虑/添加。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://proxypanel.gitbook.io/wiki/rbac.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
