96eb02df0c9665b1fd8aa1b30dab3d188998f44b
java/com.sap.sse.security.common/src/com/sap/sse/security/shared/dto/UserDTO.java
| ... | ... | @@ -59,7 +59,22 @@ public class UserDTO extends |
| 59 | 59 | Util.addAll(roles, this.getRolesInternal()); |
| 60 | 60 | this.lockedUntil = lockedUntil; |
| 61 | 61 | } |
| 62 | - |
|
| 62 | + |
|
| 63 | + public UserDTO copyWithTimePoint(TimePoint lockedUntil) { |
|
| 64 | + final List<AccountDTO> accountsCopy = new ArrayList<AccountDTO>(); |
|
| 65 | + Util.addAll(this.accounts, accountsCopy); |
|
| 66 | + final HashSet<RoleWithSecurityDTO> rolesCopy = new HashSet<>(); |
|
| 67 | + Util.addAll(this.roles, rolesCopy); |
|
| 68 | + final List<WildcardPermissionWithSecurityDTO> permissionsCopy = new ArrayList<WildcardPermissionWithSecurityDTO>(); |
|
| 69 | + for (WildcardPermission wp : this.getPermissions()) { |
|
| 70 | + permissionsCopy.add((WildcardPermissionWithSecurityDTO) wp); |
|
| 71 | + } |
|
| 72 | + final List<StrippedUserGroupDTO> groupsCopy = new ArrayList<StrippedUserGroupDTO>(); |
|
| 73 | + Util.addAll(this.groups, groupsCopy); |
|
| 74 | + return new UserDTO(this.getName(), this.email, this.fullName, this.company, this.locale, this.emailValidated, |
|
| 75 | + accountsCopy, rolesCopy, this.defaultTenantForCurrentServer, permissionsCopy, groupsCopy, lockedUntil); |
|
| 76 | + } |
|
| 77 | + |
|
| 63 | 78 | @Override |
| 64 | 79 | protected Set<RoleWithSecurityDTO> getRolesInternal() { |
| 65 | 80 | return roles; |
java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/client/usermanagement/UserTableWrapper.java
| ... | ... | @@ -250,27 +250,33 @@ extends TableWrapper<UserDTO, S, StringMessages, TR> { |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | private Consumer<UserDTO> onManageLockPressed(StringMessages stringMessages, ErrorReporter errorReporter) { |
| 253 | - return user -> { |
|
| 254 | - final boolean isLocked = user.getLockedUntil().after(TimePoint.now()); |
|
| 253 | + return selectedUser -> { |
|
| 254 | + final boolean isLocked = selectedUser.getLockedUntil().after(TimePoint.now()); |
|
| 255 | 255 | if (isLocked) { |
| 256 | - final String userName = user.getName(); |
|
| 256 | + final String userName = selectedUser.getName(); |
|
| 257 | 257 | final boolean didConfirm = Window.confirm(stringMessages.doYouReallyWantToUnlockUser(userName)); |
| 258 | 258 | if (didConfirm) { |
| 259 | - getUserManagementWriteService().unlockUser( |
|
| 260 | - userName, |
|
| 261 | - new AsyncCallback<SuccessInfo>() { |
|
| 262 | - @Override |
|
| 263 | - public void onSuccess(SuccessInfo result) { |
|
| 264 | - Window.alert(stringMessages.unlockSucceededFor(userName)); |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - @Override |
|
| 268 | - public void onFailure(Throwable caught) { |
|
| 269 | - Window.alert(stringMessages.unlockFailedFor(userName)); |
|
| 270 | - errorReporter.reportError(caught.getMessage()); |
|
| 259 | + getUserManagementWriteService().unlockUser(userName, new AsyncCallback<SuccessInfo>() { |
|
| 260 | + @Override |
|
| 261 | + public void onSuccess(SuccessInfo result) { |
|
| 262 | + Window.alert(stringMessages.unlockSucceededFor(userName)); |
|
| 263 | + final List<UserDTO> usersWithUpdate = new ArrayList<UserDTO>(); |
|
| 264 | + for (UserDTO user : getAllUsers()) { |
|
| 265 | + if (user.getFullName() == selectedUser.getFullName()) { |
|
| 266 | + usersWithUpdate.add(user.copyWithTimePoint(null)); |
|
| 267 | + } else { |
|
| 268 | + usersWithUpdate.add(user); |
|
| 269 | + } |
|
| 271 | 270 | } |
| 271 | + filterField.updateAll(usersWithUpdate); |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + @Override |
|
| 275 | + public void onFailure(Throwable caught) { |
|
| 276 | + Window.alert(stringMessages.unlockFailedFor(userName)); |
|
| 277 | + errorReporter.reportError(caught.getMessage()); |
|
| 272 | 278 | } |
| 273 | - ); |
|
| 279 | + }); |
|
| 274 | 280 | } |
| 275 | 281 | } else { |
| 276 | 282 | Window.alert(stringMessages.userIsAlreadyUnlocked()); |