[pollen] branch feature/adminUser updated (f4e8036 -> fe0076d)
This is an automated email from the git hooks/post-receive script. New change to branch feature/adminUser in repository pollen. See http://git.chorem.org/pollen.git from f4e8036 add good error when you want to change password new fe6e1b0 filter list of user new fe0076d add button 'Disable Me' in edit user profil The 2 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 fe0076d40d5135764ee00082e9fb7fb6fb8fd1aa Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 23 17:06:46 2014 +0200 add button 'Disable Me' in edit user profil commit fe6e1b0686e7a499b40e3e9002fb76b7e0f4e948 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 23 16:56:01 2014 +0200 filter list of user Summary of changes: .../chorem/pollen/services/bean/PollenUserBean.java | 10 ++++++++++ .../pollen/services/service/PollenUserService.java | 8 ++++++++ pollen-ui-angular/src/main/webapp/i18n/en.js | 2 ++ pollen-ui-angular/src/main/webapp/i18n/fr.js | 2 ++ .../src/main/webapp/js/controllers/userCtrl.js | 20 ++++++++++++++++++-- pollen-ui-angular/src/main/webapp/js/services.js | 3 ++- pollen-ui-angular/src/main/webapp/less/style.less | 4 ++++ .../src/main/webapp/partials/user-admin-list.html | 16 +++++++++++++--- .../src/main/webapp/partials/user-edit.html | 16 +++++++++++++++- 9 files changed, 74 insertions(+), 7 deletions(-) -- 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/adminUser in repository pollen. See http://git.chorem.org/pollen.git commit fe6e1b0686e7a499b40e3e9002fb76b7e0f4e948 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 23 16:56:01 2014 +0200 filter list of user --- .../chorem/pollen/services/bean/PollenUserBean.java | 10 ++++++++++ .../pollen/services/service/PollenUserService.java | 8 ++++++++ pollen-ui-angular/src/main/webapp/i18n/en.js | 1 + pollen-ui-angular/src/main/webapp/i18n/fr.js | 1 + .../src/main/webapp/js/controllers/userCtrl.js | 20 ++++++++++++++++++-- pollen-ui-angular/src/main/webapp/js/services.js | 3 ++- pollen-ui-angular/src/main/webapp/less/style.less | 4 ++++ .../src/main/webapp/partials/user-admin-list.html | 16 +++++++++++++--- 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollenUserBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollenUserBean.java index b9e1239..f156379 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollenUserBean.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollenUserBean.java @@ -42,6 +42,8 @@ public class PollenUserBean extends PollenBean<PollenUser> { protected String password; + protected boolean isDisabled; + public PollenUserBean() { super(PollenUser.class); } @@ -114,4 +116,12 @@ public class PollenUserBean extends PollenBean<PollenUser> { public void setPassword(String password) { this.password = password; } + + public boolean isDisabled() { + return isDisabled; + } + + public void setDisabled(boolean isDisabled) { + this.isDisabled = isDisabled; + } } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java index f49f1c9..e60262f 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenUserService.java @@ -52,7 +52,10 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer private Function<PollenUserBean, PollenUserBean> pollenUserFunction = new Function<PollenUserBean, PollenUserBean>() { @Override public PollenUserBean apply(PollenUserBean input) { + input.setDisabled(input.getPassword() == ""); + input.setPassword(null); + return input; } }; @@ -88,6 +91,11 @@ public class PollenUserService extends PollenServiceSupport implements PollenSer checkNotNull(user); checkIsNotPersisted(user); + if (generatePassword) { + // force not null password + user.setPassword("generate"); + } + ErrorMap errorMap = checkPollenUser(user); errorMap.failIfNotEmpty(); diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index 91c302b..bade830 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -122,6 +122,7 @@ var translateEN = { 'action.edit' : 'Edit', 'action.delete' : 'Delete', 'action.vote' : 'Vote', +'action.search' : 'Search', 'action.comment' : 'Comment', 'action.restricted.addVoter' : 'Add a Voter', 'action.restricted.deleteVoter' : 'Delete the Voter', diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index 7eec45b..dc11690 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -123,6 +123,7 @@ var translateFR = { 'action.delete' : 'Supprimer', 'action.vote' : 'Voter', 'action.comment' : 'Commenter', +'action.search' : 'Rechercher', 'action.restricted.addVoter' : 'Ajouter un Votant', 'action.restricted.deleteVoter' : 'Supprimer le Votant', 'action.restricted.addGroup' : 'Ajouter un Groupe de Votant', diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js index 68f8e03..56abe83 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/userCtrl.js @@ -78,8 +78,8 @@ angular.module('userControllers', []) -.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', 'User', 'SessionStorage', 'Page', - function ($scope, $rootScope, $routeParams, $route, $location, User, SessionStorage, Page) { +.controller('UserEditCtrl', ['$scope', '$rootScope', '$routeParams', '$route', '$location', '$translate', 'User', 'SessionStorage', 'Page', + function ($scope, $rootScope, $routeParams, $route, $location, $translate, User, SessionStorage, Page) { Page.setTitle('title.user.edit'); if (angular.isUndefined($scope.data)) { @@ -116,6 +116,21 @@ angular.module('userControllers', []) }); } } + + $scope.disableUser = function () { + var confirmMessage; + $translate('action.message.confirmDelete').then(function (msg) { + confirmMessage = msg; + }).then( function () { + var confirmDelete = confirm(confirmMessage); + if (confirmDelete == true) { + User.ban({userId: $scope.data.user.id, anonymize:true}, function (data) { + $rootScope.$broadcast('newSuccess', 'user.disabled.success'); + $rootScope.$broadcast('sessionExpired'); + }) + } + }); + } }]) .controller('UserListCtrl', ['$scope', '$rootScope', '$routeParams', 'User', 'Page', @@ -165,6 +180,7 @@ angular.module('userControllers', []) $scope.banUser = function (user) { User.ban({userId : user.id, anonymize:true}, function (data) { + user.isDisabled = true; $rootScope.$broadcast('newSuccess', 'user.ban.success'); }); }; diff --git a/pollen-ui-angular/src/main/webapp/js/services.js b/pollen-ui-angular/src/main/webapp/js/services.js index 4c2557e..2f1b45d 100644 --- a/pollen-ui-angular/src/main/webapp/js/services.js +++ b/pollen-ui-angular/src/main/webapp/js/services.js @@ -199,7 +199,8 @@ angular.module('pollenServices', ['ngResource']) .factory('User', ['$resource', function ($resource) { var transformParam = function (data) { - return 'user='+encodeURIComponent(JSON.stringify(data))+'&generatePassword=false'; + var generatePassword = (data.password == ''); + return 'user='+encodeURIComponent(JSON.stringify(data))+'&generatePassword='+generatePassword; } return $resource(conf.restURL+'/users/:userId', {userId : '@id'}, { diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less index 8728234..05838e3 100644 --- a/pollen-ui-angular/src/main/webapp/less/style.less +++ b/pollen-ui-angular/src/main/webapp/less/style.less @@ -525,3 +525,7 @@ hr { .ng-enter.ng-enter-active { opacity:1; } + +.form-search { + margin-bottom:3px; +} diff --git a/pollen-ui-angular/src/main/webapp/partials/user-admin-list.html b/pollen-ui-angular/src/main/webapp/partials/user-admin-list.html index a7c09f3..e8014b3 100644 --- a/pollen-ui-angular/src/main/webapp/partials/user-admin-list.html +++ b/pollen-ui-angular/src/main/webapp/partials/user-admin-list.html @@ -19,7 +19,17 @@ #L% --> -<div ng-if="!data.users[0]"><h1>{{ 'user.error.listEmpty' | translate }}</h1></div> +<div ng-if="!data.users[0]"> + <h1> + {{ 'user.error.listEmpty' | translate }} + </h1> +</div> + +<div class="control-group row form-search"> + <div class="col-sm-4"> + <input class="form-control" type="text" ng-model="search" placeholder="{{ 'action.search' | translate }}" /> + </div> +</div> <table class="table table-hover"> <tr> @@ -27,14 +37,14 @@ <th>{{ 'user.isAdmin' | translate }}</th> <th>{{ 'action' | translate }}</th> </tr> - <tr ng-repeat="user in data.users"> + <tr ng-repeat="user in data.users | filter:search" ng-class="{ 'warning':user.isDisabled }"> <td>{{user.name || user.email}}</td> <td> <input type="checkbox" ng-model="user.administrator" /> </td> <td class="action"> <button class="btn btn-primary" ng-click="saveUser(user)"> <span class="glyphicon glyphicon-save"></span> </button> - <button class="btn btn-warning" ng-click="banUser(user)"> <span class="glyphicon glyphicon-ban-circle"></span> </button> + <button class="btn btn-warning" ng-click="banUser(user)" ng-disabled="user.isDisabled"> <span class="glyphicon glyphicon-ban-circle"></span> </button> <button class="btn btn-danger" ng-click="deleteUser(user)"> <span class="glyphicon glyphicon-trash"></span> </button> </td> </tr> -- 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/adminUser in repository pollen. See http://git.chorem.org/pollen.git commit fe0076d40d5135764ee00082e9fb7fb6fb8fd1aa Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Jul 23 17:06:46 2014 +0200 add button 'Disable Me' in edit user profil --- pollen-ui-angular/src/main/webapp/i18n/en.js | 1 + pollen-ui-angular/src/main/webapp/i18n/fr.js | 1 + .../src/main/webapp/partials/user-edit.html | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pollen-ui-angular/src/main/webapp/i18n/en.js b/pollen-ui-angular/src/main/webapp/i18n/en.js index bade830..96817f0 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/en.js +++ b/pollen-ui-angular/src/main/webapp/i18n/en.js @@ -38,6 +38,7 @@ var translateEN = { 'user.edit.success' : 'Save with success', 'user.forgotPassword.success' : 'Password send by email', 'user.favoriteList' : 'Favorite list', +'user.disableMe' : 'Disable me', 'user.error.password.diff' : 'Passwords not equal', 'user.error.mail.notFound' : 'E-mail not found', 'user.error.mail.empty' : 'E-mail can not be empty', diff --git a/pollen-ui-angular/src/main/webapp/i18n/fr.js b/pollen-ui-angular/src/main/webapp/i18n/fr.js index dc11690..ad63d5e 100644 --- a/pollen-ui-angular/src/main/webapp/i18n/fr.js +++ b/pollen-ui-angular/src/main/webapp/i18n/fr.js @@ -38,6 +38,7 @@ var translateFR = { 'user.edit.success' : 'Modification effectuée..', 'user.forgotPassword.success' : 'Un mail de changement de mot de passe vient d\'être envoyé..', 'user.favoriteList' : 'Liste de Diffusion Favorite', +'user.disableMe' : 'Désactiver mon compte', 'user.error.password.diff' : 'Mot de passe différent', 'user.error.mail.notFound' : 'Courriel n\'a pas été trouvé', 'user.error.mail.empty' : 'Courriel ne peux pas être vide', diff --git a/pollen-ui-angular/src/main/webapp/partials/user-edit.html b/pollen-ui-angular/src/main/webapp/partials/user-edit.html index 15fdd66..7a24223 100644 --- a/pollen-ui-angular/src/main/webapp/partials/user-edit.html +++ b/pollen-ui-angular/src/main/webapp/partials/user-edit.html @@ -61,7 +61,7 @@ </form> -<div> +<div class="row"> <div class="col-sm-2"></div> <div class="col-sm-9"><hr/></div> <div class="col-sm-1"></div> @@ -103,4 +103,18 @@ <span class="glyphicon glyphicon-exclamation-sign danger" tooltip="{{ 'user.error.password.diff' | translate }}" ng-if="data.user.newPassword != data.user.newPassword2"></span> </div> </div> + + <div class="row"> + <div class="col-sm-2"></div> + <div class="col-sm-9"><hr/></div> + <div class="col-sm-1"></div> + </div> + + <div class="row"> + <div class="col-sm-5"></div> + <div class="col-sm-7"> + <button class="btn btn-warning" ng-click="disableUser()"><span class="glyphicon glyphicon-ban-circle"></span> {{ 'user.disableMe' | translate }}</button> + </div> + </div> + </form> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm