This is an automated email from the git hooks/post-receive script. New change to branch feature/44_several_email_address in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from beb73f87 refs #44 checks de sécurité + refactoring + tests unitaires new 57687fee corrections exceptions The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 57687fee3a1c054d03d9f459b20e912e59fb2401 Author: Kevin Morin <morin@codelutin.com> Date: Mon Oct 9 17:01:01 2017 +0200 corrections exceptions Summary of changes: .../org/chorem/pollen/rest/api/PollenRestApiApplication.java | 2 ++ ...er.java => PollenDefaultEmailAddressExceptionMapper.java} | 12 ++++++------ .../java/org/chorem/pollen/rest/api/v1/PollenUserApi.java | 8 ++++++-- 3 files changed, 14 insertions(+), 8 deletions(-) copy pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/exceptionMappers/{PollenUserBannedExceptionMapper.java => PollenDefaultEmailAddressExceptionMapper.java} (68%) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/44_several_email_address in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 57687fee3a1c054d03d9f459b20e912e59fb2401 Author: Kevin Morin <morin@codelutin.com> Date: Mon Oct 9 17:01:01 2017 +0200 corrections exceptions --- .../pollen/rest/api/PollenRestApiApplication.java | 2 ++ .../PollenDefaultEmailAddressExceptionMapper.java | 41 ++++++++++++++++++++++ .../chorem/pollen/rest/api/v1/PollenUserApi.java | 8 +++-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplication.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplication.java index 8d14605f..03667415 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplication.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiApplication.java @@ -28,6 +28,7 @@ import org.chorem.pollen.rest.api.exceptionMappers.FavoriteListImportExceptionMa import org.chorem.pollen.rest.api.exceptionMappers.InvalidEntityLinkExceptionMapper; import org.chorem.pollen.rest.api.exceptionMappers.InvalidFormExceptionMapper; import org.chorem.pollen.rest.api.exceptionMappers.PollenAuthenticationExceptionMapper; +import org.chorem.pollen.rest.api.exceptionMappers.PollenDefaultEmailAddressExceptionMapper; import org.chorem.pollen.rest.api.exceptionMappers.PollenEmailNotValidatedExceptionMapper; import org.chorem.pollen.rest.api.exceptionMappers.PollenEmailOrProviderAccountAlreadyUsedExceptionMapper; import org.chorem.pollen.rest.api.exceptionMappers.PollenInvalidEmailActivationTokenExceptionMapper; @@ -85,6 +86,7 @@ public class PollenRestApiApplication extends Application { new PollenInvalidPermissionExceptionMapper(), new PollenInvalidEmailActivationTokenExceptionMapper(), new PollenEmailNotValidatedExceptionMapper(), + new PollenDefaultEmailAddressExceptionMapper(), new PollenEmailOrProviderAccountAlreadyUsedExceptionMapper(), new PollenUserBannedExceptionMapper(), new InvalidFormExceptionMapper(), diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/exceptionMappers/PollenDefaultEmailAddressExceptionMapper.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/exceptionMappers/PollenDefaultEmailAddressExceptionMapper.java new file mode 100644 index 00000000..b2814846 --- /dev/null +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/exceptionMappers/PollenDefaultEmailAddressExceptionMapper.java @@ -0,0 +1,41 @@ +package org.chorem.pollen.rest.api.exceptionMappers; + +/*- + * #%L + * Pollen :: Rest Api + * %% + * Copyright (C) 2009 - 2017 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import org.chorem.pollen.services.service.security.PollenDefaultEmailAddressException; + +import javax.ws.rs.core.Response; + +/** + * @author Kevin Morin - morin@codelutin.com + */ +public class PollenDefaultEmailAddressExceptionMapper extends PollenAbstractExceptionMapper<PollenDefaultEmailAddressException> { + + public PollenDefaultEmailAddressExceptionMapper() { + super(Response.Status.FORBIDDEN); + } + + @Override + protected Object getEntity(PollenDefaultEmailAddressException exception) { + return "defaultEmailAddress"; + } +} diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java index 028eddf8..27691c35 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollenUserApi.java @@ -39,6 +39,8 @@ import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.PollenResourceService; import org.chorem.pollen.services.service.PollenUserService; import org.chorem.pollen.services.service.SocialAuthService; +import org.chorem.pollen.services.service.security.PollenDefaultEmailAddressException; +import org.chorem.pollen.services.service.security.PollenEmailNotValidatedException; import org.chorem.pollen.services.service.security.PollenInvalidEmailActivationTokenException; import org.chorem.pollen.services.service.security.PollenSecurityContext; import org.chorem.pollen.services.service.security.SecurityService; @@ -223,14 +225,16 @@ public class PollenUserApi { @Path("/user/email/default") @PUT public void setDefaultEmailAddress(@Context PollenUserService pollenUserService, - PollenEntityId<PollenUserEmailAddress> emailAddressId) { + PollenEntityId<PollenUserEmailAddress> emailAddressId) + throws PollenEmailNotValidatedException { pollenUserService.setDefaultEmailAddress(emailAddressId.getEntityId()); } @Path("/user/email/{emailAddressId}") @POST public void removeEmailAddress(@Context PollenUserService pollenUserService, - @PathParam("emailAddressId") PollenEntityId<PollenUserEmailAddress> emailAddressId) { + @PathParam("emailAddressId") PollenEntityId<PollenUserEmailAddress> emailAddressId) + throws PollenDefaultEmailAddressException { pollenUserService.removeEmailAddress(emailAddressId.getEntityId()); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm