branch develop updated (3679385 -> b411b4d)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git from 3679385 Merge branch 'feature/6142-filter-documents-list' into develop new b411b4d #6015 User deletion is not a real deletion : user become non active The 1 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 b411b4df246b2d55f2743ba64eee192aff120230 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Nov 27 11:53:32 2014 +0100 #6015 User deletion is not a real deletion : user become non active Summary of changes: .../src/main/xmi/coselmar-model.zargo | Bin 6490 -> 6557 bytes .../main/java/fr/ifremer/coselmar/beans/UserBean.java | 12 +++++++++++- .../coselmar/converter/BeanEntityConverter.java | 3 ++- .../ifremer/coselmar/services/v1/UsersWebService.java | 7 +++++-- coselmar-ui/src/main/webapp/views/users/user.html | 9 +++++++-- coselmar-ui/src/main/webapp/views/users/users.html | 3 +++ 6 files changed, 28 insertions(+), 6 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 coselmar. See http://git.codelutin.com/coselmar.git commit b411b4df246b2d55f2743ba64eee192aff120230 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Nov 27 11:53:32 2014 +0100 #6015 User deletion is not a real deletion : user become non active --- .../src/main/xmi/coselmar-model.zargo | Bin 6490 -> 6557 bytes .../main/java/fr/ifremer/coselmar/beans/UserBean.java | 12 +++++++++++- .../coselmar/converter/BeanEntityConverter.java | 3 ++- .../ifremer/coselmar/services/v1/UsersWebService.java | 7 +++++-- coselmar-ui/src/main/webapp/views/users/user.html | 9 +++++++-- coselmar-ui/src/main/webapp/views/users/users.html | 3 +++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/coselmar-persistence/src/main/xmi/coselmar-model.zargo b/coselmar-persistence/src/main/xmi/coselmar-model.zargo index 9036e41..04c2341 100644 Binary files a/coselmar-persistence/src/main/xmi/coselmar-model.zargo and b/coselmar-persistence/src/main/xmi/coselmar-model.zargo differ diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserBean.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserBean.java index c0b976e..27378af 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserBean.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/UserBean.java @@ -16,8 +16,9 @@ public class UserBean implements Serializable { protected String organization; protected String password; protected String newPassword; + protected boolean active; - public UserBean(String id, String firstName, String name, String mail, String role, String qualification, String organization) { + public UserBean(String id, String firstName, String name, String mail, String role, String qualification, String organization, boolean active) { this.id = id; this.firstName = firstName; this.name = name; @@ -25,6 +26,7 @@ public class UserBean implements Serializable { this.role = role; this.qualification = qualification; this.organization = organization; + this.active = active; } public String getId() { @@ -98,4 +100,12 @@ public class UserBean implements Serializable { public void setNewPassword(String newPassword) { this.newPassword = newPassword; } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java index bed5346..fcebb4a 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java @@ -78,7 +78,8 @@ public class BeanEntityConverter { user.getMail(), user.getRole().name(), user.getQualification(), - user.getOrganization()); + user.getOrganization(), + user.isActive()); } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java index ebb6f42..dfe55b6 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java @@ -100,6 +100,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { userEntity.setRole(CoselmarUserRole.valueOf(user.getRole().toUpperCase())); userEntity.setQualification(user.getQualification()); userEntity.setOrganization(user.getOrganization()); + userEntity.setActive(true); String password = user.getPassword(); if (StringUtils.isBlank(password)) { @@ -223,7 +224,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { Preconditions.checkNotNull(mail); Preconditions.checkNotNull(password); - CoselmarUser user = getCoselmarUserDao().forMailEquals(getCleanMail(mail)).findAny(); + CoselmarUser user = getCoselmarUserDao().forMailEquals(getCleanMail(mail)).addEquals(CoselmarUser.PROPERTY_ACTIVE, true).findAny(); String salt = user.getSalt(); checkPassword(user.getPassword(), salt, password); @@ -262,7 +263,9 @@ public class UsersWebService extends CoselmarWebServiceSupport { String fullId = CoselmarUser.class.getCanonicalName() + "_" + userId; CoselmarUser user = getCoselmarUserDao().forTopiaIdEquals(fullId).findUnique(); - getCoselmarUserDao().delete(user); + + // User is not really deleted : only disable. + user.setActive(false); commit(); } diff --git a/coselmar-ui/src/main/webapp/views/users/user.html b/coselmar-ui/src/main/webapp/views/users/user.html index 37514ad..1905bb3 100644 --- a/coselmar-ui/src/main/webapp/views/users/user.html +++ b/coselmar-ui/src/main/webapp/views/users/user.html @@ -22,10 +22,15 @@ <td>Role</td> <td>{{user.role}}</td> </tr> + <tr> + <td>Status</td> + <td ng-if="user.active">Active</td> + <td ng-if="!user.active">Deleted</td> + </tr> </table> <div style="padding-left: 200px"> - <a class="btn btn-warning" ng-click="modifyUser()">Modify</a> - <a class="btn btn-danger" ng-click="deleteUser(user.id)" ng-if="currentUser.role == 'ADMIN'">Delete</a> + <a class="btn btn-warning" ng-click="modifyUser()" ng-if="user.active">Modify</a> + <a class="btn btn-danger" ng-click="deleteUser(user.id)" ng-if="currentUser.role == 'ADMIN' && user.active">Delete</a> </div> </div> diff --git a/coselmar-ui/src/main/webapp/views/users/users.html b/coselmar-ui/src/main/webapp/views/users/users.html index c9db771..047107b 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -28,6 +28,7 @@ <th>Qualification</th> <th>Organization</th> <th>Role</th> + <th>Status</th> <th></th> </tr> <tr ng-repeat="user in users"> @@ -36,6 +37,8 @@ <td>{{user.qualification}}</td> <td>{{user.organization}}</td> <td>{{user.role}}</td> + <td ng-if="user.active">Active</td> + <td ng-if="!user.active">Deleted</td> <td><a class="btn btn-warning" href="users/{{user.id}}?edit">Modify</a><a class="btn btn-danger" ng-click="deleteUser(user.id)">Delete</a></td> </tr> </table> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm