protected Consent usability() { return objectMember.isUsable(getSession(), objectAdapter, where); }
protected Consent usability() { return objectMember.isUsable(objectAdapter, getInteractionInitiatedBy(), where); }
protected Consent usability() { return objectMember.isUsable(getRendererContext().getAuthenticationSession(), objectAdapter, where); }
private void checkUsability( final ObjectAdapter targetObjectAdapter, final ObjectMember objectMember) { final InteractionResult interactionResult = objectMember.isUsable(targetObjectAdapter, getInteractionInitiatedBy(), where ).getInteractionResult(); notifyListenersAndVetoIfRequired(interactionResult); }
public Consent usableMemberConsent() { return getObjectMember().isUsable(getAuthenticationSession(), getOnAdapter()); }
public void ensureUsable(final CellBinding onMemberBinding, final ScenarioCell onMemberCell) throws ScenarioBoundValueException { final Consent usable = objectMember.isUsable(getAuthenticationSession(), getOnAdapter()); if (usable.isVetoed()) { throw ScenarioBoundValueException.current(onMemberBinding, "(not usable)"); } }
@Override public AuthorizationResponse authorizeUsability(final AuthorizationRequestUsability request) { final ObjectAdapter targetAdapter = encoderDecoder.decode(request.getTarget()); final boolean allowed = getMember(request.getIdentifier()).isUsable(request.getSession(), targetAdapter).isAllowed(); return encoderDecoder.encodeAuthorizeResponse(allowed); }
protected <T extends ObjectMember> T memberThatIsVisibleAndUsable(final T objectMember, final MemberType memberType, final Intent intent, Where where) { final String memberId = objectMember.getId(); final AuthenticationSession authenticationSession = resourceContext.getAuthenticationSession(); if (objectMember.isVisible(authenticationSession, objectAdapter, where).isVetoed()) { throwNotFoundException(memberId, memberType); } if (intent.isMutate()) { final Consent usable = objectMember.isUsable(authenticationSession, objectAdapter, where); if (usable.isVetoed()) { final String memberTypeStr = memberType.name().toLowerCase(); throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE, "%s is not usable: '%s' (%s)", memberTypeStr, memberId, usable.getReason()); } } return objectMember; }
protected <T extends ObjectMember> T memberThatIsVisibleForIntent(final T objectMember, final MemberType memberType, final Intent intent, Where where) { final String memberId = objectMember.getId(); final AuthenticationSession authenticationSession = resourceContext.getAuthenticationSession(); if (objectMember.isVisible(authenticationSession, objectAdapter, where).isVetoed()) { throwNotFoundException(memberId, memberType); } if (intent.isMutate()) { final Consent usable = objectMember.isUsable(authenticationSession, objectAdapter, where); if (usable.isVetoed()) { throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.FORBIDDEN, usable.getReason()); } } return objectMember; }
public <T extends ObjectMember> T memberThatIsVisibleForIntent( final T objectMember, final MemberType memberType, final Intent intent) { final Where where = rendererContext.getWhere(); final String memberId = objectMember.getId(); final Consent visibilityConsent = objectMember.isVisible( objectAdapter, InteractionInitiatedBy.USER, where); if (visibilityConsent.isVetoed()) { throwNotFoundException(memberId, memberType); } if (intent.isMutate()) { final Consent usabilityConsent = objectMember.isUsable( objectAdapter, InteractionInitiatedBy.USER, where ); if (usabilityConsent.isVetoed()) { throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.FORBIDDEN, usabilityConsent.getReason()); } } return objectMember; }