Log in

View Full Version : zend_acl problem



udaybabu
01-21-2015, 12:41 PM
Hi,

we developed a application using php with zend framework..

i have a acl file and has some code..


$Details = $oRole->getDetailsByName("KLIENT_UTSKRIVNING");
if($Details->Return2==1)
$this->allow(self::TYPE_STAFF, 'student-index-discharge');

$Details = $oRole->getDetailsByName("KLIENT_SKOLA");
if($Details->Return2==1)
$this->allow(self::TYPE_STAFF, 'student-index-school');

i have same lot of code like this..here i am sending function name and getting from database and i am giving permitions to the users.


and another file called role.php i have a code.


public function getDetailsByName($a_sName) {
$oSystemFunction = new Function_Model_DbTable_Systemfunction();
$FunctionGuid = $oSystemFunction->getFunctionGuidByName($a_sName);

if($iReturn = $this->Organization($FunctionGuid->Guid)){
$oRoleFunction = new Role_Model_DbTable_RoleFunction();
$iReturn = "0";
$iReturn1 = "0";
$iReturn2 = "0";
$iReturn3 = "0";
foreach ($this->checkRolesByUser() as $oRole) {
$aRightRoles = $oRoleFunction->getRoleRights($oRole->RoleGuid, $FunctionGuid->Guid);
foreach ($aRightRoles as $oRightRole) {
if ($oRightRole->ReadRight == 1)
$iReturn = $oRightRole->ReadRight;
if ($oRightRole->CreateRight == 1)
$iReturn1 = $oRightRole->CreateRight;
if ($oRightRole->UpdateRight == 1)
$iReturn2 = $oRightRole->UpdateRight;
if ($oRightRole->DeleteRight == 1)
$iReturn3 = $oRightRole->DeleteRight;
}
}
}
$Details = array();
$Details = (object) $Details;
$Details->FunctionGuid = $FunctionGuid->Guid;
$Details->Return = $iReturn;
$Details->Return1 = $iReturn1;
$Details->Return2 = $iReturn2;
$Details->Return3 = $iReturn3;
return $Details;

}


my prob is if i click on any module every time query runs and getting the data from data base..so that my application is getting slow..

so what is the alternate way and how to do it?

Help me out thanks in advance..

Regards
kiran

keyboard
01-21-2015, 05:44 PM
Cache the data from the database. Did you pack the zend framework into an exe with your php code?

udaybabu
01-22-2015, 06:42 AM
Hi,

THanks for ur quick responce..can u tell me how to do it?


yes my total application was developed in zend framewwork only...