Search in sources :

Example 1 with UserEntity

use of com.varsql.web.model.entity.user.UserEntity in project varsql by varsqlinfo.

the class JoinServiceImpl method saveUser.

/**
 * @method  : saveUser
 * @desc : 사용자 정보 등록.
 * @author   : ytkim
 * @date   : 2020. 4. 27.
 * @param joinForm
 * @return
 * @throws EncryptDecryptException
 */
public boolean saveUser(UserReqeustDTO joinForm) throws EncryptDecryptException {
    logger.debug("saveUser {} ", VartechUtils.reflectionToString(joinForm));
    UserEntity entity = joinForm.toEntity();
    entity.setUserRole(AuthorityType.GUEST.name());
    entity.setAcceptYn(false);
    userMgmtRepository.save(entity);
    return true;
}
Also used : UserEntity(com.varsql.web.model.entity.user.UserEntity)

Example 2 with UserEntity

use of com.varsql.web.model.entity.user.UserEntity in project varsql by varsqlinfo.

the class UserMgmtServiceImpl method updateAccept.

/**
 * @Method Name  : updateAccept
 * @Method 설명 : 사용자 수락 거부 .
 * @작성자   : ytkim
 * @작성일   : 2017. 12. 1.
 * @변경이력  :
 * @param paramMap
 * @return
 */
