branch feature/7492 created (now a1e24dc)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7492 in repository faxtomail. See http://git.codelutin.com/faxtomail.git at a1e24dc récupération des tampons pour l'utilisateur (refs #7492) This branch includes the following new commits: new 02c1513 modification du modèle pour configurer les tmapons par utilisateur et groupe ldap (refs #7492) new 7fe4e3f ajout de la conf par ldap des tampons dans l'admin (refs #7492) new a1e24dc récupération des tampons pour l'utilisateur (refs #7492) The 3 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 a1e24dc784f1d5fda33b26d0e26aeb5f935e5e9b Author: Kevin Morin <morin@codelutin.com> Date: Fri Aug 28 17:53:36 2015 +0200 récupération des tampons pour l'utilisateur (refs #7492) commit 7fe4e3fdae497e90996cb9136af655f1375dd69e Author: Kevin Morin <morin@codelutin.com> Date: Fri Aug 28 17:24:04 2015 +0200 ajout de la conf par ldap des tampons dans l'admin (refs #7492) commit 02c15131eedf2c9752d5ce45753cdbbcfed91a9a Author: Kevin Morin <morin@codelutin.com> Date: Fri Aug 28 15:18:28 2015 +0200 modification du modèle pour configurer les tmapons par utilisateur et groupe ldap (refs #7492) -- 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 feature/7492 in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 02c15131eedf2c9752d5ce45753cdbbcfed91a9a Author: Kevin Morin <morin@codelutin.com> Date: Fri Aug 28 15:18:28 2015 +0200 modification du modèle pour configurer les tmapons par utilisateur et groupe ldap (refs #7492) --- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32540 -> 32658 bytes .../services/service/MailFolderServiceImpl.java | 32 +++++------ .../h2/V1_5_0_150828__configure_stamps_by_ldap.sql | 39 ++++++++++++++ .../V1_5_0_150828__configure_stamps_by_ldap.sql | 59 +++++++++++++++++++++ 4 files changed, 115 insertions(+), 15 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index dc84d52..ca3e46f 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java index 592863d..c60665d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java @@ -356,20 +356,22 @@ public class MailFolderServiceImpl extends FaxToMailServiceSupport implements Ma @Override public Collection<Stamp> getPdfEditorStamps(String mailFolderId) { - MailFolder folder = getMailFolder(mailFolderId); - while (folder.getParent() != null && !folder.isUseCurrentLevelPdfEditorStamps()) { - folder = folder.getParent(); - } - - Collection<Stamp> pdfEditorStamps; - if (folder != null) { - pdfEditorStamps = folder.getPdfEditorStamps(); - Hibernate.initialize(pdfEditorStamps); - - } else { - pdfEditorStamps = null; - } - - return pdfEditorStamps; +// MailFolder folder = getMailFolder(mailFolderId); +// while (folder.getParent() != null && !folder.isUseCurrentLevelPdfEditorStamps()) { +// folder = folder.getParent(); +// } +// +// Collection<Stamp> pdfEditorStamps; +// if (folder != null) { +// pdfEditorStamps = folder.getPdfEditorStamps(); +// Hibernate.initialize(pdfEditorStamps); +// +// } else { +// pdfEditorStamps = null; +// } +// +// return pdfEditorStamps; + // FIXME + return null; } } diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql new file mode 100644 index 0000000..bdabba6 --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql @@ -0,0 +1,39 @@ +-- remove configuration by mail folder + +alter table mailfolder drop column usecurrentlevelpdfeditorstamps; + +drop table MAILFOLDER_PDFEDITORSTAMPS; + +create table FAXTOMAILUSER_PDFEDITORSTAMPS ( + FAXTOMAILUSER varchar(255) not null, + PDFEDITORSTAMPS varchar(255) not null +); + +alter table FAXTOMAILUSER_PDFEDITORSTAMPS + add constraint FK_9EMRBYUL9EJBXBXDRISLN1W56_INDEX_F + foreign key (FAXTOMAILUSER) + references FAXTOMAILUSER; + +alter table FAXTOMAILUSER_PDFEDITORSTAMPS + add constraint FK_RC8JM7WI0GR4O05CL6BKRCC9T_INDEX_F + foreign key (PDFEDITORSTAMPS) + references STAMP; + +CREATE INDEX idx_FAXTOMAILUSER_PDFEDITORSTAMPS ON FAXTOMAILUSER_PDFEDITORSTAMPS(FAXTOMAILUSER); + +create table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ( + FAXTOMAILUSERGROUP varchar(255) not null, + PDFEDITORSTAMPS varchar(255) not null +); + +alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS + add constraint FK_47041IYC9CUBBX7OB6E1B32QD + foreign key (FAXTOMAILUSERGROUP) + references FAXTOMAILUSERGROUP; + +alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS + add constraint FK_6I724UYTC1U81R3LXHKMWVF55_INDEX_F + foreign key (PDFEDITORSTAMPS) + references STAMP; + +CREATE INDEX idx_FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ON FAXTOMAILUSERGROUP_PDFEDITORSTAMPS(FAXTOMAILUSERGROUP); \ No newline at end of file diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql new file mode 100644 index 0000000..56183cd --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql @@ -0,0 +1,59 @@ +-- remove configuration by mail folder + +alter table mailfolder drop column usecurrentlevelpdfeditorstamps; + +GO + +drop table MAILFOLDER_PDFEDITORSTAMPS; + +GO + +create table FAXTOMAILUSER_PDFEDITORSTAMPS ( + FAXTOMAILUSER varchar(255) not null, + PDFEDITORSTAMPS varchar(255) not null +); + +GO + +alter table FAXTOMAILUSER_PDFEDITORSTAMPS + add constraint FK_9EMRBYUL9EJBXBXDRISLN1W56_INDEX_F + foreign key (FAXTOMAILUSER) + references FAXTOMAILUSER; + +GO + +alter table FAXTOMAILUSER_PDFEDITORSTAMPS + add constraint FK_RC8JM7WI0GR4O05CL6BKRCC9T_INDEX_F + foreign key (PDFEDITORSTAMPS) + references STAMP; + +GO + +CREATE INDEX idx_FAXTOMAILUSER_PDFEDITORSTAMPS ON FAXTOMAILUSER_PDFEDITORSTAMPS(FAXTOMAILUSER); + +GO + +create table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ( + FAXTOMAILUSERGROUP varchar(255) not null, + PDFEDITORSTAMPS varchar(255) not null +); + +GO + +alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS + add constraint FK_47041IYC9CUBBX7OB6E1B32QD + foreign key (FAXTOMAILUSERGROUP) + references FAXTOMAILUSERGROUP; + +GO + +alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS + add constraint FK_6I724UYTC1U81R3LXHKMWVF55_INDEX_F + foreign key (PDFEDITORSTAMPS) + references STAMP; + +GO + +CREATE INDEX idx_FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ON FAXTOMAILUSERGROUP_PDFEDITORSTAMPS(FAXTOMAILUSERGROUP); + +GO \ No newline at end of file -- 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 feature/7492 in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 7fe4e3fdae497e90996cb9136af655f1375dd69e Author: Kevin Morin <morin@codelutin.com> Date: Fri Aug 28 17:24:04 2015 +0200 ajout de la conf par ldap des tampons dans l'admin (refs #7492) --- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32658 -> 32674 bytes .../h2/V1_5_0_150828__configure_stamps_by_ldap.sql | 26 ++--- .../V1_5_0_150828__configure_stamps_by_ldap.sql | 24 ++--- .../WEB-INF/content/admin/configuration-input.jsp | 106 ++++++++++++--------- .../src/main/webapp/js/configuration.js | 70 +++++++------- 5 files changed, 124 insertions(+), 102 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index ca3e46f..0247562 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql index bdabba6..883c681 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_5_0_150828__configure_stamps_by_ldap.sql @@ -4,36 +4,38 @@ alter table mailfolder drop column usecurrentlevelpdfeditorstamps; drop table MAILFOLDER_PDFEDITORSTAMPS; -create table FAXTOMAILUSER_PDFEDITORSTAMPS ( - FAXTOMAILUSER varchar(255) not null, + +create table PDFEDITORSTAMPS_USERS ( + USERS varchar(255) not null, PDFEDITORSTAMPS varchar(255) not null ); -alter table FAXTOMAILUSER_PDFEDITORSTAMPS +alter table PDFEDITORSTAMPS_USERS add constraint FK_9EMRBYUL9EJBXBXDRISLN1W56_INDEX_F - foreign key (FAXTOMAILUSER) + foreign key (USERS) references FAXTOMAILUSER; -alter table FAXTOMAILUSER_PDFEDITORSTAMPS +alter table PDFEDITORSTAMPS_USERS add constraint FK_RC8JM7WI0GR4O05CL6BKRCC9T_INDEX_F foreign key (PDFEDITORSTAMPS) references STAMP; -CREATE INDEX idx_FAXTOMAILUSER_PDFEDITORSTAMPS ON FAXTOMAILUSER_PDFEDITORSTAMPS(FAXTOMAILUSER); +CREATE INDEX idx_PDFEDITORSTAMPS_USERS ON PDFEDITORSTAMPS_USERS(USERS); + -create table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ( - FAXTOMAILUSERGROUP varchar(255) not null, +create table GROUPS_PDFEDITORSTAMPS ( + GROUPS varchar(255) not null, PDFEDITORSTAMPS varchar(255) not null ); -alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS +alter table GROUPS_PDFEDITORSTAMPS add constraint FK_47041IYC9CUBBX7OB6E1B32QD - foreign key (FAXTOMAILUSERGROUP) + foreign key (GROUPS) references FAXTOMAILUSERGROUP; -alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS +alter table GROUPS_PDFEDITORSTAMPS add constraint FK_6I724UYTC1U81R3LXHKMWVF55_INDEX_F foreign key (PDFEDITORSTAMPS) references STAMP; -CREATE INDEX idx_FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ON FAXTOMAILUSERGROUP_PDFEDITORSTAMPS(FAXTOMAILUSERGROUP); \ No newline at end of file +CREATE INDEX idx_GROUPS_PDFEDITORSTAMPS ON GROUPS_PDFEDITORSTAMPS(GROUPS); \ No newline at end of file diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql index 56183cd..8be0678 100644 --- a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_5_0_150828__configure_stamps_by_ldap.sql @@ -8,52 +8,52 @@ drop table MAILFOLDER_PDFEDITORSTAMPS; GO -create table FAXTOMAILUSER_PDFEDITORSTAMPS ( - FAXTOMAILUSER varchar(255) not null, +create table PDFEDITORSTAMPS_USERS ( + USERS varchar(255) not null, PDFEDITORSTAMPS varchar(255) not null ); GO -alter table FAXTOMAILUSER_PDFEDITORSTAMPS +alter table PDFEDITORSTAMPS_USERS add constraint FK_9EMRBYUL9EJBXBXDRISLN1W56_INDEX_F - foreign key (FAXTOMAILUSER) + foreign key (USERS) references FAXTOMAILUSER; GO -alter table FAXTOMAILUSER_PDFEDITORSTAMPS +alter table PDFEDITORSTAMPS_USERS add constraint FK_RC8JM7WI0GR4O05CL6BKRCC9T_INDEX_F foreign key (PDFEDITORSTAMPS) references STAMP; GO -CREATE INDEX idx_FAXTOMAILUSER_PDFEDITORSTAMPS ON FAXTOMAILUSER_PDFEDITORSTAMPS(FAXTOMAILUSER); +CREATE INDEX idx_PDFEDITORSTAMPS_USERS ON PDFEDITORSTAMPS_USERS(USERS); GO -create table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ( - FAXTOMAILUSERGROUP varchar(255) not null, +create table GROUPS_PDFEDITORSTAMPS ( + GROUPS varchar(255) not null, PDFEDITORSTAMPS varchar(255) not null ); GO -alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS +alter table GROUPS_PDFEDITORSTAMPS add constraint FK_47041IYC9CUBBX7OB6E1B32QD - foreign key (FAXTOMAILUSERGROUP) + foreign key (GROUPS) references FAXTOMAILUSERGROUP; GO -alter table FAXTOMAILUSERGROUP_PDFEDITORSTAMPS +alter table GROUPS_PDFEDITORSTAMPS add constraint FK_6I724UYTC1U81R3LXHKMWVF55_INDEX_F foreign key (PDFEDITORSTAMPS) references STAMP; GO -CREATE INDEX idx_FAXTOMAILUSERGROUP_PDFEDITORSTAMPS ON FAXTOMAILUSERGROUP_PDFEDITORSTAMPS(FAXTOMAILUSERGROUP); +CREATE INDEX idx_GROUPS_PDFEDITORSTAMPS ON GROUPS_PDFEDITORSTAMPS (GROUPS); GO \ No newline at end of file diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index 603baea..264a771 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -250,7 +250,7 @@ </table> </div> - <div class="col-md-8" ng-if="selectedStamp"> + <div class="col-md-8" ng-show="selectedStamp"> <h3>Édition du tampon {{selectedStamp.label}}</h3> @@ -284,9 +284,65 @@ </textarea> </div> + <div class="form-group"> + <label>Droits :</label> + + <table id="rights" class="table table-bordered"> + <thead> + <tr> + <th>Utilisateur ou groupe</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="group in selectedStamp.groups"> + <td> + <span class="fa fa-users"></span> {{group.completeName}} + <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeStampGroup($index, group)"> + <span class="glyphicon glyphicon-remove"></span> + </a> + </td> + </tr> + <tr ng-repeat="user in selectedStamp.users"> + <td> + <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} + <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeStampUser($index, user)"> + <span class="glyphicon glyphicon-remove"></span> + </a> + </td> + </tr> + </tbody> + </table> + + <div class="form"> + <div class="form-group"> + <label for="newStampUserField" class="control-label">Nouvel utilisateur :</label> + <select id="newStampUserField" ui-select2 + ng-model="newStampUser" + ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedStamp.users)"> + </select> + <a class="btn btn-success btn-xs" ng-click="addStampUser()" ng-disabled="!newStampUser"> + <span class="glyphicon glyphicon-plus"></span> + </a> + </div> + </div> + + <div class="form"> + <div class="form-group"> + <label for="newStampGroupField" class="control-label">Nouveau groupe :</label> + <select id="newStampGroupField" ui-select2 + ng-model="newStampGroup" + ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedStamp.groups)"> + </select> + <a class="btn btn-success btn-xs" ng-click="addStampGroup()" ng-disabled="!newStampGroup"> + <span class="glyphicon glyphicon-plus"></span> + </a> + </div> + </div> + + </div> </div> - <div class="col-md-8" ng-if="!selectedStamp"> + <div class="col-md-8" ng-show="!selectedStamp"> <em>Sélectionnez un tampon.</em> </div> </div> @@ -734,48 +790,6 @@ </div> </div> - <!-- Sélection des tampons possibles pour ce dossier --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapseStamps"> - Sélection des tampons possibles pour ce dossier - </a> - </h4> - </div> - <div id="collapseStamps" class="panel-collapse collapse"> - <div class="panel-body"> - <div> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelPdfEditorStamps" - ng-value="false" ng-change="initFolderPdfEditorStamps()" /> - Hériter des tampons déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="stamp in stamps" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelPdfEditorStamps"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.pdfEditorStamps.containsByTopiaId(stamp)" - disabled> {{stamp.label}} - </label> - </div> - </div> - <div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelPdfEditorStamps" ng-value="true" - ng-change="initPdfEditorStamps()" ng-if="selectedMailFolder.$parent" /> - Définir les tampons pour ce dossier : - </label> - <div class="checkbox" ng-repeat="stamp in stamps" ng-if="selectedMailFolder.useCurrentLevelPdfEditorStamps || !selectedMailFolder.$parent"> - <label> - <input type="checkbox" ng-checked="selectedMailFolder.pdfEditorStamps.containsByTopiaId(stamp)" - ng-click="changeFolderPdfEditorStamp(stamp)"> {{stamp.label}} - </label> - </div> - </div> - </div> - </div> - </div> - - <!-- Sélection des gammes possibles pour ce dossier --> <div class="panel panel-default"> <div class="panel-heading"> @@ -977,7 +991,7 @@ </table> <div class="form"> <div class="form-group"> - <label for="newRightUserField" class="control-label">Nouveau utilisateur :</label> + <label for="newRightUserField" class="control-label">Nouvel utilisateur :</label> <select id="newRightUserField" ui-select2 ng-model="newRightUser" ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.rightUsers)"> @@ -1077,7 +1091,7 @@ </table> <div class="form"> <div class="form-group"> - <label for="newRightUserField" class="control-label">Nouveau utilisateur :</label> + <label for="newRightUserField" class="control-label">Nouvel utilisateur :</label> <select id="newRightUserField" ui-select2 ng-model="newRightUser" ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.rightUsers)"> diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index 86a34c4..80da58d 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -351,16 +351,22 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win $scope.selectedStamp; for (var i = 0 ; i < $scope.stamps.length ; i++) { - var stamp = $scope.stamps[i]; + var stamp = $scope.stamps[i]; stamp.isImageType = stamp.image != null; - console.log(stamp) - console.log(stamp.isImageType) } // edition d'un tampon $scope.editStamp = function(stamp) { $scope.selectedStamp = stamp; + + if (!$scope.selectedStamp.users) { + $scope.selectedStamp.users = []; + } + if (!$scope.selectedStamp.groups) { + $scope.selectedStamp.groups = []; + } + $('#stampImage').val(null); $('#stampPreview').attr('src', stamp.image ? stamp.image : null); @@ -373,7 +379,9 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win // auto select new etat var newStamp = { topiaId : "new_" + guid(), - label: label + label: label, + users: [], + groups: [] }; // check if already exists @@ -413,6 +421,32 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win reader.readAsDataURL(f); } + // add user stamps right + $scope.addStampUser = function() { + $scope.selectedStamp.users.push($scope.newStampUser); + delete $scope.newStampUser; + }; + + // remove user stamps right + $scope.removeStampUser = function(index, user) { + if ($window.confirm("Êtes-vous sur de vouloir supprimer les droits de cet utilisateur ?")) { + $scope.selectedStamp.users.splice(index, 1); + } + }; + + // add group stamps right + $scope.addStampGroup = function() { + $scope.selectedStamp.groups.push($scope.newStampGroup); + delete $scope.newStampGroup; + }; + + // remove group stamps right + $scope.removeStampGroup = function(index, group) { + if ($window.confirm("Êtes-vous sur de vouloir supprimer les droits de ce groupe ?")) { + $scope.selectedStamp.groups.splice(index, 1); + } + }; + }]); @@ -600,9 +634,6 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if (!$scope.selectedMailFolder.demandTypes) { $scope.selectedMailFolder.demandTypes = []; } - if (!$scope.selectedMailFolder.pdfEditorStamps) { - $scope.selectedMailFolder.pdfEditorStamps = []; - } if (!$scope.selectedMailFolder.ranges) { $scope.selectedMailFolder.ranges = []; } @@ -692,7 +723,6 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo waitingStates: [], demandTypes: [], stamps: [], - pdfEditorStamps: [], ranges: [], //rigths readRightUsers: [], @@ -796,9 +826,6 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if ((!$scope.parentScopeValues.demandTypes || $scope.parentScopeValues.demandTypes.length == 0) && folder.demandTypes) { $scope.parentScopeValues.demandTypes = folder.demandTypes; } - if ((!$scope.parentScopeValues.pdfEditorStamps || $scope.parentScopeValues.pdfEditorStamps.length == 0) && folder.pdfEditorStamps) { - $scope.parentScopeValues.pdfEditorStamps = folder.pdfEditorStamps; - } if ((!$scope.parentScopeValues.ranges || $scope.parentScopeValues.ranges.length == 0) && folder.ranges) { $scope.parentScopeValues.ranges = folder.ranges; } @@ -1006,27 +1033,6 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo } }; - // initialise la liste des tampons avec celle des niveaux supérieurs - $scope.initFolderPdfEditorStamps = function() { - if ($scope.selectedMailFolder.useCurrentLevelPdfEditorStamps) { - if ($scope.parentScopeValues.pdfEditorStamps) { - $scope.selectedMailFolder.pdfEditorStamps = $scope.parentScopeValues.pdfEditorStamps.slice(); // soft copy - } - } else { - delete $scope.selectedMailFolder.pdfEditorStamps; - } - }; - - // selection/deselection d'un tampon possible pour ce dossier - $scope.changeFolderPdfEditorStamp = function(pdfEditorStamp) { - var index = $scope.selectedMailFolder.pdfEditorStamps.indexOfByTopiaId(pdfEditorStamp); - if (index != -1) { - $scope.selectedMailFolder.pdfEditorStamps.splice(index, 1); - } else { - $scope.selectedMailFolder.pdfEditorStamps.push(pdfEditorStamp); - } - }; - // initialise la liste des gammes avec celle des niveaux supérieurs $scope.initFolderRanges = function() { if ($scope.selectedMailFolder.useCurrentLevelRange) { -- 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 feature/7492 in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit a1e24dc784f1d5fda33b26d0e26aeb5f935e5e9b Author: Kevin Morin <morin@codelutin.com> Date: Fri Aug 28 17:53:36 2015 +0200 récupération des tampons pour l'utilisateur (refs #7492) --- .../persistence/entities/StampTopiaDao.java | 27 ++++++++++++++++++++++ .../services/service/MailFolderService.java | 2 -- .../services/service/MailFolderServiceImpl.java | 21 ----------------- .../faxtomail/services/service/UserService.java | 3 +++ .../services/service/UserServiceImpl.java | 11 +++++++++ .../attachment/actions/EditAttachmentAction.java | 11 +++++---- 6 files changed, 47 insertions(+), 28 deletions(-) diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/StampTopiaDao.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/StampTopiaDao.java new file mode 100644 index 0000000..01d087f --- /dev/null +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/StampTopiaDao.java @@ -0,0 +1,27 @@ +package com.franciaflex.faxtomail.persistence.entities; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +public class StampTopiaDao extends AbstractStampTopiaDao<Stamp> { + + public Collection<Stamp> findAllForUser(FaxToMailUser user) { + + Map<String, Object> args = new HashMap<>(); + + StringBuilder query = new StringBuilder("FROM " + Stamp.class.getName() + " S "); + + query.append("WHERE :user IN ELEMENTS (S." + Stamp.PROPERTY_USERS + ") "); + args.put("user", user); + + for (FaxToMailUserGroup group : user.getUserGroups()) { + int i = 0; + query.append("OR :group" + i + " IN ELEMENTS (S." + Stamp.PROPERTY_GROUPS + ") "); + args.put("group" + i++, group); + } + + return findAll(query.toString(), args); + } + +} //StampTopiaDao diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java index fa4ac0d..a16656e 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java @@ -28,7 +28,6 @@ import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailService; @@ -68,5 +67,4 @@ public interface MailFolderService extends FaxToMailService { MailFilter findMailFilter(Email email, Set<String> modifiedProperties, List<Address> recipients); - Collection<Stamp> getPdfEditorStamps(String mailFolderId); } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java index c60665d..6f1f27e 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java @@ -31,7 +31,6 @@ import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import org.apache.commons.collections4.CollectionUtils; @@ -354,24 +353,4 @@ public class MailFolderServiceImpl extends FaxToMailServiceSupport implements Ma return filter; } - @Override - public Collection<Stamp> getPdfEditorStamps(String mailFolderId) { -// MailFolder folder = getMailFolder(mailFolderId); -// while (folder.getParent() != null && !folder.isUseCurrentLevelPdfEditorStamps()) { -// folder = folder.getParent(); -// } -// -// Collection<Stamp> pdfEditorStamps; -// if (folder != null) { -// pdfEditorStamps = folder.getPdfEditorStamps(); -// Hibernate.initialize(pdfEditorStamps); -// -// } else { -// pdfEditorStamps = null; -// } -// -// return pdfEditorStamps; - // FIXME - return null; - } } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java index 78f2d80..309a861 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java @@ -29,6 +29,7 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.services.FaxToMailService; +import java.util.Collection; import java.util.List; /** @@ -58,4 +59,6 @@ public interface UserService extends FaxToMailService { Stamp saveSigning(FaxToMailUser user, Stamp signing, boolean defaultSigning); void deleteSigning(FaxToMailUser user, Stamp signing); + + Collection<Stamp> getPdfEditorStamps(FaxToMailUser user); } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java index 9cf99f1..16aaab5 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java @@ -34,6 +34,7 @@ import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.google.common.base.Preconditions; import org.hibernate.Hibernate; +import java.util.Collection; import java.util.List; /** @@ -146,4 +147,14 @@ public class UserServiceImpl extends FaxToMailServiceSupport implements UserServ } } + + @Override + public Collection<Stamp> getPdfEditorStamps(FaxToMailUser user) { + Preconditions.checkNotNull(user); + + StampTopiaDao stampDao = getPersistenceContext().getStampDao(); + Collection<Stamp> result = stampDao.findAllForUser(user); + + return result; + } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/actions/EditAttachmentAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/actions/EditAttachmentAction.java index baf2ea1..d4e68db 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/actions/EditAttachmentAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/actions/EditAttachmentAction.java @@ -25,9 +25,9 @@ package com.franciaflex.faxtomail.ui.swing.content.attachment.actions; */ import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.Stamp; -import com.franciaflex.faxtomail.services.service.MailFolderService; +import com.franciaflex.faxtomail.services.service.UserService; import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; import com.franciaflex.faxtomail.ui.swing.content.MainUI; import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI; @@ -65,9 +65,10 @@ public class EditAttachmentAction extends AbstractFaxToMailAction<AttachmentEdit public void doAction() throws Exception { getModel().fireAttachmentOpened(attachment, false); FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment); - MailFolder mailFolder = attachment.getEmail().getMailFolder(); - MailFolderService mailFolderService = getContext().newServiceContext().getMailFolderService(); - stamps = mailFolderService.getPdfEditorStamps(mailFolder.getTopiaId()); + + FaxToMailUser currentUser = getContext().getCurrentUser(); + UserService userService = getContext().newServiceContext().getUserService(); + stamps = userService.getPdfEditorStamps(currentUser); } @Override -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm