コード例 #1
0
        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");
            }
        }
コード例 #2
0
ファイル: LcpsAdsUser.cs プロジェクト: LCPS/LCPS-NwUsers
 public bool IsMemberOf(LcpsAdsGroup g)
 {
     foreach (string gdn in DirectoryEntry.Properties["memberOf"])
     {
         if (gdn.ToLower() == g.DistinguishedName.ToLower())
             return true;
     }
     return false;
 }
コード例 #3
0
ファイル: LcpsAdsUser.cs プロジェクト: LCPS/LCPS-NwUsers
        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();
        }