コード例 #1
0
 /**
  * Function to process the form
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     CRM_ACL_BAO_Cache::resetCache();
     $params = $this->controller->exportValues($this->_name);
     if ($this->_id || $this->_id === '0') {
         $query = "\nDELETE\n  FROM civicrm_acl\n WHERE entity_id = %1\n   AND ( object_table NOT IN ( 'civicrm_saved_search', 'civicrm_uf_group', 'civicrm_custom_group' ) )\n";
         $deleteParams = array(1 => array($this->_id, 'Integer'));
         $dao = CRM_Core_DAO::executeQuery($query, $deleteParams);
         if ($this->_action & CRM_Core_Action::DELETE) {
             CRM_Core_Session::setStatus(ts('Selected ACL has been deleted.'));
             return;
         }
     }
     $params['operation'] = 'All';
     $params['deny'] = 0;
     $params['is_active'] = 1;
     $params['entity_table'] = 'civicrm_acl_role';
     $params['name'] = 'Core ACL';
     foreach ($params['object_table'] as $object_table => $value) {
         if ($value) {
             $newParams = $params;
             unset($newParams['object_table']);
             $newParams['object_table'] = $object_table;
             CRM_ACL_BAO_ACL::create($newParams);
         }
     }
 }
コード例 #2
0
 /**
  * Function to process the form
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     // note this also resets any ACL cache
     CRM_Core_BAO_Cache::deleteGroup('contact fields');
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_ACL_BAO_ACL::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected ACL has been deleted.'));
     } else {
         $params = $this->controller->exportValues($this->_name);
         $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
         $params['deny'] = 0;
         $params['entity_table'] = 'civicrm_acl_role';
         // Figure out which type of object we're permissioning on and set object_table and object_id.
         switch ($params['object_type']) {
             case 1:
                 $params['object_table'] = 'civicrm_saved_search';
                 $params['object_id'] = $params['group_id'];
                 break;
             case 2:
                 $params['object_table'] = 'civicrm_uf_group';
                 $params['object_id'] = $params['uf_group_id'];
                 break;
             case 3:
                 $params['object_table'] = 'civicrm_custom_group';
                 $params['object_id'] = $params['custom_group_id'];
                 break;
             case 4:
                 $params['object_table'] = 'civicrm_event';
                 $params['object_id'] = $params['event_id'];
                 break;
         }
         if ($this->_id) {
             $params['id'] = $this->_id;
         }
         CRM_ACL_BAO_ACL::create($params);
     }
 }