Ejemplo n.º 1
0
 public static function getModuleAccessList($authId, $module)
 {
     $myallroles = RBAC::getAuthorRole($authId);
     // Db方式
     $db = Db::getInstance(C('RBAC_DB_DSN'));
     $table = array('role' => C('RBAC_ROLE_TABLE'), 'user' => C('RBAC_USER_TABLE'), 'access' => C('RBAC_ACCESS_TABLE'));
     $sql = "select access.node_id from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access " . "where  access.role_id in ({$myallroles}) and role.status=1 and  access.module='{$module}' and access.status=1";
     $rs = $db->query($sql);
     $access = array();
     foreach ($rs as $node) {
         $access[] = $node['node_id'];
     }
     return $access;
 }