first commit
This commit is contained in:
17
acl_list.php
Normal file
17
acl_list.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
// 定义 ACL 表
|
||||
$acl = array(
|
||||
"cto" => array("p_1.php", "p_2.php", "p_3.php"),
|
||||
"manager" => array("p_2.php", "p_3.php"),
|
||||
"staff" => array("p_3.php")
|
||||
);
|
||||
|
||||
// 定义检查权限的函数
|
||||
function checkAccess($role, $resource) {
|
||||
global $acl;
|
||||
if (isset($acl[$role]) && in_array($resource, $acl[$role])) {
|
||||
return true; // 有权限
|
||||
}
|
||||
return false; // 无权限
|
||||
}
|
||||
|
Reference in New Issue
Block a user