当前位置: 首页>>代码示例>>PHP>>正文


PHP sapp_Global::generateAccessControl方法代码示例

本文整理汇总了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);
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:50,代码来源:RolesController.php

示例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');
     }
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:67,代码来源:WizardController.php

示例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');
     }
 }
开发者ID:sura2k,项目名称:sentrifugo,代码行数:61,代码来源:ManagemenusController.php


注:本文中的sapp_Global::generateAccessControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。