public List <Group> AllGroups(PLMPackEntities db) { List <Group> grps = new List <Group>(Groups); grps.Add(Group.Everyone(db)); return(grps); }
private void InitializeUser(PLMPackEntities db) { if (string.IsNullOrEmpty(GroupId)) { string userName = UserName; // create group using user name Group grp = Group.CreateNew(db , string.Format("{0}_grp", userName) // group name , string.Format("Default group of user {0}", userName) // group description , this // owner ); // set as current group this.GroupId = grp.Id; db.SaveChanges(); // add group of interest treeDiM Group grp_treeDiM = Group.GetByName(db, "treeDiM"); if (null != grp_treeDiM) { AddGroupOfInterest(db, grp_treeDiM); } // share user root node TreeNode tn = TreeNode.GetUserRootNode(db, this); tn.Share(db, this, Group.Everyone(db)); if (null != grp_treeDiM) { // copy cardboard formats from treeDiM group CardboardFormat[] cardboardFormats = CardboardFormat.GetAll(db, grp_treeDiM); foreach (CardboardFormat cf in cardboardFormats) { CardboardFormat.CreateNew(db, grp, cf.Name, cf.Description, cf.Length, cf.Width); } // copy cardboard profile from treeDiM group CardboardProfile[] cardboardProfiles = CardboardProfile.GetAll(db, grp_treeDiM); foreach (CardboardProfile cp in cardboardProfiles) { CardboardProfile.CreateNew(db, grp, cp.Name, cp.Description, cp.Code, cp.Thickness); } } } }
public void Share(PLMPackEntities db, AspNetUser user) { Share(db, user, Group.Everyone(db)); }