branch develop updated (47e2e0a -> 085fa9e)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository wao. See http://git.codelutin.com/wao.git from 47e2e0a On affiche les boutons volants au dessus du bandeau d'avertissement (fixes #6494)) new 1305cc5 On partage les informations entre laboratoires new 94e7bd8 On permet la création de contacts que pour les membres du labo affecté à la ligne new 7987520 mend new 085fa9e Ne pas masquer la vue entre labo appartenant à la même société (fixes #6490) The 4 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 085fa9eb010220b04d2169d259659e457432f95f Merge: 47e2e0a 7987520 Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 21 15:56:34 2015 +0100 Ne pas masquer la vue entre labo appartenant à la même société (fixes #6490) commit 79875200af6fd3cae746405040aa43ff995fcaef Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 21 15:54:32 2015 +0100 mend commit 94e7bd8f1d593d96608d89d75110b013fa1249f5 Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 21 15:45:44 2015 +0100 On permet la création de contacts que pour les membres du labo affecté à la ligne commit 1305cc55a8346e69a5bdd0f8647365231adcd34d Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Jan 20 16:22:38 2015 +0100 On partage les informations entre laboratoires Summary of changes: .../ifremer/wao/services/AuthenticatedWaoUser.java | 8 +++++ .../wao/services/service/ContactsService.java | 32 +++++++++++++----- .../ifremer/wao/services/service/SamplingPlan.java | 2 +- .../wao/services/service/SamplingPlanService.java | 15 +++++---- .../service/SclerochronologySamplingPlan.java | 7 ++++ .../SclerochronologySamplingPlanServiceTest.java | 2 +- .../main/webapp/WEB-INF/content/boat-details.jsp | 38 ++++++++++++---------- .../content/sclerochronology/sampling-plan.jsp | 2 +- 8 files changed, 69 insertions(+), 37 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 1305cc55a8346e69a5bdd0f8647365231adcd34d Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Jan 20 16:22:38 2015 +0100 On partage les informations entre laboratoires --- .../wao/services/service/ContactsService.java | 22 +++++++++++++--------- .../ifremer/wao/services/service/SamplingPlan.java | 2 +- .../wao/services/service/SamplingPlanService.java | 15 ++++++++------- .../SclerochronologySamplingPlanServiceTest.java | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java index 17ebe9b..e0bfdeb 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java @@ -26,11 +26,13 @@ import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.cache.Cache; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; import com.google.common.collect.Sets; import fr.ifremer.wao.ContactsFilter; import fr.ifremer.wao.WaoTechnicalException; import fr.ifremer.wao.WaoUtils; import fr.ifremer.wao.entity.Boat; +import fr.ifremer.wao.entity.Company; import fr.ifremer.wao.entity.Contact; import fr.ifremer.wao.entity.ContactImpl; import fr.ifremer.wao.entity.ContactState; @@ -70,6 +72,7 @@ import org.nuiton.csv.ImportModel; import org.nuiton.csv.ImportRow; import org.nuiton.csv.ImportRuntimeException; import org.nuiton.i18n.I18n; +import org.nuiton.topia.persistence.TopiaEntities; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep; import org.nuiton.util.DateUtil; @@ -106,14 +109,15 @@ public class ContactsService extends WaoServiceSupport { // ATTENTION, il s'agit de sécu if (authenticatedWaoUser.isCoordinatorOrObserver()) { // quand on appartient à une organisation (société ou labo), par défaut on ne peut voir - // que les lignes de cette même organisation - Organisation organisationToFilterOn = authenticatedWaoUser.getOrganisation(); - if (obsProgram.isObsMer() || obsProgram.isObsVente()) { - // dans ce cas, on est plus souple : si on appartient à des labos différents mais à - // la même société, on peut voir tout ce qui concerne la société tous labos confondus - organisationToFilterOn = authenticatedWaoUser.getOrganisation().getCompany(); + // que les lignes de la société : si on appartient à la même société mais des labos différents + // on a accès aux infos des autres labos + Organisation organisationToFilterOn = authenticatedWaoUser.getOrganisation().getCompany(); + ImmutableSet<String> organisationIds = ImmutableSet.of(organisationToFilterOn.getTopiaId()); + if (obsProgram.isSclerochronology()) { + Set<Organisation> organisations = getOrganisationsService().getOrganisationsBelongingsTo(organisationToFilterOn); + organisationIds = ImmutableSet.copyOf(Iterables.transform(organisations, TopiaEntities.getTopiaIdFunction())); } - newContactsFilter.getSampleRowFilter().setOrganisationIds(ImmutableSet.of(organisationToFilterOn.getTopiaId())); + newContactsFilter.getSampleRowFilter().setOrganisationIds(organisationIds); } if (authenticatedWaoUser.isProfessional()) { @@ -1226,10 +1230,10 @@ public class ContactsService extends WaoServiceSupport { */ public SortedSet<WaoUser> getPossibleObservers(SampleRow sampleRow) { - Organisation organisation = sampleRow.getOrganisation(); + Company company = sampleRow.getOrganisation().getCompany(); Set<Organisation> organisationsUserMustBeInToBeAnObserver = - getOrganisationsService().getOrganisationsBelongingsTo(organisation); + getOrganisationsService().getOrganisationsBelongingsTo(company); TopiaQueryBuilderAddCriteriaOrRunQueryStep<WaoUser> query = getWaoUserDao().newQueryBuilder(); query.addIn(WaoUser.PROPERTY_ORGANISATION, organisationsUserMustBeInToBeAnObserver); diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java index f287769..ac98069 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java @@ -376,7 +376,7 @@ public abstract class SamplingPlan implements Iterable<SamplingPlan.SamplingPlan programName = sampleRow.getProgramName(); periodBegin = sampleRow.getPeriodBegin(); periodEnd = sampleRow.getPeriodEnd(); - companyName = sampleRow.getCompany().getName(); + companyName = sampleRow.getOrganisation().getName(); code = sampleRow.getCode(); Profession profession = sampleRow.getProfession(); if (profession != null) { diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java index 8c40446..435b15c 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java @@ -200,14 +200,15 @@ public class SamplingPlanService extends WaoServiceSupport { // ATTENTION, il s'agit de sécu if (authenticatedWaoUser.isCoordinatorOrObserver()) { // quand on appartient à une organisation (société ou labo), par défaut on ne peut voir - // que les lignes de cette même organisation - Organisation organisationToFilterOn = authenticatedWaoUser.getOrganisation(); - if (obsProgram.isObsMer() || obsProgram.isObsVente()) { - // dans ce cas, on est plus souple : si on appartient à des labos différents mais à - // la même société, on peut voir tout ce qui concerne la société tous labos confondus - organisationToFilterOn = authenticatedWaoUser.getOrganisation().getCompany(); + // que les lignes de la société : si on appartient à la même société mais des labos différents + // on a accès aux infos des autres labos + Organisation organisationToFilterOn = authenticatedWaoUser.getOrganisation().getCompany(); + ImmutableSet<String> organisationIds = ImmutableSet.of(organisationToFilterOn.getTopiaId()); + if (obsProgram.isSclerochronology()) { + Set<Organisation> organisations = getOrganisationsService().getOrganisationsBelongingsTo(organisationToFilterOn); + organisationIds = ImmutableSet.copyOf(Iterables.transform(organisations, TopiaEntities.getTopiaIdFunction())); } - newFilter.setOrganisationIds(ImmutableSet.of(organisationToFilterOn.getTopiaId())); + newFilter.setOrganisationIds(organisationIds); } return newFilter; diff --git a/wao-services/src/test/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlanServiceTest.java b/wao-services/src/test/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlanServiceTest.java index c678180..0a843f9 100644 --- a/wao-services/src/test/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlanServiceTest.java +++ b/wao-services/src/test/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlanServiceTest.java @@ -74,7 +74,7 @@ public class SclerochronologySamplingPlanServiceTest extends AbstractWaoServiceT SampleRowsFilter coordinatorFilter = service.newSampleRowsFilter(fixtures.coordinator()); Assert.assertFalse(coordinatorFilter.getOrganisationIds().isEmpty()); - Assert.assertTrue(coordinatorFilter.getOrganisationIds().contains(fixtures.coordinator().getOrganisation().getTopiaId())); + Assert.assertTrue(coordinatorFilter.getOrganisationIds().contains(fixtures.coordinator().getOrganisation().getCompany().getTopiaId())); } @Test -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 94e7bd8f1d593d96608d89d75110b013fa1249f5 Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 21 15:45:44 2015 +0100 On permet la création de contacts que pour les membres du labo affecté à la ligne --- .../java/fr/ifremer/wao/services/AuthenticatedWaoUser.java | 8 ++++++++ .../java/fr/ifremer/wao/services/service/ContactsService.java | 10 ++++++++++ .../wao/services/service/SclerochronologySamplingPlan.java | 7 +++++++ .../webapp/WEB-INF/content/sclerochronology/sampling-plan.jsp | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java b/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java index 214d21a..0ca8bdb 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java @@ -224,6 +224,14 @@ public class AuthenticatedWaoUser implements Serializable{ return userProfile.isCoordinatorOrObserver() && isCanWrite(); } + /** + * Si l'utilisateur peut créer un contact pour une ligne du plan associée à l'organisation + * dont le topiaId est en paramètre. + */ + public boolean isAuthorizedToCreateContact(String sampleRowOrganisationId) { + return isAuthorizedToCreateContact() && waoUser.getOrganisation().getTopiaId().equals(sampleRowOrganisationId); + } + public boolean isAuthorizedToUpdateContact() { return (userProfile.isCoordinatorOrObserver() || userProfile.isAdmin()) && isCanWrite(); } diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java index e0bfdeb..a097e2a 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java @@ -872,11 +872,18 @@ public class ContactsService extends WaoServiceSupport { throw new MissingContactMainObserverException(contact); } + // pour obsmer et obsvente, tous les observateurs doivent faire partie de la société à laquelle est affectée la ligne Set<WaoUser> possibleObservers = getPossibleObservers(contact.getSampleRow()); if ( ! possibleObservers.contains(mainObserver)) { throw new MismatchContactMainObserverCompanyException(contact, mainObserver, contact.getSampleRow().getOrganisation()); } + // pour scléro, les observateurs peuvent appartenir à la même société mais des labos différents. Toutefois, l'observateur + // principal doit appartenir au labo + if ( ! contact.getMainObserver().getOrganisation().equals(contact.getSampleRow().getOrganisation())) { + throw new MismatchContactMainObserverCompanyException(contact, mainObserver, contact.getSampleRow().getOrganisation()); + } + if (contact.isSecondaryObserversNotEmpty()) { if (contact.getSecondaryObservers().contains(mainObserver)) { throw new DuplicatedContactMainObserverInSecondaryObserversException(contact); @@ -1135,6 +1142,9 @@ public class ContactsService extends WaoServiceSupport { WaoUser mainObserver = authenticatedWaoUser.getWaoUser(); Preconditions.checkState( + authenticatedWaoUser.isAuthorizedToCreateContact(sampleRow.getOrganisation().getTopiaId()), + authenticatedWaoUser + " is not allowed to create a contact for row " + sampleRow); + Preconditions.checkState( getPossibleObservers(sampleRow).contains(mainObserver), authenticatedWaoUser + " is not allowed to create a contact for row " + sampleRow); diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlan.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlan.java index 0f6ab70..052a9fe 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlan.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/SclerochronologySamplingPlan.java @@ -70,6 +70,8 @@ public class SclerochronologySamplingPlan extends SamplingPlan implements Iterab public static class SclerochronologySamplingPlanSampleRowPart extends SamplingPlanSampleRowPart { + protected String organisationId; + protected String organisationFullName; protected String samplingContext; @@ -91,10 +93,15 @@ public class SclerochronologySamplingPlan extends SamplingPlan implements Iterab samplingContext = WaoUtils.l(locale, sampleRow.getSclerochronologySamplingContext()); samplingContextInfo = sampleRow.getSclerochronologySamplingContextInfo(); individualMeasurementStrategy = WaoUtils.l(locale, sampleRow.getIndividualMeasurementStrategy()); + organisationId = sampleRow.getOrganisation().getTopiaId(); organisationFullName = sampleRow.getOrganisation().getFullName(); totalIndividuals = Effort.sum(effortInIndividualsPerMonths.values()); } + public String getOrganisationId() { + return organisationId; + } + public String getOrganisationFullName() { return organisationFullName; } diff --git a/wao-web/src/main/webapp/WEB-INF/content/sclerochronology/sampling-plan.jsp b/wao-web/src/main/webapp/WEB-INF/content/sclerochronology/sampling-plan.jsp index edb945f..0b0b28c 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/sclerochronology/sampling-plan.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/sclerochronology/sampling-plan.jsp @@ -394,7 +394,7 @@ </s:a> </li> </s:if> - <s:if test="authenticatedWaoUser.authorizedToCreateContact"> + <s:if test="authenticatedWaoUser.authorizedToCreateContact(organisationId)"> <li> <s:url action="create-contact" id="createContactUrl"> <s:param name="sampleRowId" value="sampleRowId" /> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 79875200af6fd3cae746405040aa43ff995fcaef Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 21 15:54:32 2015 +0100 mend --- .../main/webapp/WEB-INF/content/boat-details.jsp | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp b/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp index 622afb5..8e2c53e 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp @@ -205,24 +205,26 @@ <div class="control-group"> <div class="controls"> <s:iterator value="boatDetails.elligibleForSampleRows" status="status"> - <div class="elligible-sample-row"> - <s:set name="radioId">radio-<s:property value="#status.index"/></s:set> - <input type="radio" name="sampleRowId" id="<s:property value="#radioId"/>" value="<s:property value="topiaId"/>"/> - <%-- - <label for="<s:property value="%{#radioId}"/>" class="radio"> + <s:if test="authenticatedWaoUser.authorizedToCreateContact(organisation.topiaId)"> + <div class="elligible-sample-row"> + <s:set name="radioId">radio-<s:property value="#status.index"/></s:set> + <input type="radio" name="sampleRowId" id="<s:property value="#radioId"/>" value="<s:property value="topiaId"/>"/> + <%-- + <label for="<s:property value="%{#radioId}"/>" class="radio"> + <s:property value="code"/> + </label> + --%> <s:property value="code"/> - </label> - --%> - <s:property value="code"/> - <s:url action="update-boat-elligibility-json" id="updateBoatElligibilityUrl"> - <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> - <s:param name="sampleRowId" value="topiaId"/> - <s:param name="active" value="false"/> - </s:url> - <s:a href="%{updateBoatElligibilityUrl}" cssClass="btn btn-link remove-boat-eligibility"> - <i class="icon-remove"></i> - </s:a> - </div> + <s:url action="update-boat-elligibility-json" id="updateBoatElligibilityUrl"> + <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> + <s:param name="sampleRowId" value="topiaId"/> + <s:param name="active" value="false"/> + </s:url> + <s:a href="%{updateBoatElligibilityUrl}" cssClass="btn btn-link remove-boat-eligibility"> + <i class="icon-remove"></i> + </s:a> + </div> + </s:if> </s:iterator> </div> </div> @@ -260,7 +262,7 @@ </s:if> <s:else> <s:if test="boatDetails.newContactCreatable"> - <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact"> + <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact(startBoatSelectionForSampleRow.organisation.topiaId)"> <s:url action="create-contact" id="createContactUrl"> <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> <s:param name="sampleRowId" value="startBoatSelectionForSampleRow.topiaId"/> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 085fa9eb010220b04d2169d259659e457432f95f Merge: 47e2e0a 7987520 Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 21 15:56:34 2015 +0100 Ne pas masquer la vue entre labo appartenant à la même société (fixes #6490) .../ifremer/wao/services/AuthenticatedWaoUser.java | 8 +++++ .../wao/services/service/ContactsService.java | 32 +++++++++++++----- .../ifremer/wao/services/service/SamplingPlan.java | 2 +- .../wao/services/service/SamplingPlanService.java | 15 +++++---- .../service/SclerochronologySamplingPlan.java | 7 ++++ .../SclerochronologySamplingPlanServiceTest.java | 2 +- .../main/webapp/WEB-INF/content/boat-details.jsp | 38 ++++++++++++---------- .../content/sclerochronology/sampling-plan.jsp | 2 +- 8 files changed, 69 insertions(+), 37 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm