Revision 9051
Added by Jing Tao about 10 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
1236 | 1236 |
|
1237 | 1237 |
// cannot be called by public |
1238 | 1238 |
if (session == null) { |
1239 |
throw new InvalidToken("2183", "No session was provided.");
|
|
1239 |
throw new InvalidToken("1332", "No session was provided.");
|
|
1240 | 1240 |
} |
1241 | 1241 |
|
1242 |
String serviceFailureCode = "1333"; |
|
1243 |
Identifier sid = getPIDForSID(pid, serviceFailureCode); |
|
1244 |
if(sid != null) { |
|
1245 |
pid = sid; |
|
1246 |
} |
|
1247 |
|
|
1242 | 1248 |
SystemMetadata currentLocalSysMeta = null; |
1243 | 1249 |
SystemMetadata newSysMeta = null; |
1244 | 1250 |
CNode cn = D1Client.getCN(); |
src/edu/ucsb/nceas/metacat/dataone/v1/MNodeService.java | ||
---|---|---|
463 | 463 |
public boolean isAuthorized(Identifier pid, Permission permission) |
464 | 464 |
throws ServiceFailure, InvalidRequest, InvalidToken, NotFound, |
465 | 465 |
NotAuthorized, NotImplemented { |
466 |
String serviceFailure = "1760"; |
|
467 |
String notFound = "1800"; |
|
468 |
impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists", notFound, |
|
469 |
"The object specified by "+pid.getValue()+" does not exist at this node."); |
|
466 | 470 |
return impl.isAuthorized(null, pid, permission); |
467 | 471 |
} |
468 | 472 |
|
... | ... | |
471 | 475 |
public boolean isAuthorized(Session session, Identifier pid, Permission permission) |
472 | 476 |
throws ServiceFailure, InvalidRequest, InvalidToken, NotFound, |
473 | 477 |
NotAuthorized, NotImplemented { |
478 |
String serviceFailure = "1760"; |
|
479 |
String notFound = "1800"; |
|
480 |
impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists", notFound, |
|
481 |
"The object specified by "+pid.getValue()+" does not exist at this node."); |
|
474 | 482 |
return impl.isAuthorized(session, pid, permission); |
475 | 483 |
} |
476 | 484 |
|
... | ... | |
478 | 486 |
public boolean systemMetadataChanged(Identifier pid, long serialVersion, Date dateSysMetaLastModified) |
479 | 487 |
throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented, |
480 | 488 |
InvalidRequest { |
489 |
String serviceFailure = "1333"; |
|
490 |
String notFound = "1800"; |
|
491 |
try { |
|
492 |
impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata of the object specified by "+pid.getValue()+" couldn't be identified if it exists", notFound, |
|
493 |
"The system metadata of the object specified by "+pid.getValue()+" does not exist at this node."); |
|
494 |
} catch (NotFound e) { |
|
495 |
throw new ServiceFailure(serviceFailure, e.getMessage()); |
|
496 |
} |
|
481 | 497 |
return impl.systemMetadataChanged(null, pid, serialVersion, dateSysMetaLastModified); |
482 | 498 |
|
483 | 499 |
} |
... | ... | |
487 | 503 |
public boolean systemMetadataChanged(Session session, Identifier pid, |
488 | 504 |
long serialVersion, Date dateSysMetaLastModified) throws InvalidToken, ServiceFailure, |
489 | 505 |
NotAuthorized, NotImplemented, InvalidRequest { |
506 |
String serviceFailure = "1333"; |
|
507 |
String notFound = "1800"; |
|
508 |
try { |
|
509 |
impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata of the object specified by "+pid.getValue()+" couldn't be identified if it exists", notFound, |
|
510 |
"The system metadata of the object specified by "+pid.getValue()+" does not exist at this node."); |
|
511 |
} catch (NotFound e) { |
|
512 |
throw new ServiceFailure(serviceFailure, e.getMessage()); |
|
513 |
} |
|
490 | 514 |
return impl.systemMetadataChanged(session, pid, serialVersion, dateSysMetaLastModified); |
491 | 515 |
} |
492 | 516 |
|
src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java | ||
---|---|---|
580 | 580 |
public boolean isAuthorized(Identifier pid, Permission permission) |
581 | 581 |
throws ServiceFailure, InvalidToken, NotFound, NotAuthorized, |
582 | 582 |
NotImplemented, InvalidRequest { |
583 |
String serviceFailure = "1760"; |
|
584 |
String notFound = "1800"; |
|
585 |
impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists", notFound, |
|
586 |
"The object specified by "+pid.getValue()+" does not exist at this node."); |
|
583 | 587 |
return impl.isAuthorized(null, pid, permission); |
584 | 588 |
} |
585 | 589 |
|
... | ... | |
588 | 592 |
public boolean isAuthorized(Session session, Identifier pid, Permission permission) |
589 | 593 |
throws ServiceFailure, InvalidToken, NotFound, NotAuthorized, |
590 | 594 |
NotImplemented, InvalidRequest { |
595 |
String serviceFailure = "1760"; |
|
596 |
String notFound = "1800"; |
|
597 |
impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists", notFound, |
|
598 |
"The object specified by "+pid.getValue()+" does not exist at this node."); |
|
591 | 599 |
return impl.isAuthorized(session, pid, permission); |
592 | 600 |
} |
593 | 601 |
|
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java | ||
---|---|---|
1046 | 1046 |
|
1047 | 1047 |
} |
1048 | 1048 |
|
1049 |
String serviceFailureCode = "1760"; |
|
1050 |
Identifier sid = getPIDForSID(pid, serviceFailureCode); |
|
1051 |
if(sid != null) { |
|
1052 |
pid = sid; |
|
1053 |
} |
|
1054 |
|
|
1049 | 1055 |
// the authoritative member node of the pid always has the access as well. |
1050 | 1056 |
if (isAuthoritativeMNodeAdmin(session, pid)) { |
1051 | 1057 |
allowed = true; |
Also available in: Unified diff
Add the code to support the sereis id on isAuthorized and systemMetadataChanged method.