|
|
@ -27,7 +27,7 @@ import java.util.*; |
|
|
|
* Created by qi_liang on 2018/6/21. |
|
|
|
* Created by qi_liang on 2018/6/21. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRoleResourcePermission> implements SysRoleResourcePermissionService { |
|
|
|
public class SysRoleResourcePermissionServiceImpl implements SysRoleResourcePermissionService { |
|
|
|
|
|
|
|
|
|
|
|
public static final String RESOURCE_SYMBOL = "_"; |
|
|
|
public static final String RESOURCE_SYMBOL = "_"; |
|
|
|
|
|
|
|
|
|
|
@ -128,10 +128,10 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol |
|
|
|
public List<PermissionVo> findAllPermissonVo() { |
|
|
|
public List<PermissionVo> findAllPermissonVo() { |
|
|
|
List<PermissionVo> list = new ArrayList<>(); |
|
|
|
List<PermissionVo> list = new ArrayList<>(); |
|
|
|
List<SysResource> sysResourceList = sysResourceDao.findAll(); |
|
|
|
List<SysResource> sysResourceList = sysResourceDao.findAll(); |
|
|
|
Iterator iterator = sysResourceList.iterator(); |
|
|
|
Iterator<SysResource> iterator = sysResourceList.iterator(); |
|
|
|
PermissionTyepEnum[] tyepEnums = PermissionTyepEnum.values(); |
|
|
|
PermissionTyepEnum[] tyepEnums = PermissionTyepEnum.values(); |
|
|
|
while (iterator.hasNext()){ |
|
|
|
while (iterator.hasNext()){ |
|
|
|
SysResource sysResource = (SysResource) iterator.next(); |
|
|
|
SysResource sysResource = iterator.next(); |
|
|
|
if (sysResource!=null){ |
|
|
|
if (sysResource!=null){ |
|
|
|
for (PermissionTyepEnum permissionTyepEnum:tyepEnums){ |
|
|
|
for (PermissionTyepEnum permissionTyepEnum:tyepEnums){ |
|
|
|
PermissionVo permissionVo = new PermissionVo(); |
|
|
|
PermissionVo permissionVo = new PermissionVo(); |
|
|
@ -151,19 +151,21 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol |
|
|
|
*内部方法,用于判断角色是否有权限 |
|
|
|
*内部方法,用于判断角色是否有权限 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean isCheck(Long resourceId,Long permissionId,Long roleId){ |
|
|
|
private boolean isCheck(Long resourceId,Long permissionId,Long roleId){ |
|
|
|
SysRoleResourcePermission roleResourcePermission=sysRoleResourcePermissionDao.getByResourceIdAndPermissionIdAndRoleId(resourceId,permissionId,roleId); |
|
|
|
boolean result = false; |
|
|
|
if (roleResourcePermission!=null&&StatusTypeEnum.STATUS_ACTIVITY_YES.getValue().equals(roleResourcePermission.getStatus())){ |
|
|
|
if (permissionId!=null&&roleId!=null){ |
|
|
|
return true; |
|
|
|
SysRoleResourcePermission roleResourcePermission=sysRoleResourcePermissionDao.getByResourceIdAndPermissionIdAndRoleId(resourceId,permissionId,roleId); |
|
|
|
}else{ |
|
|
|
if (roleResourcePermission!=null&&StatusTypeEnum.STATUS_ACTIVITY_YES.getValue().equals(roleResourcePermission.getStatus())){ |
|
|
|
return false; |
|
|
|
result = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
*内部方法,拼接资源和权限ID |
|
|
|
*内部方法,拼接资源和权限ID |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<String,Object> getAttributes(Long resourceId,Long permissionId){ |
|
|
|
private Map<String,Object> getAttributes(Long resourceId,Long permissionId){ |
|
|
|
Map<String,Object> map=new HashMap<>(); |
|
|
|
Map<String,Object> map=new HashMap<>(1); |
|
|
|
map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId); |
|
|
|
map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId); |
|
|
|
return map; |
|
|
|
return map; |
|
|
|
} |
|
|
|
} |
|
|
|