Esempio n. 1
0
        private Org SyncOrgFromEntry(LdapEntry rootEntry, Org parentOrg, LdapEntry entry)
        {
            string orgId = entry.Guid().ToLower();
            Org    org   = this._org.GetOrgById(orgId) as Org;

            if (org != null)
            {
                if (entry.ContainsAttr("ou"))
                {
                    org.Name = entry.getAttribute("ou").StringValue + string.Empty;
                }
                //设置其他属性的值
                _org.UpdateOrg(org);
                return(org);
            }
            org = new Org
            {
                Id       = orgId,
                ParentId = parentOrg.Id,
            };

            //设置其他属性的值
            this._org.AddOrg(org);
            return(org);
        }
Esempio n. 2
0
        private User SyncUserFromEntry(LdapEntry rootEntry, Org parentOrg, LdapEntry entry)
        {
            string userId = entry.Guid().ToLower();
            User   user   = this._user.GetUserById(userId);

            if (user != null)
            {
                user.ParentId = parentOrg.Id;
                //设置其他属性的值
                this._user.UpdateUser(user);

                return(user);
            }
            user = new User
            {
                Id       = userId,
                ParentId = parentOrg.Id
            };
            //设置其他属性的值
            this._user.AddUser(user);
            return(user);
        }