This is an automated email from the ASF dual-hosted git repository. martin_s pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/archiva-redback-core.git
commit b3430e067bfbf255f03c43c7c03428af6ab9aa4b Author: Martin Stockhammer <[email protected]> AuthorDate: Sun Nov 8 14:22:50 2020 +0100 Modifying user model for v2 REST API --- .../archiva/redback/rest/api/model/v2/User.java | 54 ++-------------------- .../rest/services/v2/DefaultUserService.java | 2 - .../redback/rest/services/v2/UserServiceTest.java | 1 - 3 files changed, 3 insertions(+), 54 deletions(-) diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/v2/User.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/v2/User.java index 67dc792..9209aa4 100644 --- a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/v2/User.java +++ b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/v2/User.java @@ -52,8 +52,6 @@ public class User private boolean passwordChangeRequired; - private boolean permanent; - private String confirmPassword; // Display Only Fields. @@ -77,18 +75,6 @@ public class User private List<String> assignedRoles; /** - * with some userManagerImpl it's not possible to edit users; - * @since 2.1 - */ - private boolean readOnly; - - /** - * as we can user multiple userManagers implementation we must track from which one this one comes. - * @since 2.1 - */ - private String userManagerId; - - /** * for request validation * * @since 2.2 @@ -119,8 +105,6 @@ public class User this.setPassword( user.getPassword() ); this.setValidated( user.isValidated() ); this.setPasswordChangeRequired( user.isPasswordChangeRequired() ); - this.setPermanent( user.isPermanent() ); - this.setUserManagerId( user.getUserManagerId() ); if (user.getAccountCreationDate()==null) { setTimestampAccountCreationByInstant( Instant.EPOCH ); @@ -142,7 +126,7 @@ public class User } - @Schema( name = "user_id", description = "The user id" ) + @Schema( name = "user_id", description = "The user id", required = true ) @XmlElement( name = "user_id" ) public String getUserId( ) { @@ -198,7 +182,7 @@ public class User this.locked = isLocked; } - + @Schema(description = "The password. This is required for creating new users." ) public String getPassword() { return password; @@ -209,6 +193,7 @@ public class User this.password = password; } + @Schema(description = "True, if user has to change password") public boolean isPasswordChangeRequired() { return passwordChangeRequired; @@ -219,16 +204,6 @@ public class User this.passwordChangeRequired = passwordChangeRequired; } - public boolean isPermanent() - { - return permanent; - } - - public void setPermanent( boolean permanent ) - { - this.permanent = permanent; - } - public String getConfirmPassword() { return confirmPassword; @@ -304,26 +279,6 @@ public class User this.assignedRoles = assignedRoles; } - public boolean isReadOnly() - { - return readOnly; - } - - public void setReadOnly( boolean readOnly ) - { - this.readOnly = readOnly; - } - - public String getUserManagerId() - { - return userManagerId; - } - - public void setUserManagerId( String userManagerId ) - { - this.userManagerId = userManagerId; - } - public String getValidationToken() { return validationToken; } @@ -343,15 +298,12 @@ public class User ", locked=" + locked + //", password='" + password + '\'' + ", passwordChangeRequired=" + passwordChangeRequired + - ", permanent=" + permanent + ", confirmPassword='" + confirmPassword + '\'' + ", timestampAccountCreation='" + timestampAccountCreation + '\'' + ", timestampLastLogin='" + timestampLastLogin + '\'' + ", timestampLastPasswordChange='" + timestampLastPasswordChange + '\'' + ", previousPassword='" + currentPassword + '\'' + ", assignedRoles=" + assignedRoles + - ", readOnly=" + readOnly + - ", userManagerId='" + userManagerId + '\'' + ", validationToken='" + validationToken + '\'' + '}'; } diff --git a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java index 000a4ce..d432482 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/v2/DefaultUserService.java @@ -260,7 +260,6 @@ public class DefaultUserService u.setPassword( user.getPassword() ); u.setLocked( user.isLocked() ); u.setPasswordChangeRequired( user.isPasswordChangeRequired() ); - u.setPermanent( user.isPermanent() ); u.setValidated( user.isValidated() ); u = userManager.addUser( u ); if ( !user.isPasswordChangeRequired() ) @@ -522,7 +521,6 @@ public class DefaultUserService if ( !StringUtils.isEmpty( user.getPassword( ) ) ) rawUser.setPassword( user.getPassword() ); rawUser.setPasswordChangeRequired( user.isPasswordChangeRequired() ); - rawUser.setPermanent( user.isPermanent() ); org.apache.archiva.redback.users.User updatedUser = userManager.updateUser( rawUser ); diff --git a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/UserServiceTest.java b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/UserServiceTest.java index 5469492..eab9e2b 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/UserServiceTest.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/UserServiceTest.java @@ -539,7 +539,6 @@ public class UserServiceTest // START SNIPPET: create-user User user = new User( "toto", "toto the king", "[email protected]", false, false ); user.setPassword( "foo123" ); - user.setPermanent( false ); user.setPasswordChangeRequired( false ); user.setLocked( false ); user.setValidated( true );
