Search in sources :

Example 1 with UacRoleUser

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

the class UserManager method activeUser.

@MqProducerStore
public void activeUser(final MqMessageData mqMessageData, final UacUser uacUser, final String activeUserKey) {
    log.info("激活用户. mqMessageData={}, user={}", mqMessageData, uacUser);
    int result = uacUserMapper.updateByPrimaryKeySelective(uacUser);
    if (result < 1) {
        throw new UacBizException(ErrorCodeEnum.UAC10011038, uacUser.getId());
    }
    // 绑定一个访客角色默认值roleId=10000
    final Long userId = uacUser.getId();
    Preconditions.checkArgument(userId != null, "用戶Id不能爲空");
    final Long roleId = 10000L;
    UacRoleUser roleUser = new UacRoleUser();
    roleUser.setUserId(userId);
    roleUser.setRoleId(roleId);
    uacRoleUserMapper.insertSelective(roleUser);
    // 绑定一个组织
    UacGroupUser groupUser = new UacGroupUser();
    groupUser.setUserId(userId);
    groupUser.setGroupId(GlobalConstant.Sys.SUPER_MANAGER_GROUP_ID);
    uacGroupUserMapper.insertSelective(groupUser);
    // 删除 activeUserToken
    redisService.deleteKey(activeUserKey);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacRoleUser(com.paascloud.provider.model.domain.UacRoleUser) UacGroupUser(com.paascloud.provider.model.domain.UacGroupUser) MqProducerStore(com.paascloud.provider.annotation.MqProducerStore)

Example 2 with UacRoleUser

use of com.paascloud.provider.model.domain.UacRoleUser 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 3 with UacRoleUser

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

the class UacRoleUserServiceImpl method saveRoleUser.

@Override
public int saveRoleUser(Long userId, Long roleId) {
    if (userId == null) {
        throw new UacBizException(ErrorCodeEnum.UAC10011001);
    }
    if (roleId == null) {
        throw new UacBizException(ErrorCodeEnum.UAC10012001);
    }
    UacRoleUser roleUser = new UacRoleUser();
    roleUser.setUserId(userId);
    roleUser.setRoleId(roleId);
    return uacRoleUserMapper.insertSelective(roleUser);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacRoleUser(com.paascloud.provider.model.domain.UacRoleUser)

Example 4 with UacRoleUser

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

the class UacRoleUserServiceImpl method deleteByUserId.

@Override
public int deleteByUserId(Long userId) {
    if (null == userId) {
        throw new UacBizException(ErrorCodeEnum.UAC10011001);
    }
    UacRoleUser param = new UacRoleUser();
    param.setUserId(userId);
    return uacRoleUserMapper.delete(param);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacRoleUser(com.paascloud.provider.model.domain.UacRoleUser)

Aggregations

UacRoleUser (com.paascloud.provider.model.domain.UacRoleUser)4 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)4 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 MqProducerStore (com.paascloud.provider.annotation.MqProducerStore)1 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)1 UacRole (com.paascloud.provider.model.domain.UacRole)1 ApiOperation (io.swagger.annotations.ApiOperation)1