/// <summary> /// 获取指定用户的特定类型和属主的所有类型的动作列表,会含有重复项 /// </summary> /// <param name="username">用户名</param> /// <param name="owner">上级</param> /// <param name="currentrole">当前角色</param> /// <returns></returns> public static List <action> getUserAllAction(string username, role currentrole, string owner = "") { List <action> rr = new List <action>(); IroleActionEx _roleActionEx = IocModule.GetEntity <IroleActionEx>(); if (currentrole != null) { rr.AddRange(_roleActionEx.getRoleAllAction(currentrole.id, owner)); } else { List <role> rolelist = IdalCommon.IroleEx.getUserRoles(username); if (rolelist.Count > 0) { foreach (var e in rolelist) { rr.AddRange(_roleActionEx.getRoleAllAction(e.id, owner)); } } } rr = rr.Where((x, i) => rr.FindIndex(z => z.id == x.id) == i).ToList();//Lambda表达式去重 return(rr); }
public static List <action> getUserAllAction(string username, string owner = "")//获取指定用户的特定类型和属主的动作列表,会含有重复项 { List <action> rr = new List <action>(); List <role> rolelist = IocModule.GetEntity <IroleEx>().getUserRoles(username); if (rolelist.Count > 0) { IroleActionEx _roleActionEx = IocModule.GetEntity <IroleActionEx>(); foreach (var e in rolelist) { rr.AddRange(_roleActionEx.getRoleAllAction(e.id, owner)); } rr = rr.Where((x, i) => rr.FindIndex(z => z.id == x.id) == i).ToList();//Lambda表达式去重 } return(rr); }