Skip to content

Commit

Permalink
Merge branch 'release/v1.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
shiido committed Dec 26, 2021
2 parents ff04d28 + cefa724 commit bb4b20a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.ai.st.microservice.administration</groupId>
<artifactId>st-microservice-administration</artifactId>
<version>1.3.5</version>
<version>1.3.6</version>
<name>st-microservice-administration2</name>
<description>Microservice Administration Users and Roles</description>

Expand Down Expand Up @@ -100,7 +100,7 @@
<dependency>
<groupId>com.ai.st.microservice.common</groupId>
<artifactId>st-common</artifactId>
<version>1.0.0</version>
<version>1.1.2</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
import java.util.stream.Collectors;

import com.ai.st.microservice.administration.dto.*;
import com.ai.st.microservice.administration.entities.CodeEntity;
import com.ai.st.microservice.administration.entities.RoleEntity;
import com.ai.st.microservice.administration.entities.UserEntity;
import com.ai.st.microservice.administration.exceptions.BusinessException;
import com.ai.st.microservice.administration.models.services.IRoleService;
import com.ai.st.microservice.administration.models.services.IUserService;

import com.ai.st.microservice.common.business.RoleBusiness;
import com.ai.st.microservice.common.clients.ManagerFeignClient;
import com.ai.st.microservice.common.clients.NotifierFeignClient;
import com.ai.st.microservice.common.clients.OperatorFeignClient;
import com.ai.st.microservice.common.clients.ProviderFeignClient;
import com.ai.st.microservice.common.dto.managers.MicroserviceManagerDto;
Expand All @@ -16,19 +22,13 @@
import com.ai.st.microservice.common.dto.providers.MicroserviceProviderDto;
import com.ai.st.microservice.common.dto.providers.MicroserviceProviderProfileDto;
import com.ai.st.microservice.common.dto.providers.MicroserviceProviderRoleDto;

import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;

import com.ai.st.microservice.administration.entities.CodeEntity;
import com.ai.st.microservice.administration.entities.RoleEntity;
import com.ai.st.microservice.administration.entities.UserEntity;
import com.ai.st.microservice.administration.exceptions.BusinessException;
import com.ai.st.microservice.administration.models.services.IRoleService;
import com.ai.st.microservice.administration.models.services.IUserService;

@Component
public class UserBusiness {

Expand Down Expand Up @@ -114,7 +114,7 @@ public UserDto getUserById(Long id) {
return userDto;
}

public UserDto createUser(String firstName, String lastName, String password, String email, String username,
public UserDto createUser(String firstName, String lastName, String password, String email, String username, boolean enabled,
List<Long> roles) throws BusinessException {

email = email.toLowerCase().trim();
Expand Down Expand Up @@ -147,7 +147,7 @@ public UserDto createUser(String firstName, String lastName, String password, St
userEntity.setLastName(lastName);
userEntity.setCreatedAt(new Date());
userEntity.setEmail(email);
userEntity.setEnabled(true);
userEntity.setEnabled(enabled);
userEntity.setUsername(username);
userEntity.setPassword(passwordEncode.encode(password));
userEntity.setRoles(listRoles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public ResponseEntity<Object> createUser(@RequestBody CreateUserDto requestCreat
throw new InputValidationException("Se debe especificar al menos un rol para el usuario.");
}

responseDto = userBusiness.createUser(firstName, lastName, password, email, username, roles);
responseDto = userBusiness.createUser(firstName, lastName, password, email, username, requestCreateUser.isEnabled(), roles);
httpStatus = HttpStatus.OK;

} catch (InputValidationException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class CreateUserDto implements Serializable {
@ApiModelProperty(required = true, notes = "Password")
private String password;

@ApiModelProperty(required = true, notes = "Enabled")
private boolean enabled;

@ApiModelProperty(required = true, notes = "Roles")
private List<Long> roles;

Expand Down Expand Up @@ -82,4 +85,11 @@ public void setRoles(List<Long> roles) {
this.roles = roles;
}

public boolean isEnabled() {
return enabled;
}

public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ spring:
application:
name: st-microservice-administration
profiles:
active: "production"
active: "develop"
cloud:
config:
enabled: true
Expand Down

0 comments on commit bb4b20a

Please sign in to comment.