Search in sources :

Example 36 with SysUser

use of com.ruoyi.system.api.domain.SysUser in project RuoYi-Cloud-Plus by JavaLionLi.

the class SysUserServiceImpl method checkUserDataScope.

/**
 * 校验用户是否有数据权限
 *
 * @param userId 用户id
 */
@Override
public void checkUserDataScope(Long userId) {
    if (!LoginHelper.isAdmin()) {
        SysUser user = new SysUser();
        user.setUserId(userId);
        List<SysUser> users = this.selectUserList(user);
        if (CollUtil.isEmpty(users)) {
            throw new ServiceException("没有权限访问用户数据!");
        }
    }
}
Also used : SysUser(com.ruoyi.system.api.domain.SysUser) ServiceException(com.ruoyi.common.core.exception.ServiceException)

Example 37 with SysUser

use of com.ruoyi.system.api.domain.SysUser in project RuoYi-Cloud-Plus by JavaLionLi.

the class RemoteUserServiceImpl method getUserInfoByOpenid.

@Override
public XcxLoginUser getUserInfoByOpenid(String openid) throws UserException {
    // todo 自行实现 userService.selectUserByOpenid(openid);
    SysUser sysUser = new SysUser();
    if (ObjectUtil.isNull(sysUser)) {
    // todo 用户不存在 业务逻辑自行实现
    }
    if (UserStatus.DELETED.getCode().equals(sysUser.getDelFlag())) {
    // todo 用户已被删除 业务逻辑自行实现
    }
    if (UserStatus.DISABLE.getCode().equals(sysUser.getStatus())) {
    // todo 用户已被停用 业务逻辑自行实现
    }
    // 此处可根据登录用户的数据不同 自行创建 loginUser
    XcxLoginUser loginUser = new XcxLoginUser();
    loginUser.setUserId(sysUser.getUserId());
    loginUser.setUsername(sysUser.getUserName());
    loginUser.setUserType(sysUser.getUserType());
    loginUser.setOpenid(openid);
    return loginUser;
}
Also used : XcxLoginUser(com.ruoyi.system.api.model.XcxLoginUser) SysUser(com.ruoyi.system.api.domain.SysUser)

Aggregations

SysUser (com.ruoyi.system.api.domain.SysUser)37 LoginUser (com.ruoyi.system.api.model.LoginUser)13 Log (com.ruoyi.common.log.annotation.Log)12 ServiceException (com.ruoyi.common.core.exception.ServiceException)10 GetMapping (org.springframework.web.bind.annotation.GetMapping)8 PutMapping (org.springframework.web.bind.annotation.PutMapping)8 UserConstants (com.ruoyi.common.core.constant.UserConstants)6 R (com.ruoyi.common.core.domain.R)6 StringUtils (com.ruoyi.common.core.utils.StringUtils)6 BaseController (com.ruoyi.common.core.web.controller.BaseController)6 AjaxResult (com.ruoyi.common.core.web.domain.AjaxResult)6 BusinessType (com.ruoyi.common.log.enums.BusinessType)6 InnerAuth (com.ruoyi.common.security.annotation.InnerAuth)6 SysRole (com.ruoyi.system.api.domain.SysRole)6 ISysPermissionService (com.ruoyi.system.service.ISysPermissionService)6 ISysPostService (com.ruoyi.system.service.ISysPostService)6 ISysRoleService (com.ruoyi.system.service.ISysRoleService)6 ISysUserService (com.ruoyi.system.service.ISysUserService)6 IOException (java.io.IOException)6 Collectors (java.util.stream.Collectors)6