private static string ReadGroup(XmlNode node) { if (node.Name == "Group") { string nombre = NodeGetString(node, "nombre"); Group g = new Group (nombre); g.Save(); g.Roles = NodeGetObjectSet(node, "Role", roles); g.Save(); /* Group x = Group.Find(g.Id); foreach (Role r in g.Roles) System.Console.WriteLine ("Grupo ROL: "+ r.Name); System.Console.WriteLine ("Grupo: "+ nombre); g.Save();*/ groups[nombre] = g; } return null; }
public void GroupCreate (string groupName) { Commons.CheckSuperUser(Session); Group group = new Group(groupName); string rolesString = (string) Request.Form["Roles[]"]; if (rolesString != null) { string[] roles = rolesString.Split(','); if (roles != null) { group.Roles = new HashedSet(); foreach (string i in roles) { Role role = Role.Find(int.Parse(i)); if (role != null) { group.Roles.Add(role); } } } } group.Save(); Role[] rols = Role.FindAll(); foreach (Role r in rols) { bool isDefaultRole = false; if (group.Roles != null) { foreach(Role rol in group.Roles) { if (rol.Id == r.Id) { isDefaultRole = true; } } } if ((isDefaultRole) && (Request.Form["updateAcls"] != null)) { Acl acl = new Acl(); acl.Group = group; acl.Role = r; acl.Containers = new Iesi.Collections.HashedSet(); //ArrayList(); acl.Save(); Category[] categories = Category.FindAll(); foreach(Category category in categories) { category.AclSet.Add(acl); category.Save(); #if CACHE acl.Containers.Add(category); #endif } } //acl.Save(); } RedirectToAction ("groupsedit"); }