Skip to content
Snippets Groups Projects
Commit ffdc26b8 authored by eileen's avatar eileen
Browse files

#2017 Remove unused function OpenID::isAllowedToLogin

parent fd364ea9
Branches
Tags
No related merge requests found
......@@ -43,23 +43,6 @@ class CRM_Core_BAO_OpenID extends CRM_Core_DAO_OpenID {
return CRM_Core_BAO_Block::getValues('openid', $entityBlock);
}
/**
* Returns whether or not this OpenID is allowed to login.
*
* @param string $identity_url
* The OpenID to check.
*
* @return bool
*/
public static function isAllowedToLogin($identity_url) {
$openId = new CRM_Core_DAO_OpenID();
$openId->openid = $identity_url;
if ($openId->find(TRUE)) {
return $openId->allowed_to_login == 1;
}
return FALSE;
}
/**
* Get all the openids for a specified contact_id, with the primary openid being first
*
......
......@@ -62,51 +62,6 @@ class CRM_Core_BAO_OpenIDTest extends CiviUnitTestCase {
$this->assertDBRowNotExist('CRM_Contact_DAO_Contact', $contactId);
}
/**
* IfAllowedToLogin() method (set and reset allowed_to_login)
*/
public function testIfAllowedToLogin() {
$contactId = $this->individualCreate();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
$openIdURL = "http://test-username.civicrm.org/";
$params = [
'contact_id' => $contactId,
'location_type_id' => 1,
'openid' => $openIdURL,
'is_primary' => 1,
];
$openObject = CRM_Core_BAO_OpenID::add($params);
$openId = $openObject->id;
$this->assertDBNotNull('CRM_Core_DAO_OpenID', $openIdURL, 'id', 'openid',
'Database check for created OpenID.'
);
$allowedToLogin = CRM_Core_BAO_OpenID::isAllowedToLogin($openIdURL);
$this->assertEquals($allowedToLogin, FALSE, 'Verify allowed_to_login value is 0.');
// Now call add() to modify an existing open-id record
$params = [
'id' => $openId,
'contact_id' => $contactId,
'openid' => $openIdURL,
'is_bulkmail' => 1,
'allowed_to_login' => 1,
];
CRM_Core_BAO_OpenID::add($params);
$allowedToLogin = CRM_Core_BAO_OpenID::isAllowedToLogin($openIdURL);
$this->assertEquals($allowedToLogin, TRUE, 'Verify allowed_to_login value is 1.');
$this->contactDelete($contactId);
//domain contact doesn't really get deleted //
$this->assertDBRowNotExist('CRM_Contact_DAO_Contact', $contactId);
}
/**
* AllOpenIDs() method - get all OpenIDs for the given contact
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment