From 5c53c37b0a1b7606bfdeb16b17eab8b121412414 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 23 Sep 2015 15:57:26 -0400 Subject: [PATCH] Remove multisite extension --- tools/extensions/org.civicrm.multisite.zip | Bin 7467 -> 0 bytes .../api/v3/MultisiteDomain/Create.php | 61 ---- .../extensions/org.civicrm.multisite/info.xml | 27 -- .../org.civicrm.multisite/multisite.civix.php | 176 ---------- .../org.civicrm.multisite/multisite.php | 311 ------------------ .../settings/Multisite.setting.php | 52 --- 6 files changed, 627 deletions(-) delete mode 100644 tools/extensions/org.civicrm.multisite.zip delete mode 100644 tools/extensions/org.civicrm.multisite/api/v3/MultisiteDomain/Create.php delete mode 100644 tools/extensions/org.civicrm.multisite/info.xml delete mode 100644 tools/extensions/org.civicrm.multisite/multisite.civix.php delete mode 100644 tools/extensions/org.civicrm.multisite/multisite.php delete mode 100644 tools/extensions/org.civicrm.multisite/settings/Multisite.setting.php diff --git a/tools/extensions/org.civicrm.multisite.zip b/tools/extensions/org.civicrm.multisite.zip deleted file mode 100644 index 2969d6c3302fdcb7c276a36461bbb8ea2454c4f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7467 zcmb7}bySpF+s21RLKwQGI|T#;q&tTWL0SeFy1S*jMMS#08ziK=Lwe{`KoI!wocBGR zb(VhT`<_2$Kl8`+o4sb=``&w9m$DojJPP2)Q(~Yi`p3(EKJXq!8~fL+#$ac#u|0$p z;$-Crb^tq?vMK+iDgB3r=(id}Tkzj><^Rx;{;xV`&c8`3{~=}hH>tvZ=PhmnF$7!x zfx>wZAp@*sbwpD=r}|T20f2Et0D$NJixRUpHFPv(wKcb`Rg<&9=D=(_E+@z-daFi( zyN6ECl7;-$H&B^ReR@D|los(APAEl4{8*2s>cGwGe0bwlo#(LX;QIk{ z0Oys7GA}#~`iMwftulH`aHGAdyWC|c*b6`5IBx*{0%v-{aY? z7Vh>;NG4jDIwuT;<(Z1{21_PWzpAbC@*^q>%-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9wh#NR0zO1v2+qfiD+yI%9@1%VW;` zyTn>`y#hykEwAlMH(gDkSY~)KFqWtRoN8PC(J)jWtqyZijN9HD?>4d6y;SlfuUtM(ZNbboF*@noJTdfk+(?{G0Dmbh%}dfETGWqw zQlu_?v1`+QilHnA1B(OreYo?mi5?!zKZoB&JwF-03VZ$(|6u%nPyQMG{N(&9{Q1eT zdU*YH?DT{4M-=oE^{X)GCo2EnP=7UvzoMZZ=--D!f1=4BhO_@K`e#)1=d%3XlmGc6 zs}C;yum6hwI`n^M{mR?@$=ZBye1FaQh12_Y?5|vkpIAH8f5$#}7Jo0rU!4Sh0)Lc| z{zL5e>v{g|T==<4zd9Ly&hG8M!~QCPzn>GzatIG`AmCx|pa7mfEW#q;k8l42&Yk>m diff --git a/tools/extensions/org.civicrm.multisite/api/v3/MultisiteDomain/Create.php b/tools/extensions/org.civicrm.multisite/api/v3/MultisiteDomain/Create.php deleted file mode 100644 index 7988b49c2c..0000000000 --- a/tools/extensions/org.civicrm.multisite/api/v3/MultisiteDomain/Create.php +++ /dev/null @@ -1,61 +0,0 @@ - 3, - 'current_domain' => TRUE, - )); - $fullParams = array_merge($domain, $params); - $fullParams['domain_version'] = $domain['version']; - $fullParams['version'] = 3; - unset($fullParams['id']); - if(empty($params['group_id'])){ - $fullParams['api.group.create'] = array( - 'title' => !empty($params['group_name']) ? $params['group_name'] : $params['name'], - ); - $domainGroupID = '$value.api.group.create.id'; - } - else{ - $domainGroupID = $params['group_id']; - } - - $fullParams['api.setting.create'] = array( - 'is_enabled' => TRUE, - 'domain_group_id' => $domainGroupID, - ); - - return civicrm_api('domain', 'create', $fullParams); -} -/* - * Adjust Metadata for Create action - * - * The metadata is used for setting defaults, documentation & validation - * @param array $params array or parameters determined by getfields - */ -/** - * @param array $params - */ -function _civicrm_api3_multisite_domain_create_spec(&$params) { - $params['name']['api.required'] = 1; - $params['group_title'] = array( - 'title' => 'name of group to be created', - ); - $params['group_id'] = array( - 'title' => 'id of existing group for domain', - 'description' => 'If not populated another will be created using the name' - ); - $params['contact_id'] = array( - 'title' => 'id of existing contact for domain', - 'description' => 'If not populated another will be created using the name' - ); -} diff --git a/tools/extensions/org.civicrm.multisite/info.xml b/tools/extensions/org.civicrm.multisite/info.xml deleted file mode 100644 index dafd8f19f2..0000000000 --- a/tools/extensions/org.civicrm.multisite/info.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - multisite - CiviCRM Multisite - Multisite permissioning for CiviCRM - - http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=80805988 - http://forum.civicrm.org/index.php/board,51.0.html - http://civicrm.org/licensing - - AGPL - - CiviCRM LLC - info@civicrm.org - - 2013-02-15 - 1.0 - stable - - 4.2 - 4.3 - - This is a port of the CiviCRM multisite module to an extension - - CRM/Multisite - - diff --git a/tools/extensions/org.civicrm.multisite/multisite.civix.php b/tools/extensions/org.civicrm.multisite/multisite.civix.php deleted file mode 100644 index 48d7b895d8..0000000000 --- a/tools/extensions/org.civicrm.multisite/multisite.civix.php +++ /dev/null @@ -1,176 +0,0 @@ -template_dir ) ) { - array_unshift( $template->template_dir, $extDir ); - } else { - $template->template_dir = array( $extDir, $template->template_dir ); - } - - $include_path = $extRoot . PATH_SEPARATOR . get_include_path( ); - set_include_path( $include_path ); -} - -/** - * (Delegated) Implementation of hook_civicrm_alterSettingsMetaData - * @param null $metaDataFolders - */ -function _multisite_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { - static $configured = FALSE; - if ($configured) return; - $configured = TRUE; - - $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; - $extDir = $extRoot . 'settings'; - if(!in_array($extDir, $metaDataFolders)){ - $metaDataFolders[] = $extDir; - } -} - -/** - * (Delegated) Implementation of hook_civicrm_xmlMenu - * - * @param $files array(string) - */ -function _multisite_civix_civicrm_xmlMenu(&$files) { - foreach (glob(__DIR__ . '/xml/Menu/*.xml') as $file) { - $files[] = $file; - } -} - -/** - * Implementation of hook_civicrm_install - */ -function _multisite_civix_civicrm_install() { - _multisite_civix_civicrm_config(); - civicrm_api('system', 'flush', array('version' => 3)); - civicrm_api('settings', 'fill', array('version' => 3)); - if ($upgrader = _multisite_civix_upgrader()) { - return $upgrader->onInstall(); - } -} - -/** - * Implementation of hook_civicrm_uninstall - */ -function _multisite_civix_civicrm_uninstall() { - _multisite_civix_civicrm_config(); - if ($upgrader = _multisite_civix_upgrader()) { - return $upgrader->onUninstall(); - } -} - -/** - * (Delegated) Implementation of hook_civicrm_enable - */ -function _multisite_civix_civicrm_enable() { - _multisite_civix_civicrm_config(); - if ($upgrader = _multisite_civix_upgrader()) { - if (is_callable(array($upgrader, 'onEnable'))) { - return $upgrader->onEnable(); - } - } -} - -/** - * (Delegated) Implementation of hook_civicrm_disable - */ -function _multisite_civix_civicrm_disable() { - _multisite_civix_civicrm_config(); - if ($upgrader = _multisite_civix_upgrader()) { - if (is_callable(array($upgrader, 'onDisable'))) { - return $upgrader->onDisable(); - } - } -} - -/** - * (Delegated) Implementation of hook_civicrm_upgrade - * - * @param $op string, the type of operation being performed; 'check' or 'enqueue' - * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks - * - * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) - * for 'enqueue', returns void - */ -function _multisite_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { - if ($upgrader = _multisite_civix_upgrader()) { - return $upgrader->onUpgrade($op, $queue); - } -} - -/** - * @return null - */ -function _multisite_civix_upgrader() { - if (!file_exists(__DIR__.'/CRM/Multisite/Upgrader.php')) { - return NULL; - } else { - return CRM_Multisite_Upgrader_Base::instance(); - } -} - -/** - * Search directory tree for files which match a glob pattern - * - * @param $dir string, base dir - * @param $pattern string, glob pattern, eg "*.txt" - * @return array(string) - */ -function _multisite_civix_find_files($dir, $pattern) { - $todos = array($dir); - $result = array(); - while (!empty($todos)) { - $subdir = array_shift($todos); - foreach (glob("$subdir/$pattern") as $match) { - if (!is_dir($match)) { - $result[] = $match; - } - } - if ($dh = opendir($subdir)) { - while (FALSE !== ($entry = readdir($dh))) { - $path = $subdir . DIRECTORY_SEPARATOR . $entry; - if ($entry == '.' || $entry == '..') { - } elseif (is_dir($path)) { - $todos[] = $path; - } - } - closedir($dh); - } - } - return $result; -} - -/** - * (Delegated) Implementation of hook_civicrm_managed - * - * Find any *.mgd.php files, merge their content, and return. - * @param $entities - */ -function _multisite_civix_civicrm_managed(&$entities) { - $mgdFiles = _multisite_civix_find_files(__DIR__, '*.mgd.php'); - foreach ($mgdFiles as $file) { - $es = include $file; - foreach ($es as $e) { - if (empty($e['module'])) { - $e['module'] = 'nz.co.fuzion.multisite'; - } - $entities[] = $e; - } - } -} diff --git a/tools/extensions/org.civicrm.multisite/multisite.php b/tools/extensions/org.civicrm.multisite/multisite.php deleted file mode 100644 index c923b305b2..0000000000 --- a/tools/extensions/org.civicrm.multisite/multisite.php +++ /dev/null @@ -1,311 +0,0 @@ - 3, - 'contact_id' => $objectRef->contact_id, - 'uf_id' => $objectRef->uf_id, - 'id' => array( - '!=' => $objectRef->id - ) - )); - foreach ($ufs['values'] as $ufMatch) { - civicrm_api('UFMatch', 'create', array( - 'version' => 3, - 'id' => $ufMatch['id'], - 'uf_name' => $objectRef->uf_name - )); - } - } -} -/** - * - * @param unknown_type $type - * @param unknown_type $contactID - * @param unknown_type $tableName - * @param unknown_type $allGroups - * @param unknown_type $currentGroups - */ -function multisite_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) { - // only process saved search - if ($tableName != 'civicrm_saved_search') { - return; - } - $groupID = _multisite_get_domain_group(); - if(!$groupID){ - return; - } - $currentGroups = _multisite_get_all_child_groups($groupID, FALSE); -} - -/** - * - * @param string $type - * @param array $tables tables to be included in query - * @param array $whereTables tables required for where portion of query - * @param integer $contactID contact for whom where clause is being composed - * @param string $where Where clause The completed clause will look like - * (multisiteGroupTable.group_id IN ("1,2,3,4,5") AND multisiteGroupTable.status IN ('Added') AND contact_a.is_deleted = 0) - * where the child groups are groups the contact is potentially a member of - * - */ -function multisite_civicrm_aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) { - if (! $contactID) { - return; - } - if(!_multisite_add_permissions($type)){ - return; - } - $groupID = _multisite_get_domain_group(); - if(!$groupID){ - return; - } - $childOrgs = _multisite_get_all_child_groups($groupID); - - if (! empty($childOrgs)) { - $groupTable = 'civicrm_group_contact'; - $tables[$groupTable] = $whereTables[$groupTable] = "LEFT JOIN {$groupTable} multisiteGroupTable ON contact_a.id = multisiteGroupTable.contact_id"; - - $where = "(multisiteGroupTable.group_id IN (" . implode(',', $childOrgs) . ") AND multisiteGroupTable.status IN ('Added') AND contact_a.is_deleted = 0)"; - } -} -/** - * - * @param array $permissions - */ -function multisite_civicrm_permissions(&$permissions){ - $prefix = ts('CiviCRM Multisite') . ': '; - $permissions = $permissions + array( - 'view all contacts in domain' => $prefix . ts('view all contacts in domain'), - 'edit all contacts in domain' => $prefix . ts('edit all contacts in domain'), - ); -} - -/** - * Implementation of hook_civicrm_config - * @param null $metaDataFolders - */ -function multisite_civicrm_alterSettingsFolders(&$metaDataFolders = NULL){ - _multisite_civix_civicrm_alterSettingsFolders($metaDataFolders); -} - -/** - * Get all groups that are children of the parent group - * (iterate through all levels) - * - * @param integer $groupID - * @param boolean $includeParent - * @return array:child groups - */ -function _multisite_get_all_child_groups($groupID, $includeParent = TRUE) { - static $_cache = array(); - - if (! array_key_exists($groupID, $_cache)) { - $childGroups = &CRM_Core_BAO_Cache::getItem('descendant groups for an org', $groupID); - - if (empty($childGroups)) { - $childGroups = array(); - - $query = " -SELECT children -FROM civicrm_group -WHERE children IS NOT NULL -AND id IN "; - - if (! is_array($groupID)) { - $groupIDs = array( - $groupID - ); - } - - while (! empty($groupIDs)) { - $groupIDString = implode(',', $groupIDs); - - $realQuery = $query . " ( $groupIDString )"; - $dao = CRM_Core_DAO::executeQuery($realQuery); - $groupIDs = array(); - while ($dao->fetch()) { - if ($dao->children) { - $childIDs = explode(',', $dao->children); - foreach ($childIDs as $childID) { - if (! array_key_exists($childID, $childGroups)) { - $childGroups[$childID] = 1; - $groupIDs[] = $childID; - } - } - } - } - } - - CRM_Core_BAO_Cache::setItem($childGroups, 'descendant groups for an org', $groupID); - } - $_cache[$groupID] = $childGroups; - } - - if ($includeParent || CRM_Core_Permission::check('administer Multiple Organizations')) { - return array_keys(array( - $groupID => 1 - ) + $_cache[$groupID]); - } - else { - return array_keys($_cache[$groupID]); - } -} - -/** - * - * @param int $permission - * - * @return NULL|integer $groupID - */ -function _multisite_get_domain_group($permission = 1) { - $groupID = CRM_Core_BAO_Domain::getGroupId(); - if(empty($groupID) || !is_numeric($groupID)){ - /* domain group not defined - we could let people know but - * it is acceptable for some domains not to be in the multisite - * so should probably check enabled before we spring an error - */ - return NULL; - } - // We will check for the possibility of the acl_enabled setting being deliberately set to 0 - if($permission){ - $aclsEnabled = civicrm_api('setting', 'getvalue', array( - 'version' => 3, - 'name' => 'multisite_acl_enabled', - 'group' => 'Multi Site Preferences') - ); - if(is_numeric($aclsEnabled) && !$aclsEnabled){ - return NULL; - } - } - - return $groupID; - } - -/** - * Should we be adding ACLs in this instance. If we don't add them the user - * will not be able to see anything. We check if the install has the permissions - * hook implemented correctly & if so only allow view & edit based on those. - * - * Otherwise all users get these permissions added (4.2 vs 4.3 / other CMS issues) - * - * @param integer $type type of operation - * - * @return bool - */ - function _multisite_add_permissions($type){ - $hookclass = 'CRM_Utils_Hook'; - if(!method_exists($hookclass, 'permissions')){ - // ie. unpatched 4.2 so we can't check for extra declared permissions - // & default to applying this to all - return TRUE; - } - // extra check to make sure that hook is properly implemented - // if not we won't check for it. NB view all contacts in domain is enough checking - $declaredPermissions = CRM_Core_Permission::getCorePermissions(); - if(!array_key_exists('view all contacts in domain', $declaredPermissions)){ - drupal_set_message('here'); - return TRUE; - } - - if(CRM_ACL_BAO_ACL::matchType($type, 'View') && - CRM_Core_Permission::check('view all contacts in domain')) { - return TRUE; - } - - if(CRM_ACL_BAO_ACL::matchType($type, 'Edit') && - CRM_Core_Permission::check('edit all contacts in domain')) { - return TRUE; - } - return FALSE; - } - diff --git a/tools/extensions/org.civicrm.multisite/settings/Multisite.setting.php b/tools/extensions/org.civicrm.multisite/settings/Multisite.setting.php deleted file mode 100644 index 91388905b0..0000000000 --- a/tools/extensions/org.civicrm.multisite/settings/Multisite.setting.php +++ /dev/null @@ -1,52 +0,0 @@ - array( - 'group_name' => 'Multi Site Preferences', - 'group' => 'multisite', - 'name' => 'multisite_acl_enabled', - 'type' => 'Integer', - 'default' => 1, - 'add' => '4.3', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Multisite ACL is enabled', - 'help_text' => 'Should multisite based ACLs be enabled for this site', - ), - ); -- 2.25.1