Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 0ff167a

Browse files
authored
Merge pull request #9 from Tinywan/master
添加静态RBAC API方法,方便IDE自动提示调用
2 parents d0a19c0 + 1fb93b6 commit 0ff167a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/Facades/Casbin.php

+20-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,34 @@
77
use Casbin\Enforcer;
88
use Casbin\Model\Model;
99

10+
/**
11+
* @see Enforcer
12+
* @mixin Enforcer
13+
* @method mixed GetRolesForUser(string $username) static 获取用户具有的角色
14+
* @method mixed GetUsersForRole(string $role) static 获取具有角色的用户
15+
* @method mixed HasRoleForUser(string $username, string $role) static 确定用户是否具有角色
16+
* @method mixed AddRoleForUser(string $username, string $role) static 为用户添加角色
17+
* @method mixed DeleteRoleForUser(string $username, string $role) static 删除用户的角色
18+
* @method mixed DeleteRolesForUser(string $username) static 删除用户的所有角色
19+
* @method mixed DeleteUser(string $username) static 删除一个用户
20+
* @method mixed DeleteRole(string $role) static 删除一个角色
21+
* @method mixed DeletePermission(string $policy) static 删除权限
22+
* @method mixed AddPermissionForUser(string $username,string $policy) static 为用户或角色添加权限
23+
* @method mixed DeletePermissionForUser(string $username,string $policy) static 删除用户或角色的权限
24+
* @method mixed DeletePermissionsForUser(string $username) static 删除用户或角色的权限
25+
* @method mixed GetPermissionsForUser(string $username) static 获取用户或角色的权限
26+
* @method mixed HasPermissionForUser(string $username,string $policy) static 确定用户是否具有权限
27+
* @method mixed GetImplicitRolesForUser(string $username) static 获取用户具有的隐式角色
28+
* @method mixed GetImplicitPermissionsForUser(string $username) static 获取用户具有的隐式角色
29+
*/
1030
class Casbin extends Facade
1131
{
1232
protected static function getFacadeClass()
1333
{
1434
if (!Container::getInstance()->has('casbin')) {
1535
Container::getInstance()->bindTo('casbin', function () {
1636
$adapter = config('casbin.adapter');
17-
1837
$configType = config('casbin.model.config_type');
19-
2038
$model = new Model();
2139
if ('file' == $configType) {
2240
$model->loadModel(config('casbin.model.config_file_path'));

0 commit comments

Comments
 (0)