Exemplo n.º 1
0
 public function GetResourceAccess($params = null)
 {
     //        $ROLE_ID    =   isset($params[self::ROLE_ID]) ? $params[self::ROLE_ID] : null;
     //        $ROLE_NAME  =   isset($params[A_ACL_RoleModel::ROLE_NAME]) ? $params[A_ACL_RoleModel::ROLE_NAME] : null;
     if (isset(self::$_resource_access_map)) {
         return self::$_resource_access_map;
     }
     $ROLE_TO_BASES = array();
     $szSQL = self::SELECT_FROM(array(RolesRelationModel::tblFldsAll(), RoleModel::ROLE_NAME, self::tblFld(self::MODULE), self::tblFld(self::CONTROLLER), self::tblFld(self::ACTION), self::tblFld(self::ACCESS_PERMISSION)), array(RolesRelationModel::tbl(), RoleModel::tbl(), self::tbl()), array(array(RolesRelationModel::tblFld(RolesRelationModel::ROLE_ID), RoleModel::tblFld(RoleModel::ROLE_ID)), array(RoleModel::tblFld(RoleModel::ROLE_ID), self::tblFld(self::ROLE_ID))), null, null);
     $cDB =& $this->GetDBAdapter();
     $rs = $cDB->Execute($szSQL);
     self::$_resource_access_map = array();
     while ($this->isValid($rs)) {
         self::$_resource_access_map[self::ROLES][$rs->fields[RolesRelationModel::ROLE_ID]] = $rs->fields[RoleModel::ROLE_NAME];
         self::$_resource_access_map[self::RULES][$rs->fields[RolesRelationModel::ROLE_ID]][$rs->fields[self::MODULE]][$rs->fields[self::CONTROLLER]][$rs->fields[self::ACTION]] = (int) $rs->fields[self::ACCESS_PERMISSION];
         $this->_map($ROLE_TO_BASES, $rs->fields);
         $rs->MoveNext();
     }
     self::$_resource_access_map[self::MAP] = $ROLE_TO_BASES;
     echo __METHOD__ . " #" . __LINE__ . " Resource Access map:<br><pre>";
     var_dump(self::$_resource_access_map);
     echo "</pre><br>";
     return self::$_resource_access_map;
 }