Beispiel #1
0
        // Public
        #region CreateUpdate()
        public static int CreateUpdate(int FieldId
                                       , int LdapId
                                       , bool BitField
                                       , string IbnName
                                       , string LdapName
                                       , int BitMask
                                       , bool Equal
                                       , int CompareTo
                                       )
        {
            Ldap.CheckAccess();

            return(DbLdap.FieldCreateUpdate(FieldId
                                            , LdapId
                                            , BitField
                                            , IbnName
                                            , LdapName
                                            , BitMask
                                            , Equal
                                            , CompareTo
                                            ));
        }
Beispiel #2
0
        public static int CreateUpdate(int LdapId
                                       , string Title
                                       , string Domain
                                       , string Username
                                       , string Password
                                       , string Filter
                                       , string IbnKey
                                       , string LdapKey
                                       , bool Activate
                                       , bool Deactivate
                                       , bool Autosync
                                       , DateTime AutosyncStart
                                       , int AutosyncInterval
                                       )
        {
            Ldap.CheckAccess();

            using (DbTransaction tran = DbTransaction.Begin())
            {
                bool create = LdapId < 0;

                LdapId = DbLdap.SettingsCreateUpdate(LdapId
                                                     , Title
                                                     , Domain
                                                     , Username
                                                     , Password
                                                     , Filter
                                                     , IbnKey
                                                     , LdapKey
                                                     , Activate
                                                     , Deactivate
                                                     , Autosync
                                                     , AutosyncStart
                                                     , AutosyncInterval
                                                     );

                if (create)
                {
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Login.ToString(), UserInfo.AdProperty.SamAccountName.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.FirstName.ToString(), UserInfo.AdProperty.GivenName.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.LastName.ToString(), UserInfo.AdProperty.Sn.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Email.ToString(), UserInfo.AdProperty.Mail.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.LdapUid.ToString(), UserInfo.AdProperty.ObjectSid.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.WindowsLogin.ToString(), UserInfo.AdProperty.SamAccountName.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Phone.ToString(), UserInfo.AdProperty.TelephoneNumber.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Mobile.ToString(), UserInfo.AdProperty.Mobile.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Fax.ToString(), UserInfo.AdProperty.FacsimileTelephoneNumber.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Location.ToString(), UserInfo.AdProperty.L.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Company.ToString(), UserInfo.AdProperty.Company.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.Department.ToString(), UserInfo.AdProperty.Department.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, false, UserInfo.IbnProperty.JobTitle.ToString(), UserInfo.AdProperty.Title.ToString(), 0, false, 0);
                    DbLdap.FieldCreateUpdate(-1, LdapId, true, UserInfo.IbnProperty.IsActive.ToString(), UserInfo.AdProperty.UserAccountControl.ToString(), 2, true, 0);
                }

                Ldap.UpdateNextSyncTime(LdapId);

                tran.Commit();
            }

            return(LdapId);
        }