Skip to content

Commit

Permalink
Merge pull request #59 from ioigoume/FIX_remove_core_changes_related_…
Browse files Browse the repository at this point in the history
…to_rcauth_initial_implementation

FIX_remove_core_changes_related_to_rcauth_initial_implementation
  • Loading branch information
NicolasLiampotis committed Jul 29, 2020
2 parents 7a44d32 + b0d49bc commit f8fff10
Show file tree
Hide file tree
Showing 32 changed files with 3 additions and 1,438 deletions.
10 changes: 0 additions & 10 deletions app/Console/Command/SetupShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,6 @@ function main() {
FROM cm_identifiers i
WHERE i.login=true;
");
$this->out("- Creating unlink_rcauth function");
$rcauth_unlink_query = "CREATE FUNCTION unlink_rcauth(_co_person_id integer, _org_identity_id integer) RETURNS void ".
"LANGUAGE plpgsql ".
"AS \$\$BEGIN ".
"update cm_names set deleted='true' where id in (select id from cm_names where type='alternate' and co_person_id=_co_person_id or org_identity_id=_org_identity_id) and deleted <> 'true'; ".
"update cm_org_identities set deleted='true' where org_identity_id=_org_identity_id and deleted <> 'true'; ".
"update cm_certs set deleted='true' where id in (select id from cm_certs where co_person_id=_co_person_id or org_identity_id=_org_identity_id) and deleted <> 'true'; ".
"update cm_org_identities set deleted='true' where id=_org_identity_id and deleted <> 'true'; ".
"END;\$\$;";
$this->Identifier->query($rcauth_unlink_query);

// We need the following:
// - The COmanage CO
Expand Down
29 changes: 0 additions & 29 deletions app/Controller/CoOrgIdentityLinksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,33 +276,4 @@ function performRedirect() {
'co' => filter_var($this->cur_co['Co']['id'],FILTER_SANITIZE_SPECIAL_CHARS)));
}
}

/**
* @param $id
* @return bool|void
*/
public function delete($id) {
// Here call my procedure that will softly remove all the dependencies
// if the org identity link id belongs to RCAuth orgidentity
$ret = $this->CoOrgIdentityLink->find('first', array(
'conditions' => array('CoOrgIdentityLink.id' => $id)
));

$this->log("res => ".print_r($ret,true),LOG_DEBUG);
if(isset($ret['CoOrgIdentityLink']['co_person_id']) && isset($ret['CoOrgIdentityLink']['org_identity_id'])) {
#ioigoume
$this->log("Soft deleting RCAuth dependencies.");
$co_person_id = $ret['CoOrgIdentityLink']['co_person_id'];
$org_identity_id = $ret['CoOrgIdentityLink']['org_identity_id'];
// Call and execute the stored procedure
try {
$query = "select unlink_rcauth({$co_person_id},{$org_identity_id})";
$this->CoOrgIdentityLink->query($query);
} catch (Exception $e) {
$this->log("caught exception => " . $e, LOG_DEBUG);
return false;
}
}
parent::delete($id);
}
}
10 changes: 3 additions & 7 deletions app/Model/OrgIdentitySource.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ public function createOrgIdentity($id,
$coId=null,
$targetCoPersonId=null,
$provision=true,
$coPetitionId=null,
$retrieve=true,
$brec=null) {
$coPetitionId=null) {
// Unlike CoPipeline::syncOrgIdentityToCoPerson, we have a separate call
// for create vs update. This is because $Backend->retrieve() will return
// data in a format that is more or less ready for a direct save.
Expand All @@ -285,10 +283,8 @@ public function createOrgIdentity($id,
throw new OverflowException(_txt('er.ois.linked'));
}

if ($retrieve) {
// Pull record from source
$brec = $this->retrieve($id, $sourceKey);
}
// Pull record from source
$brec = $this->retrieve($id, $sourceKey);

// This will throw an exception if invalid
$this->validateOISRecord($brec);
Expand Down
57 changes: 0 additions & 57 deletions local/Plugin/RcauthSource/Config/Schema/schema.xml

This file was deleted.

Empty file.
Empty file.
Empty file.

This file was deleted.

Loading

0 comments on commit f8fff10

Please sign in to comment.