This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit e0308f60c2faf3d4e83046d804b8712a23038922 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Feb 13 11:57:34 2015 +0100 #6656 light QuestionBean conversion does not convert parent internal-test --- .../coselmar/converter/BeanEntityConverter.java | 8 -------- .../coselmar/services/v1/QuestionsWebService.java | 20 +++----------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java index 4c9ce3b..3d50bbd 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java @@ -253,14 +253,6 @@ public class BeanEntityConverter { } } - Collection<Question> parents = question.getParents(); - if (parents != null && !parents.isEmpty()) { - for (Question parent : parents) { - QuestionBean questionBean = toLightBean(idFactory, parent); - result.addParent(questionBean); - } - } - result.setRestricted(question.isUnavailable()); return result; } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java index e560089..dec1de1 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java @@ -340,17 +340,16 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { // Check authentication String authorization = getContext().getHeader("Authorization"); - UserWebToken userWebToken = checkAuthentication(authorization); + CoselmarUser currentUser = checkUserAuthentication(authorization); // Supervisor can get all the question elements // Expert can get all the question elements if public or if he is participant of the question // Client can get the question (not the documents) if he is client of the question. - String userRole = userWebToken.getRole(); // Member cannot access to question - if (StringUtils.equalsIgnoreCase(CoselmarUserRole.MEMBER.name(), userRole)) { + if (CoselmarUserRole.MEMBER == currentUser.getRole()) { String message = String.format("User %s %s ('%s') is not allowed to view question", - userWebToken.getFirstName(), userWebToken.getLastName(), userWebToken.getUserId()); + currentUser.getFirstname(), currentUser.getName(), getShortIdFromFull(currentUser.getTopiaId())); if (log.isWarnEnabled()) { log.warn(message); } @@ -358,19 +357,6 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { } - String fullUserId = getFullIdFromShort(CoselmarUser.class, userWebToken.getUserId()); - - CoselmarUser currentUser; - try { - currentUser = getCoselmarUserDao().forTopiaIdEquals(fullUserId).findUnique(); - } catch (TopiaNoResultException tnre) { - // Should not happened, cause user are not really deleted - String message = String.format("Logged user ('%s') does not exist.", fullUserId); - if (log.isErrorEnabled()) { - log.error(message); - } - throw new InvalidCredentialException(message); - } // Retrieve Question String fullQuestionId = getFullIdFromShort(Question.class, questionId); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.