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