CRM_Core_DAO::singleValueQuery('ANALYZE TABLE civicrm_acl');
$this->assertEquals([
'civicrm_worldregion' => 6,
- 'civicrm_acl' => 0,
+ 'civicrm_acl' => 1,
'civicrm_domain' => 2,
], CRM_Core_BAO_SchemaHandler::getRowCountForTables(['civicrm_domain', 'civicrm_acl', 'random_name', 'civicrm_worldregion']));
$this->assertEquals(2, CRM_Core_BAO_SchemaHandler::getRowCountForTable('civicrm_domain'));
// clear permissions stub to not check permissions
$config->userPermissionClass->permissions = NULL;
+ // Normally a stock install has some acls in the table even if they aren't in use.
+ CRM_Core_DAO::executeQuery("INSERT INTO civicrm_acl (name, deny, entity_table, entity_id, operation, object_table, object_id, acl_table, acl_id, is_active) VALUES ('Edit All Contacts', 0, 'civicrm_acl_role', 1, 'Edit', 'civicrm_group', 0, NULL, NULL, 1)");
+
//flush component settings
CRM_Core_Component::getEnabledComponents(TRUE);
CRM_Core_Transaction::forceRollbackIfEnabled();
Manager::singleton(TRUE);
- $tablesToTruncate = ['civicrm_contact', 'civicrm_uf_match', 'civicrm_email', 'civicrm_address'];
+ $tablesToTruncate = ['civicrm_contact', 'civicrm_uf_match', 'civicrm_email', 'civicrm_address', 'civicrm_acl'];
$this->quickCleanup($tablesToTruncate);
$this->createDomainContacts();
}
]));
}
+ /**
+ * This is no longer guarding against the original issue, but is still a test
+ * of something. It's now mostly testing a different variation of
+ * relationship + the default in api3 being to not check permissions.
+ */
public function testCreateWithLesserPermissions() {
- $this->setUpACLByCheating();
CRM_Core_Config::singleton()->userPermissionClass->permissions = [];
$params = [
'contact_id_a' => $this->_cId_a,
$id = $this->callAPISuccess('Relationship', 'create', $params)['id'];
$relationship = $this->callAPISuccess('Relationship', 'getsingle', ['id' => $id]);
$this->assertEquals($params, array_intersect_key($relationship, $params));
- CRM_Core_DAO::executeQuery("DELETE FROM civicrm_acl");
- }
-
- /**
- * Normally a stock install has some acls in the table even if they aren't in
- * use. I can't figure out how to set them up another way so I just lifted
- * this from civicrm_generated.mysql
- */
- private function setUpACLByCheating() {
- CRM_Core_DAO::executeQuery("INSERT INTO civicrm_acl (name, deny, entity_table, entity_id, operation, object_table, object_id, acl_table, acl_id, is_active) VALUES ('Edit All Contacts', 0, 'civicrm_acl_role', 1, 'Edit', 'civicrm_group', 0, NULL, NULL, 1)");
}
}