# 支持的Models
1. [**ACL (Access Control List, 訪問控制列表)**](https://en.wikipedia.org/wiki/Access_control_list)
2. **具有[超級用戶](https://en.wikipedia.org/wiki/Superuser)的 ACL**
3. **沒有用戶的 ACL**: 對于沒有身份驗證或用戶登錄的系統尤其有用。
4. **沒有資源的 ACL**: 某些場景可能只針對資源的類型, 而不是單個資源, 諸如`write-article`,`read-log`等權限。 它不控制對特定文章或日志的訪問。
5. **[RBAC (基于角色的訪問控制)](https://en.wikipedia.org/wiki/Role-based_access_control)**
6. **支持資源角色的RBAC**: 用戶和資源可以同時具有角色 (或組)。
7. **支持域/租戶的RBAC**: 用戶可以為不同的域/租戶設置不同的角色集。
8. **[ABAC (基于屬性的訪問控制)](https://en.wikipedia.org/wiki/Attribute-Based_Access_Control)**: 支持利用`resource.Owner`這種語法糖獲取元素的屬性。
9. **[RESTful](https://en.wikipedia.org/wiki/Representational_state_transfer)**: 支持路徑, 如`/res/*`,`/res/: id`和 HTTP 方法, 如`GET`,`POST`,`PUT`,`DELETE`。
10. **拒絕優先**: 支持允許和拒絕授權, 拒絕優先于允許。
11. **優先級**: 策略規則按照先后次序確定優先級,類似于防火墻規則。
## 例子
| 訪問控制模型 | Model 文件 | Policy 文件 |
| --- | --- | --- |
| ACL | [basic\_model.conf](https://github.com/casbin/casbin/blob/master/examples/basic_model.conf) | [basic\_policy.csv](https://github.com/casbin/casbin/blob/master/examples/basic_policy.csv) |
| |  | |
| 具有超級用戶的ACL | [basic\_model\_with\_root.conf](https://github.com/casbin/casbin/blob/master/examples/basic_with_root_model.conf) | [basic\_policy.csv](https://github.com/casbin/casbin/blob/master/examples/basic_policy.csv) |
| |  | |
| 沒有用戶的ACL | [basic\_model\_without\_users.conf](https://github.com/casbin/casbin/blob/master/examples/basic_without_users_model.conf) | [basic\_policy\_without\_users.csv](https://github.com/casbin/casbin/blob/master/examples/basic_without_users_policy.csv) |
| |  | |
| 沒有資源的ACL | [basic\_model\_without\_resources.conf](https://github.com/casbin/casbin/blob/master/examples/basic_without_resources_model.conf) | [basic\_policy\_without\_resources.csv](https://github.com/casbin/casbin/blob/master/examples/basic_without_resources_policy.csv) |
| |  | |
| RBAC | [rbac\_model.conf](https://github.com/casbin/casbin/blob/master/examples/rbac_model.conf) | [rbac\_policy.csv](https://github.com/casbin/casbin/blob/master/examples/rbac_policy.csv) |
| |  | |
| 支持資源角色的RBAC | [rbac\_model\_with\_resource\_roles.conf](https://github.com/casbin/casbin/blob/master/examples/rbac_with_resource_roles_model.conf) | [rbac\_policy\_with\_resource\_roles.csv](https://github.com/casbin/casbin/blob/master/examples/rbac_with_resource_roles_policy.csv) |
| |  | |
| 支持域/租戶的RBAC | [rbac\_model\_with\_domains.conf](https://github.com/casbin/casbin/blob/master/examples/rbac_with_domains_model.conf) | [rbac\_policy\_with\_domains.csv](https://github.com/casbin/casbin/blob/master/examples/rbac_with_domains_policy.csv) |
| |  | |
| ABAC | [abac\_model.conf](https://github.com/casbin/casbin/blob/master/examples/abac_model.conf) | 無 |
| |  | |
| RESTful | [keymatch\_model.conf](https://github.com/casbin/casbin/blob/master/examples/keymatch_model.conf) | [keymatch\_policy.csv](https://github.com/casbin/casbin/blob/master/examples/keymatch_policy.csv) |
| |  | |
| 拒絕優先 | [rbac\_model\_with\_deny.conf](https://github.com/casbin/casbin/blob/master/examples/rbac_with_deny_model.conf) | [rbac\_policy\_with\_deny.csv](https://github.com/casbin/casbin/blob/master/examples/rbac_with_deny_policy.csv) |
| |  | |
| 優先級 | [priority\_model.conf](https://github.com/casbin/casbin/blob/master/examples/priority_model.conf) | [priority\_policy.csv](https://github.com/casbin/casbin/blob/master/examples/priority_policy.csv) |
| |  | |