|
|
@@ -1,6 +1,9 @@ |
|
|
|
package com.ningdatech.pmapi.common.helper.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
import com.ningdatech.pmapi.sys.model.entity.Role; |
|
|
|
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; |
|
|
|
import com.ningdatech.pmapi.user.manage.UserAuthLoginManage; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@@ -38,14 +41,17 @@ public class UserInfoHelperImpl implements UserInfoHelper { |
|
|
|
return realName; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断此人是否是超管或者区管 |
|
|
|
* @param userId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public boolean isAdmin(Long userId) { |
|
|
|
//测试 先返回true |
|
|
|
return Boolean.TRUE; |
|
|
|
public boolean isSuperOrRegionAdmin(Long userId) { |
|
|
|
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId); |
|
|
|
if(CollUtil.isNotEmpty(userFullInfo.getUserRoleList())){ |
|
|
|
for(Role role : userFullInfo.getUserRoleList()){ |
|
|
|
if(RoleEnum.SUPER_ADMIN.equals(role.getCode()) || |
|
|
|
RoleEnum.REGION_ADMIN.equals(role.getCode()) ){ |
|
|
|
return Boolean.TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return Boolean.FALSE; |
|
|
|
} |
|
|
|
} |