コード例 #1
0
 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);
         }
     }
 }
コード例 #2
0
 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);
         }
     }
 }
コード例 #3
0
 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);
             }
         }
     }
 }
コード例 #4
0
 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;
             }
         }
     }
 }
コード例 #5
0
 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));
     }
 }
コード例 #6
0
 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.禁止);
     }
 }
コード例 #7
0
 public User()
 {
     _rightRuler = new RightRuler();
 }