This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.forge.codelutin.com/coselmar.git commit c82e7538b8eac1f6f55d5680ec8b1c4adb4468fc Author: Yannick Martel <martel@©odelutin.com> Date: Mon Feb 29 11:01:14 2016 +0100 fix the transfer to contributor when we clear the list of experts in project --- .../coselmar/services/v1/QuestionsWebService.java | 23 ++++------------------ 1 file changed, 4 insertions(+), 19 deletions(-) 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 d4491f0..384aa7b 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 @@ -548,14 +548,13 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { // Check authentication String authorization = getContext().getHeader("Authorization"); - UserWebToken userWebToken = checkAuthentication(authorization); + CoselmarUser supervisor = checkUserAuthentication(authorization); // Only Supervisor can save question - String userRole = userWebToken.getRole(); - if (!StringUtils.equalsIgnoreCase(CoselmarUserRole.SUPERVISOR.name(), userRole)) { + if (CoselmarUserRole.SUPERVISOR != supervisor.getRole()) { String message = String.format("User %s %s ('%s') is not allowed to save question", - userWebToken.getFirstName(), userWebToken.getLastName(), userWebToken.getUserId()); + supervisor.getFirstname(), supervisor.getName(), supervisor.getTopiaId()); if (log.isWarnEnabled()) { log.warn(message); } @@ -563,21 +562,6 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { } - // retrieve user who will be assigned as question supervisor - String fullUserId = getFullUserIdFromShort(userWebToken.getUserId()); - - CoselmarUser supervisor; - try { - supervisor = 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); - } - Preconditions.checkNotNull(question); Preconditions.checkNotNull(question.getTitle()); Preconditions.checkNotNull(question.getSummary()); @@ -704,6 +688,7 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { participantGroup.clearMembers(); participantGroup.addAllMembers(expertEntities); } else { + questionEntity.addAllContributors(participantGroup.getMembers()); participantGroup.clearMembers(); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.