This is an automated email from the git hooks/post-receive script. New commit to branch feature/pollen-riot-js in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit b89351eea1b46e5ec4da03a8b64124537921b44b Author: Tony CHEMIT <dev@tchemit.fr> Date: Thu Feb 2 08:24:38 2017 +0100 gestion des utilisateurs bannis --- .../chorem/pollen/services/bean/PollenUserBean.java | 12 ++++++++++++ pollen-ui-riot-js/src/main/web/i18n.json | 2 ++ pollen-ui-riot-js/src/main/web/tag/Users.tag | 21 +++++++++++++-------- 3 files changed, 27 insertions(+), 8 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 8ced4a7..a5994e6 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 @@ -21,6 +21,7 @@ package org.chorem.pollen.services.bean; * #L% */ +import org.apache.commons.lang3.StringUtils; import org.chorem.pollen.persistence.entity.PollenUser; import org.chorem.pollen.persistence.entity.PollenUserImpl; @@ -44,6 +45,8 @@ public class PollenUserBean extends PollenBean<PollenUser> { protected boolean isDisabled; + protected boolean isBanned; + protected boolean emailIsValidate; public PollenUserBean() { @@ -57,6 +60,7 @@ public class PollenUserBean extends PollenBean<PollenUser> { setName(entity.getName()); setAdministrator(entity.isAdministrator()); + setBanned(StringUtils.isEmpty(entity.getPassword())); setLanguage(entity.getLanguage()); setEmail(entity.getEmail()); setPassword(entity.getPassword()); @@ -135,4 +139,12 @@ public class PollenUserBean extends PollenBean<PollenUser> { public void setEmailIsValidate(boolean emailIsValidate) { this.emailIsValidate = emailIsValidate; } + + public boolean isBanned() { + return isBanned; + } + + public void setBanned(boolean banned) { + isBanned = banned; + } } diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 78b3af8..46bfa32 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -207,6 +207,7 @@ "users_CREATED": "En cours d'utilisation", "users_VALIDATION": "En cours de validation", "users_DISABLED": "Désactivé", + "users_BANNED": "Banni", "": "" }, "en": { @@ -419,6 +420,7 @@ "users_CREATED": "Account in use", "users_VALIDATION": "Account validation", "users_DISABLED": "Account disabled", + "users_BANNED": "Account banned", "": "" } } \ No newline at end of file diff --git a/pollen-ui-riot-js/src/main/web/tag/Users.tag b/pollen-ui-riot-js/src/main/web/tag/Users.tag index 493faf0..80d6a59 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Users.tag +++ b/pollen-ui-riot-js/src/main/web/tag/Users.tag @@ -45,9 +45,9 @@ require('./Pagination.tag'); <div if="{user.id!=connectedUser.id}" class="dropdown"> <a class="header-link"><i class="fa fa-navicon fa-15x"/></a> <div class="dropdown-content" id="{user.id}"> - <a if="{!user.administrator}" onclick="{makeAdmin}">{parent.__.makeAdmin}</a> - <a if="{user.administrator}" onclick="{unmakeAdmin}">{parent.__.unmakeAdmin}</a> - <a onclick="{banUser}">{parent.__.banUser}</a> + <a if="{!user.administrator && !user.isBanned}" onclick="{makeAdmin}">{parent.__.makeAdmin}</a> + <a if="{user.administrator && !user.isBanned}" onclick="{unmakeAdmin}">{parent.__.unmakeAdmin}</a> + <a if="{!user.isBanned}" onclick="{banUser}">{parent.__.banUser}</a> <a onclick="{deleteUser}">{parent.__.deleteUser}</a> </div> </div> @@ -89,26 +89,29 @@ require('./Pagination.tag'); let userService = require('../js/UserService'); + this.reloadPagination = ()=> { + this.pagination.onSortChange(this.sortOwner.getAttribute('sortName'), this.sortValue); + }; this.makeAdmin = e => { let userId = e.target.parentNode.id; console.info('user id: ' + userId); userService.makeAdmin(userId).then(result=> { - this.pagination.onSortChange(this.sortOwner.getAttribute('sortName'), this.sortValue); + this.reloadPagination(); }); }; this.unmakeAdmin = e => { let userId = e.target.parentNode.id; console.info('user id: ' + userId); userService.unmakeAdmin(userId).then(result=> { - this.pagination.onSortChange(this.sortOwner.getAttribute('sortName'), this.sortValue); + this.reloadPagination(); }); }; this.banUser = e => { let userId = e.target.parentNode.id; console.info('user id: ' + userId); userService.banUser(userId).then(result=> { - this.pagination.refresh(); + this.reloadPagination(); }); }; this.deleteUser = e => { @@ -116,7 +119,7 @@ require('./Pagination.tag'); console.info('user id: ' + userId); if (confirm(this.__deleteUserMessage)) { userService.deleteUser(userId).then(result=> { - this.pagination.refresh(); + this.reloadPagination(); }); } }; @@ -146,6 +149,8 @@ require('./Pagination.tag'); } if (u.isDisabled) { status = 'DISABLE'; + }if (u.isBanned) { + status = 'BANNED'; } u.status = this.__[status]; }); @@ -179,7 +184,7 @@ require('./Pagination.tag'); this.sortValue = true; } - this.pagination.onSortChange(this.sortOwner.getAttribute('sortName'), this.sortValue); + this.reloadPagination(); }; i18nCallback(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.