@Test public void getUserResources() { }
@Override public Collection<PermissionBo> getUserResources(String username) { if (UserRealm.SUPER_USER.equals(username)) { final Collection<PermissionBo> resources = new ArrayList<>(); this.resourcesRepository.findAll().forEach((r) -> { PermissionBo bo = new PermissionBo(); BeanUtils.copyProperties(r, bo); bo.setResourceId(r.getId()); bo.setResourceName(r.getName()); bo.setParentId(r.getParent()!=null?r.getParent().getId():null); resources.add(bo); }); return resources; } Set<String> roleNames = shiroService.getUserRoleNames(username); List<PermissionBo> permissions = permissionRepository.findPermissionsByRoleNameIn(roleNames); return permissions; }
ResourcesServiceImpl extends BaseServiceImpl<Resources> implements ResourcesService { @Override public Collection<PermissionBo> getUserResources(String username) { if (UserRealm.SUPER_USER.equals(username)) { final Collection<PermissionBo> resources = new ArrayList<>(); this.resourcesRepository.findAll().forEach((r) -> { PermissionBo bo = new PermissionBo(); BeanUtils.copyProperties(r, bo); bo.setResourceId(r.getId()); bo.setResourceName(r.getName()); bo.setParentId(r.getParent()!=null?r.getParent().getId():null); resources.add(bo); }); return resources; } Set<String> roleNames = shiroService.getUserRoleNames(username); List<PermissionBo> permissions = permissionRepository.findPermissionsByRoleNameIn(roleNames); return permissions; } }
ResourcesServiceImpl extends BaseServiceImpl<Resources> implements ResourcesService { @Override public Collection<PermissionBo> getUserResources(String username) { if (UserRealm.SUPER_USER.equals(username)) { final Collection<PermissionBo> resources = new ArrayList<>(); this.resourcesRepository.findAll().forEach((r) -> { PermissionBo bo = new PermissionBo(); BeanUtils.copyProperties(r, bo); bo.setResourceId(r.getId()); bo.setResourceName(r.getName()); bo.setParentId(r.getParent()!=null?r.getParent().getId():null); resources.add(bo); }); return resources; } Set<String> roleNames = shiroService.getUserRoleNames(username); List<PermissionBo> permissions = permissionRepository.findPermissionsByRoleNameIn(roleNames); return permissions; }  }
ResourcesServiceImpl extends BaseServiceImpl<Resources> implements ResourcesService { @Override public Collection<PermissionBo> getUserResources(String username) { if (UserRealm.SUPER_USER.equals(username)) { final Collection<PermissionBo> resources = new ArrayList<>(); this.resourcesRepository.findAll().forEach((r) -> { PermissionBo bo = new PermissionBo(); BeanUtils.copyProperties(r, bo); bo.setResourceId(r.getId()); bo.setResourceName(r.getName()); bo.setParentId(r.getParent()!=null?r.getParent().getId():null); resources.add(bo); }); return resources; } Set<String> roleNames = shiroService.getUserRoleNames(username); List<PermissionBo> permissions = permissionRepository.findPermissionsByRoleNameIn(roleNames); return permissions; }  @Override List<Resources> findByResourceType(String resourcesType); @Override Collection<PermissionBo> getUserResources(String username); @Override Resources findById(Long id); @Override Page<Resources> findByParentId(Pageable pageable, Long parentId); @Override @Transactional(rollbackFor = Exception.class, timeout = 60, propagation = Propagation.REQUIRED) void deleteResource(Long[] ids); }
ResourcesServiceImpl extends BaseServiceImpl<Resources> implements ResourcesService { @Override public Collection<PermissionBo> getUserResources(String username) { if (UserRealm.SUPER_USER.equals(username)) { final Collection<PermissionBo> resources = new ArrayList<>(); this.resourcesRepository.findAll().forEach((r) -> { PermissionBo bo = new PermissionBo(); BeanUtils.copyProperties(r, bo); bo.setResourceId(r.getId()); bo.setResourceName(r.getName()); bo.setParentId(r.getParent()!=null?r.getParent().getId():null); resources.add(bo); }); return resources; } Set<String> roleNames = shiroService.getUserRoleNames(username); List<PermissionBo> permissions = permissionRepository.findPermissionsByRoleNameIn(roleNames); return permissions; }  @Override List<Resources> findByResourceType(String resourcesType); @Override Collection<PermissionBo> getUserResources(String username); @Override Resources findById(Long id); @Override Page<Resources> findByParentId(Pageable pageable, Long parentId); @Override @Transactional(rollbackFor = Exception.class, timeout = 60, propagation = Propagation.REQUIRED) void deleteResource(Long[] ids);  }