| | 77 | } |
| | 78 | |
| | 79 | private void provisionRole( |
| | 80 | LocalAuthSession localAuthSession, |
| | 81 | String strSessionID, |
| | 82 | String strEntityID, |
| | 83 | String strRoleID, |
| | 84 | Map responseMap) throws OtisException |
| | 85 | { |
| | 86 | try |
| | 87 | { |
| | 88 | IObligation ob = localAuthSession.provisionEntityInRole(strEntityID, strRoleID); |
| | 89 | } |
| | 90 | catch (AuthSessionException e) |
| | 91 | { |
| | 92 | throwException( new OtisErrMsg( "RoleHandler(PUT): Exception " + e.getClass().getName() + " calling activateRole", |
| | 93 | OtisErrMsg.OPTIONAL_STR( "('" + strRoleID + "')"), |
| | 94 | " for session", |
| | 95 | OtisErrMsg.OPTIONAL_STR( " '" + strSessionID + "': " + e.getMessage())), |
| | 96 | e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); |
| | 97 | } |
| | 98 | } |
| | 99 | private void deprovisionRole( |
| | 100 | LocalAuthSession localAuthSession, |
| | 101 | String strSessionID, |
| | 102 | String strEntityID, |
| | 103 | String strRoleID, |
| | 104 | Map responseMap) throws OtisException |
| | 105 | { |
| | 106 | try |
| | 107 | { |
| | 108 | IObligation ob = localAuthSession.deProvisionEntityInRole(strEntityID, strRoleID); |
| | 109 | } |
| | 110 | catch (AuthSessionException e) |
| | 111 | { |
| | 112 | throwException( new OtisErrMsg( "RoleHandler(PUT): Exception " + e.getClass().getName() + " calling activateRole", |
| | 113 | OtisErrMsg.OPTIONAL_STR( "('" + strRoleID + "')"), |
| | 114 | " for session", |
| | 115 | OtisErrMsg.OPTIONAL_STR( " '" + strSessionID + "': " + e.getMessage())), |
| | 116 | e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); |
| | 117 | } |
| 542 | | if (!strRoleType.equals( Constants.NOUN_ACTIVE_ROLES)) |
| | 584 | if ( strRoleType.equals( Constants.NOUN_ACTIVE_ROLES)) |
| | 585 | { |
| | 586 | if (nounList.size() > iMainNounPos + 1) |
| | 587 | { |
| | 588 | throwException( new OtisErrMsg( "RoleHandler(PUT): Cannot PUT on noun specified in URL", |
| | 589 | OtisErrMsg.OPTIONAL_STR( " '" + request.getRequestURL().toString() + "'")), |
| | 590 | null, HttpServletResponse.SC_METHOD_NOT_ALLOWED, responseMap); |
| | 591 | } |
| | 592 | activateRole( localAuthSession, strSessionID, requestDoc, responseMap); |
| | 593 | } |
| | 594 | else if ( strRoleType.equals( Constants.NOUN_DEPROVISION_ROLE)) |
| | 595 | { |
| | 596 | if (nounList.size() < iMainNounPos + 3) |
| | 597 | { |
| | 598 | throwException( new OtisErrMsg( "RoleHandler(PUT): No role subnoun specified after the session ID in URL", |
| | 599 | OtisErrMsg.OPTIONAL_STR( " '" + request.getRequestURL().toString() + "'")), |
| | 600 | null, HttpServletResponse.SC_NOT_FOUND, responseMap); |
| | 601 | } |
| | 602 | String entityId = (String)nounList.get( iMainNounPos+1); |
| | 603 | String roleId = (String)nounList.get( iMainNounPos+2); |
| | 604 | deprovisionRole(localAuthSession, strSessionID, entityId, roleId, responseMap); |
| | 605 | } |
| | 606 | else if ( strRoleType.equals( Constants.NOUN_PROVISION_ROLE)) |
| | 607 | { |
| | 608 | if (nounList.size() < iMainNounPos + 3) |
| | 609 | { |
| | 610 | throwException( new OtisErrMsg( "RoleHandler(PUT): No role subnoun specified after the session ID in URL", |
| | 611 | OtisErrMsg.OPTIONAL_STR( " '" + request.getRequestURL().toString() + "'")), |
| | 612 | null, HttpServletResponse.SC_NOT_FOUND, responseMap); |
| | 613 | } |
| | 614 | String entityId = (String)nounList.get( iMainNounPos+1); |
| | 615 | String roleId = (String)nounList.get( iMainNounPos+2); |
| | 616 | provisionRole(localAuthSession, strSessionID, entityId, roleId, responseMap); |
| | 617 | } |
| | 618 | else |
| 546 | | null, HttpServletResponse.SC_METHOD_NOT_ALLOWED, responseMap); |
| 547 | | } |
| 548 | | if (nounList.size() > iMainNounPos + 1) |
| 549 | | { |
| 550 | | throwException( new OtisErrMsg( "RoleHandler(PUT): Cannot PUT on noun specified in URL", |
| 551 | | OtisErrMsg.OPTIONAL_STR( " '" + request.getRequestURL().toString() + "'")), |
| 552 | | null, HttpServletResponse.SC_METHOD_NOT_ALLOWED, responseMap); |
| 553 | | } |
| 554 | | activateRole( localAuthSession, strSessionID, requestDoc, responseMap); |
| | 622 | null, HttpServletResponse.SC_METHOD_NOT_ALLOWED, responseMap); |
| | 623 | } |
| | 624 | |