@Transactional(value = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Exception.class)
public ResponseResult updateAccept(String acceptyn, String selectItem) {
    String[] viewidArr = StringUtils.split(selectItem, ",");
    AuthorityType role = "Y".equals(acceptyn) ? AuthorityType.USER : AuthorityType.GUEST;
    List<UserEntity> users = userMgmtRepository.findByViewidIn(Arrays.asList(viewidArr)).stream().map(item -> {
        item.setUserRole(role.name());
        item.setAcceptYn("Y".equals(acceptyn) ? true : false);
        return item;
    }).collect(Collectors.toList());
    userMgmtRepository.saveAll(users);
    return VarsqlUtils.getResponseResultItemOne(1);
}
Also used : Arrays(java.util.Arrays) UserEntity(com.varsql.web.model.entity.user.UserEntity) Configuration(com.varsql.core.configuration.Configuration) ResourceConfigConstants(com.varsql.web.constants.ResourceConfigConstants) Autowired(org.springframework.beans.factory.annotation.Autowired) UUIDUtil(com.varsql.core.common.util.UUIDUtil) ResponseResult(com.vartech.common.app.beans.ResponseResult) DBGroupEntityRepository(com.varsql.web.repository.db.DBGroupEntityRepository) VarsqlUtils(com.varsql.web.util.VarsqlUtils) ParamMap(com.vartech.common.app.beans.ParamMap) SecurityUtil(com.varsql.core.common.util.SecurityUtil) DBBlockingUserEntity(com.varsql.web.model.entity.db.DBBlockingUserEntity) Service(org.springframework.stereotype.Service) MessageDTO(com.varsql.web.dto.websocket.MessageDTO) Qualifier(org.springframework.beans.factory.annotation.Qualifier) UserMgmtRepository(com.varsql.web.repository.user.UserMgmtRepository) EncryptDecryptException(com.vartech.common.crypto.EncryptDecryptException) DBManagerSpec(com.varsql.web.repository.spec.DBManagerSpec) SearchParameter(com.vartech.common.app.beans.SearchParameter) DBGroupMappingUserEntityRepository(com.varsql.web.repository.db.DBGroupMappingUserEntityRepository) PasswordUtil(com.vartech.common.crypto.password.PasswordUtil) AbstractService(com.varsql.web.common.service.AbstractService) UserDBConnectionEntityRepository(com.varsql.web.repository.user.UserDBConnectionEntityRepository) MessageType(com.varsql.web.constants.MessageType) StringUtils(com.vartech.common.utils.StringUtils) RequestResultCode(com.vartech.common.constants.RequestResultCode) Page(org.springframework.data.domain.Page) DBGroupSpec(com.varsql.web.repository.spec.DBGroupSpec) Collectors(java.util.stream.Collectors) WebSocketServiceImpl(com.varsql.web.app.websocket.service.WebSocketServiceImpl) UserSpec(com.varsql.web.repository.spec.UserSpec) List(java.util.List) PasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder) DBManagerEntityRepository(com.varsql.web.repository.db.DBManagerEntityRepository) DBBlockingUserEntityRepository(com.varsql.web.repository.db.DBBlockingUserEntityRepository) AuthorityType(com.varsql.core.auth.AuthorityType) Transactional(org.springframework.transaction.annotation.Transactional) UserMapper(com.varsql.web.model.mapper.user.UserMapper) AuthorityType(com.varsql.core.auth.AuthorityType) UserEntity(com.varsql.web.model.entity.user.UserEntity) DBBlockingUserEntity(com.varsql.web.model.entity.db.DBBlockingUserEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with UserEntity

use of com.varsql.web.model.entity.user.UserEntity in project varsql by varsqlinfo.

the class UserMgmtServiceImpl method initPassword.

/**
 * @Method Name  : initPassword
 * @Method 설명 : 패스워드 초기화
 * @작성자   : ytkim
 * @작성일   : 2017. 12. 1.
 * @변경이력  :
 * @param PasswordForm
 * @return
 * @throws EncryptDecryptException
 */
public ResponseResult initPassword(String viewid) throws EncryptDecryptException {
    String passwordInfo = PasswordUtil.createPassword(Configuration.getInstance().passwordType(), Configuration.getInstance().passwordInitSize());
    UserEntity entity = userMgmtRepository.findByViewid(viewid);
    entity.setUpw(passwordInfo);
    entity = userMgmtRepository.save(entity);
    return VarsqlUtils.getResponseResultItemOne(passwordInfo);
}
Also used : UserEntity(com.varsql.web.model.entity.user.UserEntity) DBBlockingUserEntity(com.varsql.web.model.entity.db.DBBlockingUserEntity)

Example 4 with UserEntity

use of com.varsql.web.model.entity.user.UserEntity in project varsql by varsqlinfo.

the class ManagerMgmtServiceImpl method updateManagerRole.

/**
 * @method  : updateManagerRole
 * @desc : 매니저 role 등록 삭제.
 * @author   : ytkim
 * @date   : 2020. 4. 22.
 * @param mode
 * @param viewid
 * @return
 */
@Transactional(value = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Exception.class)
public ResponseResult updateManagerRole(String mode, String viewid) {
    logger.info("updateManagerRole  mode : {} , viewid : {} ", mode, viewid);
    UserEntity userInfo = userMgmtRepository.findByViewid(viewid);
    userInfo.setUserRole("add".equals(mode) ? AuthorityType.MANAGER.name() : AuthorityType.USER.name());
    userInfo = userMgmtRepository.save(userInfo);
    if (!"add".equals(mode)) {
        dbManagerRepository.deleteByViewid(viewid);
    }
    return VarsqlUtils.getResponseResultItemOne(1);
}
Also used : UserEntity(com.varsql.web.model.entity.user.UserEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with UserEntity

use of com.varsql.web.model.entity.user.UserEntity in project varsql by varsqlinfo.

the class UserPreferencesServiceImpl method updatePasswordInfo.

/**
 * @Method Name  : updatePasswordInfo
 * @Method 설명 : 비밀번호 변경.
 * @작성자   : ytkim
 * @작성일   : 2017. 11. 29.
 * @변경이력  :
 * @param passwordForm
 * @param resultObject
 * @return
 * @throws EncryptDecryptException
 */
public ResponseResult updatePasswordInfo(PasswordRequestDTO passwordForm) throws EncryptDecryptException {
    UserEntity userInfo = userMgmtRepository.findByViewid(SecurityUtil.userViewId());
    ResponseResult resultObject = new ResponseResult();
    if (passwordEncoder.matches(passwordForm.getCurrPw(), userInfo.getUpw())) {
        userInfo.setUpw(passwordForm.getUpw());
        userMgmtRepository.save(userInfo);
        resultObject.setItemOne(1);
    } else {
        resultObject.setResultCode(VarsqlAppCode.COMM_PASSWORD_NOT_VALID);
    }
    return resultObject;
}
Also used : ResponseResult(com.vartech.common.app.beans.ResponseResult) UserEntity(com.varsql.web.model.entity.user.UserEntity)

Aggregations

UserEntity (com.varsql.web.model.entity.user.UserEntity)10 DBBlockingUserEntity (com.varsql.web.model.entity.db.DBBlockingUserEntity)3 ResponseResult (com.vartech.common.app.beans.ResponseResult)3 AuthorityType (com.varsql.core.auth.AuthorityType)2 VarsqlAppException (com.varsql.web.exception.VarsqlAppException)2 Test (org.junit.jupiter.api.Test)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Authority (com.varsql.core.auth.Authority)1 User (com.varsql.core.auth.User)1 SecurityUtil (com.varsql.core.common.util.SecurityUtil)1 UUIDUtil (com.varsql.core.common.util.UUIDUtil)1 Configuration (com.varsql.core.configuration.Configuration)1 WebSocketServiceImpl (com.varsql.web.app.websocket.service.WebSocketServiceImpl)1 AbstractService (com.varsql.web.common.service.AbstractService)1 MessageType (com.varsql.web.constants.MessageType)1 ResourceConfigConstants (com.varsql.web.constants.ResourceConfigConstants)1 MessageDTO (com.varsql.web.dto.websocket.MessageDTO)1 UserMapper (com.varsql.web.model.mapper.user.UserMapper)1 DBBlockingUserEntityRepository (com.varsql.web.repository.db.DBBlockingUserEntityRepository)1 DBGroupEntityRepository (com.varsql.web.repository.db.DBGroupEntityRepository)1