Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public static async Task <TreeBranch> CreateTreeAsync(Group entry)
        {
            TreeBranch tree = new TreeBranch(entry);
            await tree.CreateSubBranches();

            return(tree);
        }
Exemplo n.º 3
0
 private TreeBranch(TreeBranch parent, Permission perm, Group group)
 {
     this.parent     = parent;
     this.group      = group;
     this.permission = perm;
 }
Exemplo n.º 4
0
 private TreeBranch(Group group)
 {
     this.parent     = null;
     this.group      = group;
     this.permission = Permission.FromGroup(group, StateType.Unset);
 }
Exemplo n.º 5
0
 private TreeBranch(TreeBranch parent, Permission perm)
 {
     this.parent     = parent;
     this.permission = perm;
     this.group      = null;
 }
Exemplo n.º 6
0
 public TreeBranch()
 {
     parent = null;
 }