Ejemplo n.º 1
0
 public static function useGroupOnAgent($groupId, $agentId, $zoneId, $contextId, $override)
 {
     $db = Zend_Registry::get('my_db');
     $items = GroupPermissionItem::getGroupItems($groupId);
     foreach ($items as $item) {
         $exists = Permission::checkIfPermissionExist($zoneId, $agentId, $contextId, $item->objectId);
         if ($exists == 1 && $override == 1) {
             $db->delete(DBConvertor::convertCase('agent_permissions'), DBConvertor::convertCase('zone_id') . ' = ' . $zoneId . ' and ' . DBConvertor::convertCase('agent_id') . ' = ' . $agentId . ' and ' . DBConvertor::convertCase('context_id') . ' = ' . $contextId);
             Permission::addPermission($zoneId, $agentId, $contextId, $item->objectId, $item->provide, $item->subscribe, $item->add, $item->update, $item->delete_, $item->request, $item->respond);
         }
         if ($exists == 0) {
             Permission::addPermission($zoneId, $agentId, $contextId, $item->objectId, $item->provide, $item->subscribe, $item->add, $item->update, $item->delete_, $item->request, $item->respond);
         }
     }
 }
Ejemplo n.º 2
0
 public function updategroupitemAction()
 {
     $auth = Zend_Auth::getInstance();
     $lic = $_REQUEST['lic'];
     if ($lic != $_SESSION['OPENZISKEYHOLE']) {
         $this->view->msg = 'Not Ajax Request';
         $this->_forward('error', 'error');
     } else {
         if ($auth->hasIdentity()) {
             if (!$this->getRequest()->isXmlHttpRequest()) {
                 $this->view->msg = 'Not Ajax Request';
                 $this->_forward('error', 'error');
             } else {
                 Zend_Session::regenerateId();
                 $filterChain = new Zend_Filter();
                 $filterChain->addFilter(new Zend_Filter_StripTags());
                 $filterChain2 = new Zend_Filter();
                 $filterChain2->addFilter(new Zend_Filter_Digits());
                 $itemId = $filterChain2->filter($_POST['ITEM_ID']);
                 $provide = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['PROVIDE']));
                 $subscribe = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['SUBSCRIBE']));
                 $request = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['REQUEST']));
                 $respond = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['RESPOND']));
                 $add = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['ADD']));
                 $change = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['CHANGE']));
                 $delete = $filterChain2->filter(Utility::convertCheckBoxValue($_POST['DELETE']));
                 GroupPermissionItem::updateGroupItem($itemId, $provide, $subscribe, $add, $change, $delete, $request, $respond);
                 $this->render('ajaxsuccessjson');
             }
         } else {
             if (!$this->getRequest()->isXmlHttpRequest()) {
                 $this->view->msg = 'Not Ajax Request';
                 $this->_forward('error', 'error');
             } else {
                 $this->view->msg = 'errors:{reason:"Invalid User"}';
                 $this->_forward('error', 'error');
             }
         }
     }
 }