vendor/alipay/lotusphp_runtime/RBAC/Rbac.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class LtRbac {
public $configHandle;
protected $acl;
public function __construct()
{
if (! $this->configHandle instanceof LtConfig)
{
if (class_exists("LtObjectUtil", false))
{
$this->configHandle = LtObjectUtil::singleton("LtConfig");
}
else
{
$this->configHandle = new LtConfig;
}
}
}
public function init()
{
$this->acl = $this->configHandle->get('rbac.acl');
}
public function checkAcl($roles, $resource)
{
$allow = false;
// deny priority
foreach (array("allow", "deny") as $operation)
{
foreach($roles as $role)
{
if (isset($this->acl[$operation][$role]))
{
// everyone *
if (in_array($resource, $this->acl[$operation]['*']))
{
$allow = "allow" == $operation ? true : false;
break;
}
if (in_array($resource, $this->acl[$operation][$role]))
{
$allow = "allow" == $operation ? true : false;
break;
}
else
{
$res = explode('/', trim($resource, '/'));
for ($i = count($res)-1; $i >= 0; $i--)
{
$res[$i] = '*';
$tmp = implode('/', $res);
if (in_array($tmp, $this->acl[$operation][$role]))
{
$allow = "allow" == $operation ? true : false;
break;
}
后面还有 27 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
