コード例 #1
0
        private async Task CreateSubBranches()
        {
            if (group == null)
            {
                return;
            }
            foreach (var perm in group.PermissionsEnumerable())
            {
                TreeBranch branch;
                if (perm.IsGroup)
                {
                    //WE are a group, so get our subgroup
                    var g2 = await group.Engine.GetGroupAsync(perm);

                    if (g2 == null)
                    {
                        //We dont have a group, create a regular branch
                        branch = new TreeBranch(this, perm);
                    }
                    else
                    {
                        //We have a subgrou
                        branch = new TreeBranch(this, perm, g2);
                        await branch.CreateSubBranches();
                    }
                }
                else
                {
                    branch = new TreeBranch(this, perm);
                }

                children.Add(branch);
            }
        }
コード例 #2
0
        public static async Task <TreeBranch> CreateTreeAsync(Group entry)
        {
            TreeBranch tree = new TreeBranch(entry);
            await tree.CreateSubBranches();

            return(tree);
        }
コード例 #3
0
 private TreeBranch(TreeBranch parent, Permission perm, Group group)
 {
     this.parent     = parent;
     this.group      = group;
     this.permission = perm;
 }
コード例 #4
0
 private TreeBranch(Group group)
 {
     this.parent     = null;
     this.group      = group;
     this.permission = Permission.FromGroup(group, StateType.Unset);
 }
コード例 #5
0
 private TreeBranch(TreeBranch parent, Permission perm)
 {
     this.parent     = parent;
     this.permission = perm;
     this.group      = null;
 }
コード例 #6
0
 public TreeBranch()
 {
     parent = null;
 }