Search in sources :

Example 1 with DataScope

use of com.ruoyi.common.annotation.DataScope in project hocassian-media-matrix by hokaso.

the class DataScopeAspect method handleDataScope.

protected void handleDataScope(final JoinPoint joinPoint) {
    // 获得注解
    DataScope controllerDataScope = getAnnotationLog(joinPoint);
    if (controllerDataScope == null) {
        return;
    }
    // 获取当前的用户
    LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
    if (StringUtils.isNotNull(loginUser)) {
        SysUser currentUser = loginUser.getUser();
        // 如果是超级管理员,则不过滤数据
        if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) {
            dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias());
        }
    }
}
Also used : DataScope(com.ruoyi.common.annotation.DataScope) SysUser(com.ruoyi.common.core.domain.entity.SysUser) LoginUser(com.ruoyi.common.core.domain.model.LoginUser) TokenService(com.ruoyi.framework.web.service.TokenService)

Aggregations

DataScope (com.ruoyi.common.annotation.DataScope)1 SysUser (com.ruoyi.common.core.domain.entity.SysUser)1 LoginUser (com.ruoyi.common.core.domain.model.LoginUser)1 TokenService (com.ruoyi.framework.web.service.TokenService)1