public ActionResult CreateGroupTemplate(Guid id)
        {
            try
            {
                LcpsAdsGroup ou = new LcpsAdsGroup(id);
                GroupTemplate t = new GroupTemplate();
                t.GroupId = id;
                t.TemplateName = ou.Name;

                if (string.IsNullOrEmpty(ou.Description))
                    t.Description = "No aescription available";
                else
                    t.Description = ou.Description;

                DbContext.GroupTemplates.Add(t);
                DbContext.SaveChanges();

                return Content("Success", "text/html");
            }
            catch (Exception ex)
            {
                AnvilExceptionCollector ec = new AnvilExceptionCollector(ex);
                return Content(ec.ToUL(), "text/html");
            }
        }
Exemplo n.º 2
0
 public bool IsMemberOf(LcpsAdsGroup g)
 {
     foreach (string gdn in DirectoryEntry.Properties["memberOf"])
     {
         if (gdn.ToLower() == g.DistinguishedName.ToLower())
             return true;
     }
     return false;
 }
Exemplo n.º 3
0
        public LcpsAdsGroup[] GetGroupMembership()
        {
            List<LcpsAdsGroup> l = new List<LcpsAdsGroup>();
            var groups = this.DirectoryEntry.Properties["memberOf"].Value;
            if (groups == null)
                return l.ToArray();

            if (groups.GetType() == typeof(string))
            {
                string p = "LDAP://" + DefaultApp.LDAPDomainFQN + "/" + (string)groups;
                LcpsAdsGroup g = new LcpsAdsGroup(p);
                l.Add(g);
            }
            else
            {
                ICollection gc = groups as ICollection;
                foreach (string g in gc)
                {
                    string p = "LDAP://" + DefaultApp.LDAPDomainFQN + "/" + g;
                    LcpsAdsGroup grp = new LcpsAdsGroup(p);
                    l.Add(grp);
                }

            }
            return l.ToArray();
        }