Skip to content

Commit

Permalink
add sandbox config switch
Browse files Browse the repository at this point in the history
  • Loading branch information
dennmuel committed Apr 11, 2019
1 parent 3324ba2 commit 90b2882
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions cfg/cfg.d/z_orcid_support_advance.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
$c->{orcid_support_advance}->{client_id} = "XXXX";
$c->{orcid_support_advance}->{client_secret} = "YYYY";

$c->{orcid_support_advance}->{orcid_apiv2} = "https://api.sandbox.orcid.org/v2.0/";
$c->{orcid_support_advance}->{orcid_org_auth_uri} = "https://sandbox.orcid.org/oauth/authorize";
$c->{orcid_support_advance}->{orcid_org_exch_uri} = "https://api.sandbox.orcid.org/oauth/token";
# Use sandbox.orcid.org for testing or orcid.org for production
$c->{orcid_support_advance}->{orcid_domain} = "sandbox.orcid.org";
$c->{orcid_support_advance}->{orcid_apiv2} = "https://api." . $c->{orcid_support_advance}->{orcid_domain} . "/v2.0/";
$c->{orcid_support_advance}->{orcid_org_auth_uri} = "https://" . $c->{orcid_support_advance}->{orcid_domain} . "/oauth/authorize";
$c->{orcid_support_advance}->{orcid_org_exch_uri} = "https://" . $c->{orcid_support_advance}->{orcid_domain} . "/oauth/token";
$c->{orcid_support_advance}->{redirect_uri} = $c->{"perl_url"} . "/orcid/authenticate";

# Decide if the pre-commit trigger should keep (0) or delete (1) non authenticated orcid ids,
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfg.d/z_orcid_support_advance_rdf_triples.pl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
my $e_given = $all_people->{$person_uri}->{name}->{given} || "";
my $e_family = $all_people->{$person_uri}->{name}->{family} || "";
my $e_orcid = "";
$e_orcid = "http://orcid.org/" . $all_people->{$person_uri}->{orcid} if defined $all_people->{$person_uri}->{orcid};
$e_orcid = "http://" . $c->{orcid_support_advance}->{orcid_domain} . "/" . $all_people->{$person_uri}->{orcid} if defined $all_people->{$person_uri}->{orcid};

$o{"graph"}->add(
secondary_resource => $person_uri,
Expand Down
6 changes: 3 additions & 3 deletions lib/plugins/EPrints/Plugin/Screen/ExportToOrcid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ sub action_export{
# Identify response code by parsing XML with ORCID namespace
my $dom = XML::LibXML->load_xml( string => $result->content() );
my $xpc = XML::LibXML::XPathContext->new($dom);
$xpc->registerNs('orcid_error', 'http://www.orcid.org/ns/error');
$xpc->registerNs('orcid_error', 'http://www.' . $repo->config( "orcid_support_advance", "orcid_domain" ) . '/ns/error');
my($error_nodes) = $xpc->findnodes('//orcid_error:error');

#get orcid error code
Expand Down Expand Up @@ -824,9 +824,9 @@ sub eprint_to_orcid_work
if( defined( $contributor->{"orcid"} ))
{
my $orcid_details = {
"uri" => "http://orcid.org/" . $contributor->{"orcid"},
"uri" => "http://" . $repo->config( "orcid_support_advance", "orcid_domain" ) . "/" . $contributor->{"orcid"},
"path" => $contributor->{"orcid"},
"host" => "orcid.org",
"host" => $repo->config( "orcid_support_advance", "orcid_domain" ),
};
$orcid_contributor->{"contributor-orcid"} = $orcid_details;
}
Expand Down

0 comments on commit 90b2882

Please sign in to comment.