Search in sources :

Example 1 with UacRole

use of com.paascloud.provider.model.domain.UacRole in project paascloud-master by paascloud.

the class UacRoleMainController method modifyUacRoleStatusById.

/**
 * 修改角色状态.
 *
 * @param modifyStatusDto the modify status dto
 *
 * @return the wrapper
 */
@LogAnnotation
@PostMapping(value = "/modifyRoleStatusById")
@ApiOperation(httpMethod = "POST", value = "根据角色Id修改角色状态")
public Wrapper modifyUacRoleStatusById(@ApiParam(name = "modifyRoleStatusDto", value = "修改角色状态数据") @RequestBody ModifyStatusDto modifyStatusDto) {
    logger.info("根据角色Id修改角色状态 modifyStatusDto={}", modifyStatusDto);
    Long roleId = modifyStatusDto.getId();
    if (roleId == null) {
        throw new UacBizException(ErrorCodeEnum.UAC10012001);
    }
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    Long userId = loginAuthDto.getUserId();
    UacRoleUser ru = uacRoleUserService.getByUserIdAndRoleId(userId, roleId);
    if (ru != null && UacRoleStatusEnum.DISABLE.getType().equals(modifyStatusDto.getStatus())) {
        throw new UacBizException(ErrorCodeEnum.UAC10012002);
    }
    UacRole uacRole = new UacRole();
    uacRole.setId(roleId);
    uacRole.setStatus(modifyStatusDto.getStatus());
    uacRole.setUpdateInfo(loginAuthDto);
    int result = uacRoleService.update(uacRole);
    return super.handleResult(result);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacRoleUser(com.paascloud.provider.model.domain.UacRoleUser) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) UacRole(com.paascloud.provider.model.domain.UacRole) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with UacRole

use of com.paascloud.provider.model.domain.UacRole in project paascloud-master by paascloud.

the class UacUserCommonController method queryUserInfo.

/**
 * 根据userId查询用户详细信息(连表查询).
 *
 * @return the wrapper
 */
@PostMapping(value = "/queryUserInfo/{loginName}")
@ApiOperation(httpMethod = "POST", value = "根据userId查询用户详细信息")
public Wrapper<UserVo> queryUserInfo(@PathVariable String loginName) {
    logger.info("根据userId查询用户详细信息");
    UserVo userVo = new UserVo();
    UacUser uacUser = uacUserService.findByLoginName(loginName);
    uacUser = uacUserService.findUserInfoByUserId(uacUser.getId());
    List<UacRole> roleList = uacRoleService.findAllRoleInfoByUserId(uacUser.getId());
    List<MenuVo> authTree = uacRoleService.getOwnAuthTree(uacUser.getId());
    BeanUtils.copyProperties(uacUser, userVo);
    if (PublicUtil.isNotEmpty(roleList)) {
        userVo.setRoles(new HashSet<>(roleList));
    }
    userVo.setAuthTree(authTree);
    return WrapMapper.ok(userVo);
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo) UacUser(com.paascloud.provider.model.domain.UacUser) UserVo(com.paascloud.provider.model.vo.UserVo) UacRole(com.paascloud.provider.model.domain.UacRole) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with UacRole

use of com.paascloud.provider.model.domain.UacRole in project paascloud-master by paascloud.

the class UacRoleServiceTest method findByLoginNameTest.

/**
 * Find by login name test.
 */
@Test
public void findByLoginNameTest() {
    UacRole admin = uacRoleService.findByRoleCode(GlobalConstant.Sys.SUPER_MANAGER_LOGIN_NAME);
    logger.info("findByLoginNameTest = {}", admin);
}
Also used : UacRole(com.paascloud.provider.model.domain.UacRole) Test(org.junit.Test)

Aggregations

UacRole (com.paascloud.provider.model.domain.UacRole)3 ApiOperation (io.swagger.annotations.ApiOperation)2 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 UacRoleUser (com.paascloud.provider.model.domain.UacRoleUser)1 UacUser (com.paascloud.provider.model.domain.UacUser)1 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)1 MenuVo (com.paascloud.provider.model.vo.MenuVo)1 UserVo (com.paascloud.provider.model.vo.UserVo)1 Test (org.junit.Test)1