本文整理汇总了PHP中RBAC::writeover方法的典型用法代码示例。如果您正苦于以下问题:PHP RBAC::writeover方法的具体用法?PHP RBAC::writeover怎么用?PHP RBAC::writeover使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RBAC
的用法示例。
在下文中一共展示了RBAC::writeover方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileGroupAccessList
public static function getFileGroupAccessList($authId)
{
if ($_SESSION[C('ADMIN_AUTH_KEY')]) {
return array();
}
$authId = $authId ? $authId : $_SESSION[C('USER_AUTH_KEY')];
$file = DConfig_PATH . "/AccessList/access_" . $authId . ".php";
if (!file_exists($file)) {
$accessList = RBAC::getAccessList($authId);
if (!file_exists(DConfig_PATH . "/AccessList")) {
createFolder(dirname(DConfig_PATH . "/AccessList"));
mkdir(DConfig_PATH . "/AccessList", 0777);
}
RBAC::writeover($file, "return " . RBAC::pw_var_export($accessList) . ";\n", true);
foreach ($accessList as $k3 => $v3) {
foreach ($accessList[$k3] as $k1 => $v1) {
foreach ($accessList[$k3][$k1] as $k => $v) {
$p = explode("-", $v);
$_SESSION[strtolower($k1 . '_' . $k)] = $p[1];
}
}
}
}
$access = (require $file);
$groupList = array();
$num = 0;
foreach ($access as $k1 => $v1) {
foreach ($v1 as $k2 => $v2) {
if ($k2 == "INDEX") {
continue;
}
foreach ($v2 as $k3 => $v3) {
//等于组ID时压入到组数组
if ($k3 == "GROUPID") {
$groupList[$num] = $v3;
$num++;
}
}
}
}
$groupList = array_unique($groupList);
return $groupList;
}