This is an automated email from the git hooks/post-receive script. New commit to branch develop 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>.