* @param candidate The service description to check access rights for
* @return True, if access to the candidate is either unrestricted or the user is logged in via UI and authorized to
* see the description
*/
static boolean authorized(final ServiceDescription candidate) {
Property allowedRolesProperty = getProperty(ServiceDescription.AUTHORIZED_ROLES, candidate);
if (allowedRolesProperty == null) {
/* No access restriction in this service description: */
return true;
}
/* Check the authorization for this description based on the UI authentication: */
FacesContext context = FacesContext.getCurrentInstance();
if (context != null && context.getExternalContext() != null) {
String allowedRoles = allowedRolesProperty.getValue();
String[] roles = allowedRoles.split(",");
for (String role : roles) {
role = role.trim();
boolean userInRole = context.getExternalContext().isUserInRole(role);
if (userInRole) {