- 修复RouteService中错误过滤home路由的问题 - 后端现在正确返回所有用户有权限的路由 - 添加设备管理相关功能(列表、在线监控、电源管理、远程监控) - 添加详细的修复文档和重启脚本 - 更新权限配置脚本 问题根源:后端代码中有逻辑会过滤掉home路由,导致前端收到空数组,无法生成菜单 解决方案:移除过滤home路由的逻辑,让后端返回所有有权限的路由
151 lines
3.6 KiB
C#
151 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Intel.Management.PSModule
|
|
{
|
|
class ChildWriter
|
|
{
|
|
List<DriveItem> _list;
|
|
// bool _cachResults;
|
|
DriveProvider _provider;
|
|
DriveContainer _parent;
|
|
string _path;
|
|
bool _recurse;
|
|
|
|
|
|
public ChildWriter(DriveContainer parent, string path, bool recurse,DriveProvider provider)
|
|
{
|
|
_list = new List<DriveItem>();
|
|
//_cachResults = true;
|
|
_provider = provider;
|
|
_parent = parent;
|
|
_path = path;
|
|
_recurse = recurse;
|
|
}
|
|
|
|
public ChildWriter()
|
|
{
|
|
//_cachResults = true;
|
|
}
|
|
|
|
public void SetParent(DriveContainer newParent)
|
|
{
|
|
if (_path !=null || ( newParent != null && _parent != null))
|
|
throw new InvalidOperationException();
|
|
|
|
_parent = newParent;
|
|
if (_parent == null)
|
|
{
|
|
_list.Clear();
|
|
_list = null;
|
|
_path = null;
|
|
//_cachResults = true;
|
|
_recurse = false;
|
|
|
|
}
|
|
else
|
|
{
|
|
_list = new List<DriveItem>();
|
|
}
|
|
}
|
|
|
|
public void Add(DriveItem[] items)
|
|
{
|
|
_list.AddRange(items);
|
|
}
|
|
|
|
public void Add(DriveItem item)
|
|
{
|
|
_list.Add(item);
|
|
}
|
|
|
|
public DriveItem FindItem(string name)
|
|
{
|
|
foreach (DriveItem item in _list)
|
|
{
|
|
if (string.Compare(item.Name, name) == 0)
|
|
return item;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public DriveProvider Provider
|
|
{
|
|
get
|
|
{
|
|
return _provider;
|
|
}
|
|
set
|
|
{
|
|
_provider = value;
|
|
}
|
|
}
|
|
|
|
/* public bool CacheResults
|
|
{
|
|
get { return _cachResults; }
|
|
set { _cachResults = value; }
|
|
}*/
|
|
|
|
public DriveItem[] Children
|
|
{
|
|
get { return _list.ToArray(); }
|
|
}
|
|
|
|
public void Flush()
|
|
{
|
|
WriteChildren(_parent, _path);
|
|
_list.Clear();
|
|
}
|
|
|
|
public bool Force
|
|
{
|
|
get
|
|
{
|
|
if (_provider != null)
|
|
return _provider.Force.IsPresent;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
private void WriteChildren(DriveContainer parent, string parentPath)
|
|
{
|
|
DriveItem[] items = items=parent.GetChildItems();
|
|
|
|
if (items == null || Force ) //items have not been retrieved
|
|
{
|
|
if (_list.Count==0)
|
|
parent.GetChildItems(this); // get items into the writer
|
|
items = _list.ToArray();
|
|
_list.Clear();
|
|
parent.SetChildItems(items);
|
|
}
|
|
|
|
if (parentPath != null)
|
|
{
|
|
foreach (DriveItem item in items)
|
|
{
|
|
WriteItem(item, parentPath + "\\" + item.Name);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void WriteItem(DriveItem item,string childPath)
|
|
{
|
|
if (_path != null)
|
|
{
|
|
_provider.WriteItemObject(item.GetReturnObject(),childPath, item is DriveContainer);
|
|
}
|
|
|
|
if (item is DriveContainer && _recurse)
|
|
{
|
|
WriteChildren((DriveContainer)item, childPath);
|
|
}
|
|
}
|
|
}//End ChildWriter
|
|
|
|
}//End Namespace
|