private void Lister(ref Core.TreeNodeToArrary <string>[] list, RightRuler ruler, bool searchAllChildren) { foreach (RightRuler r in ruler.Nodes) { Array.Resize <Core.TreeNodeToArrary <string> >(ref list, list.Length + 1); list[list.Length - 1] = new TreeNodeToArrary <string>(); list[list.Length - 1].ID = r.ID; list[list.Length - 1].Parent = ruler.ID; if (searchAllChildren && r.Nodes.Count > 0) { Lister(ref list, r, searchAllChildren); } } }
public void ToRightRuler(RightRuler ruler) { ruler.ID = this.ID; ruler.Name = this.Name; ruler.Description = this.Description; ruler.Nodes.Clear(); if (this.Nodes.Count > 0) { foreach (Right r in this.Nodes) { ruler.Nodes.Add(r.ID, new RightRuler()); RightRuler ru = ruler.Nodes[r.ID]; r.ToRightRuler(ru); } } }
private void GetRightIDByAllow(RightRuler ruler, StringBuilder sb, string split) { foreach (RightRuler r in ruler.Nodes) { if (r.Nodes.Count > 0) { GetRightIDByAllow(r, sb, split); } else { if (r.RightState == RightState.完全) { sb.Append(r.ID); sb.Append(split); } } } }
private void SetRuler(RightRuler ruler, RightState state, bool includeAllChilren) { ruler.RightState = state; if (includeAllChilren) { foreach (RightRuler r in ruler.Nodes) { if (r.Nodes.Count > 0) { SetRuler(r, state, includeAllChilren); } else { r.RightState = state; } } } }
private RightRuler FindRight(string rightID, RightRuler right) { if (right.ID == rightID) { return(right); } else if (right.Nodes.ContainsKey(rightID)) { return(right.Nodes[rightID]); } else { foreach (RightRuler rightChild in right.Nodes) { if (rightID.IndexOf(rightChild.ID) == 0) { return(FindRight(rightID, rightChild)); } } return(default(RightRuler)); } }
private UserAndRight.RightState GetRightState(string rightID, RightRuler ruler) { if (ruler.ID == rightID) { return(ruler.RightState); } else if (ruler.Nodes.ContainsKey(rightID)) { return(ruler.Nodes[rightID].RightState); } else { foreach (RightRuler rulerChild in ruler.Nodes) { if (rightID.IndexOf(rulerChild.ID) == 0) { return(GetRightState(rightID, rulerChild)); } } return(UserAndRight.RightState.禁止); } }
public User() { _rightRuler = new RightRuler(); }