本文整理汇总了PHP中sapp_Global::generateAccessControl方法的典型用法代码示例。如果您正苦于以下问题:PHP sapp_Global::generateAccessControl方法的具体用法?PHP sapp_Global::generateAccessControl怎么用?PHP sapp_Global::generateAccessControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sapp_Global
的用法示例。
在下文中一共展示了sapp_Global::generateAccessControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
/**
* This action is used to delete roles and their child data.
* @parameters
* @param $objid = id of role.
*
* @return {String} success/failure message
*/
public function deleteAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$id = $this->_request->getParam('objid');
$messages['message'] = '';
$actionflag = 3;
if ($id) {
$roles_model = new Default_Model_Roles();
$user_model = new Default_Model_Usermanagement();
$user_cnt = $user_model->getUserCntByRole($id);
if ($user_cnt == 0) {
$previleges_model = new Default_Model_Privileges();
$menumodel = new Default_Model_Menu();
$data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where = array('id=?' => $id);
$Id = $roles_model->SaveorUpdateRolesData($data, $where);
if ($Id == 'update') {
sapp_Global::generateAccessControl();
$prev_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where_prev = "role = " . $id;
$previleges_model->SaveorUpdatePrivilegesData($prev_data, $where_prev);
$objidArr = $menumodel->getMenuObjID('/roles');
$objID = $objidArr[0]['id'];
$result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $id);
$messages['message'] = 'Role deleted successfully';
$messages['msgtype'] = 'success';
} else {
$messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
$messages['msgtype'] = 'error';
}
} else {
$messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
$messages['msgtype'] = 'error';
}
} else {
$messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
$messages['msgtype'] = 'error';
}
$this->_helper->json($messages);
}
示例2: savemenuAction
public function savemenuAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$date = new Zend_Date();
$wizard_model = new Default_Model_Wizard();
$wizardData = $wizard_model->getWizardData();
$trDb = Zend_Db_Table::getDefaultAdapter();
// starting transaction
$trDb->beginTransaction();
try {
if ($this->_request->getPost()) {
$defined_menus = array(TIMEMANAGEMENT, RESOURCEREQUISITION, BGCHECKS, STAFFING, COMPLIANCES, REPORTS, BENEFITS, SERVICEDESK);
$chk_menu = $this->_request->getParam('chk_menu');
// menus to be activate
$chk_menu = trim($chk_menu, ',');
$logmenus = $chk_menu;
if ($chk_menu != '' && $chk_menu != ',' && !is_array($chk_menu)) {
$chk_menu = explode(',', $chk_menu);
} else {
$chk_menu = array();
}
$disable_menus = array_diff($defined_menus, $chk_menu);
//menus to be deactivated
if (!empty($chk_menu)) {
foreach ($chk_menu as $menu) {
$this->save_helper(1, $menu);
}
}
if (!empty($disable_menus)) {
foreach ($disable_menus as $menu) {
$this->save_helper(0, $menu);
}
}
// Code to Update Logmanager table with comma separated menuids
$menumodel = new Default_Model_Menu();
$menuNames = $menumodel->getMenusNamesByIds($logmenus);
$logarr = array('userid' => $loginUserId, 'recordid' => $logmenus, 'childrecordid' => $menuNames, 'date' => $date->get('yyyy-MM-dd HH:mm:ss'));
$jsonlogarr = json_encode($logarr);
$menuID = MANAGEMODULE;
$actionflag = 2;
if (!empty($logmenus)) {
//only activated records are logged in log manager.
$menumodel->addOrUpdateMenuLogManager($menuID, $actionflag, $jsonlogarr, $loginUserId, $menuNames);
}
$wizardarray = array('manage_modules' => 2, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($wizardData['site_config'] == 2 && $wizardData['org_details'] == 2) {
$wizardarray['iscomplete'] = 2;
}
$wizard_model->SaveorUpdateWizardData($wizardarray, '');
$trDb->commit();
sapp_Global::generateAccessControl();
$this->_helper->getHelper("FlashMessenger")->addMessage("Modules updated successfully.");
$this->_redirect('wizard/managemenu');
} else {
$this->_helper->getHelper("FlashMessenger")->addMessage("No Menus were added.");
$this->_redirect('wizard/managemenu');
}
} catch (Exception $e) {
$trDb->rollBack();
$msg = $e->getMessage();
$this->_helper->getHelper("FlashMessenger")->addMessage($msg);
$this->_redirect('managemenu');
}
}
示例3: saveAction
public function saveAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$date = new Zend_Date();
$trDb = Zend_Db_Table::getDefaultAdapter();
// starting transaction
$trDb->beginTransaction();
try {
if ($this->_request->getPost()) {
$defined_menus = unserialize(MANAGE_MODULE_ARRAY);
$chk_menu = $this->_request->getParam('chk_menu');
// menus to be activate
$chk_menu = trim($chk_menu, ',');
$logmenus = $chk_menu;
if ($chk_menu != '' && $chk_menu != ',' && !is_array($chk_menu)) {
$chk_menu = explode(',', $chk_menu);
} else {
$chk_menu = array();
}
$disable_menus = array_diff($defined_menus, $chk_menu);
//menus to be deactivated
if (!empty($chk_menu)) {
foreach ($chk_menu as $menu) {
$this->save_helper(1, $menu);
}
}
if (!empty($disable_menus)) {
foreach ($disable_menus as $menu) {
$this->save_helper(0, $menu);
}
}
// Code to Update Logmanager table with comma separated menuids
$menumodel = new Default_Model_Menu();
$menuNames = $menumodel->getMenusNamesByIds($logmenus);
$logarr = array('userid' => $loginUserId, 'recordid' => $logmenus, 'childrecordid' => $menuNames, 'date' => $date->get('yyyy-MM-dd HH:mm:ss'));
$jsonlogarr = json_encode($logarr);
$menuID = MANAGEMODULE;
$actionflag = 2;
if (!empty($logmenus)) {
//only activated records are logged in log manager.
$menumodel->addOrUpdateMenuLogManager($menuID, $actionflag, $jsonlogarr, $loginUserId, $menuNames);
}
$this->_helper->getHelper("FlashMessenger")->addMessage("Modules updated successfully.");
$trDb->commit();
sapp_Global::generateAccessControl();
$this->_redirect('managemenus');
} else {
$this->_helper->getHelper("FlashMessenger")->addMessage("No Menus were added.");
$this->_redirect('managemenus');
}
} catch (Exception $e) {
$trDb->rollBack();
$msg = $e->getMessage();
//echo $msg; die;
$this->_helper->getHelper("FlashMessenger")->addMessage($msg);
$this->_redirect('managemenus');
}
}