Source:
<code>protected Response getAccount(final String accountSid, final MediaType responseType, UriInfo info, UserIdentityContext userIdentityContext) { Account account = null; permissionEvaluator.checkPermission("RestComm:Read:Accounts",userIdentityContext); if (Sid.pattern.matcher(accountSid).matches()) { try { account = accountsDao.getAccount(new Sid(accountSid)); } catch (Exception e) { return status(NOT_FOUND).build(); } } else { try { account = accountsDao.getAccount(accountSid); } catch (Exception e) { return status(NOT_FOUND).build(); } } URI baseUri = info.getBaseUri(); Organization org = organizationsDao.getOrganization(account.getOrganizationSid()); String accountOrgDomain = org.getDomainName(); <START> if (!accountOrgDomain.equalsIgnoreCase(baseUri.getHost().toString())) { <END> return status(FORBIDDEN).entity("Account is not allowed to access requested organization").build(); } permissionEvaluator.secure(account, "RestComm:Read:Accounts", SecuredType.SECURED_ACCOUNT,userIdentityContext ); if (account == null) { return status(NOT_FOUND).build(); } else { Response.ResponseBuilder ok = Response.ok(); Profile associatedProfile = profileService.retrieveEffectiveProfileByAccountSid(account.getSid()); if (associatedProfile != null) { LinkHeader profileLink = composeLink(new Sid(associatedProfile.getSid()), info); ok.header(ProfileEndpoint.LINK_HEADER, profileLink.toString()); } if (APPLICATION_XML_TYPE.equals(responseType)) { final RestCommResponse response = new RestCommResponse(account); return ok.type(APPLICATION_XML).entity(xstream.toXML(response)).build(); } else if (APPLICATION_JSON_TYPE.equals(responseType)) { return ok.type(APPLICATION_JSON).entity(gson.toJson(account)).build(); } else { return null; } } }</code><technical_language>is this validation goign apply for endpoints Account path? this apply teh GET Account operation, rest of API</technical_language>

Target:
protected Response getAccount(final String accountSid, final MediaType responseType, UriInfo info, UserIdentityContext userIdentityContext) { Account account = null; permissionEvaluator.checkPermission("RestComm:Read:Accounts",userIdentityContext); if (Sid.pattern.matcher(accountSid).matches()) { try { account = accountsDao.getAccount(new Sid(accountSid)); } catch (Exception e) { return status(NOT_FOUND).build(); } } else { try { account = accountsDao.getAccount(accountSid); } catch (Exception e) { return status(NOT_FOUND).build(); } } permissionEvaluator.secure(account, "RestComm:Read:Accounts", SecuredType.SECURED_ACCOUNT,userIdentityContext ); if (account == null) { return status(NOT_FOUND).build(); } else { Response.ResponseBuilder ok = Response.ok(); Profile associatedProfile = profileService.retrieveEffectiveProfileByAccountSid(account.getSid()); if (associatedProfile != null) { LinkHeader profileLink = composeLink(new Sid(associatedProfile.getSid()), info); ok.header(ProfileEndpoint.LINK_HEADER, profileLink.toString()); } if (APPLICATION_XML_TYPE.equals(responseType)) { final RestCommResponse response = new RestCommResponse(account); return ok.type(APPLICATION_XML).entity(xstream.toXML(response)).build(); } else if (APPLICATION_JSON_TYPE.equals(responseType)) { return ok.type(APPLICATION_JSON).entity(gson.toJson(account)).build(); } else { return null; } } }