Пример #1
0
        public static void GetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            MobileMailboxPolicy mobileMailboxPolicy = store.GetDataObject("MobileMailboxPolicy") as MobileMailboxPolicy;

            if (dataTable.Rows.Count == 1 && mobileMailboxPolicy != null)
            {
                DataRow dataRow = dataTable.Rows[0];
                dataRow["IsMinPasswordLengthSet"]         = (mobileMailboxPolicy.PasswordEnabled && mobileMailboxPolicy.MinPasswordLength != null);
                dataRow["MinPasswordLength"]              = ((mobileMailboxPolicy.MinPasswordLength != null) ? ((int)dataRow["MinPasswordLength"]) : 4);
                dataRow["IsMaxPasswordFailedAttemptsSet"] = (mobileMailboxPolicy.PasswordEnabled && !mobileMailboxPolicy.MaxPasswordFailedAttempts.IsUnlimited);
                dataRow["MaxPasswordFailedAttempts"]      = (mobileMailboxPolicy.MaxPasswordFailedAttempts.IsUnlimited ? "8" : mobileMailboxPolicy.MaxPasswordFailedAttempts.Value.ToString(CultureInfo.InvariantCulture));
                dataRow["IsMaxInactivityTimeLockSet"]     = (mobileMailboxPolicy.PasswordEnabled && !mobileMailboxPolicy.MaxInactivityTimeLock.IsUnlimited);
                dataRow["MaxInactivityTimeLock"]          = (mobileMailboxPolicy.MaxInactivityTimeLock.IsUnlimited ? "15" : mobileMailboxPolicy.MaxInactivityTimeLock.Value.TotalMinutes.ToString(CultureInfo.InvariantCulture));
                dataRow["IsPasswordExpirationSet"]        = (mobileMailboxPolicy.PasswordEnabled && !mobileMailboxPolicy.PasswordExpiration.IsUnlimited);
                dataRow["PasswordExpiration"]             = (mobileMailboxPolicy.PasswordExpiration.IsUnlimited ? "90" : mobileMailboxPolicy.PasswordExpiration.Value.Days.ToString());
                dataRow["PasswordRequirementsString"]     = MobileDeviceMailboxPolicyService.PasswordRequirementsString(dataRow);
                dataRow["HasAdditionalCustomSettings"]    = MobileDeviceMailboxPolicyService.HasAdditionalCustomSettings(mobileMailboxPolicy);
            }
        }
Пример #2
0
        public static void GetDefaultPolicyPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            dataTable.BeginLoadData();
            List <DataRow> list = new List <DataRow>();

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                DataRow dataRow = dataTable.Rows[i];
                if (false.Equals(dataRow["IsDefault"]))
                {
                    list.Add(dataRow);
                }
                else
                {
                    MobileDeviceMailboxPolicyService.UpdateDefaultPolicy(dataRow);
                }
            }
            foreach (DataRow row in list)
            {
                dataTable.Rows.Remove(row);
            }
            dataTable.EndLoadData();
        }
Пример #3
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            List <string> list = new List <string>();

            if (DBNull.Value.Equals(inputRow["MinPasswordComplexCharacters"]))
            {
                inputRow["MinPasswordComplexCharacters"] = "3";
                list.Add("MinPasswordComplexCharacters");
            }
            if (DBNull.Value != inputRow["MaxPasswordFailedAttempts"] || DBNull.Value != inputRow["IsMaxPasswordFailedAttemptsSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsMaxPasswordFailedAttemptsSet"]) || (bool)inputRow["IsMaxPasswordFailedAttemptsSet"];
                string value      = (DBNull.Value != inputRow["MaxPasswordFailedAttempts"]) ? ((string)inputRow["MaxPasswordFailedAttempts"]) : "8";
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <int>(true, isValueSet, value, (string x) => int.Parse(x), out value2))
                {
                    inputRow["MaxPasswordFailedAttempts"] = value2;
                    list.Add("MaxPasswordFailedAttempts");
                    list.Add("IsMaxPasswordFailedAttemptsSet");
                }
            }
            if (DBNull.Value != inputRow["PasswordExpiration"] || DBNull.Value != inputRow["IsPasswordExpirationSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsPasswordExpirationSet"]) || (bool)inputRow["IsPasswordExpirationSet"];
                string value      = (DBNull.Value != inputRow["PasswordExpiration"]) ? ((string)inputRow["PasswordExpiration"]) : "90";
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <EnhancedTimeSpan>(true, isValueSet, value, (string x) => EnhancedTimeSpan.FromDays(double.Parse(x)), out value2))
                {
                    inputRow["PasswordExpiration"] = value2;
                    list.Add("PasswordExpiration");
                    list.Add("IsPasswordExpirationSet");
                }
            }
            if (DBNull.Value != inputRow["MaxInactivityTimeLock"] || DBNull.Value != inputRow["IsMaxInactivityTimeLockSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsMaxInactivityTimeLockSet"]) || (bool)inputRow["IsMaxInactivityTimeLockSet"];
                string value      = (DBNull.Value != inputRow["MaxInactivityTimeLock"]) ? ((string)inputRow["MaxInactivityTimeLock"]) : "15";
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <EnhancedTimeSpan>(true, isValueSet, value, (string x) => EnhancedTimeSpan.FromMinutes(double.Parse(x)), out value2))
                {
                    inputRow["MaxInactivityTimeLock"] = value2;
                    list.Add("MaxInactivityTimeLock");
                    list.Add("IsMaxInactivityTimeLockSet");
                }
            }
            if (DBNull.Value != inputRow["MinPasswordLength"] || DBNull.Value != inputRow["IsMinPasswordLengthSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsMinPasswordLengthSet"]) || (bool)inputRow["IsMinPasswordLengthSet"];
                string value      = (DBNull.Value != inputRow["MinPasswordLength"]) ? ((string)inputRow["MinPasswordLength"]) : 4.ToString();
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <int>(false, isValueSet, value, (string x) => int.Parse(x), out value2))
                {
                    inputRow["MinPasswordLength"] = value2;
                    list.Add("MinPasswordLength");
                    list.Add("IsMinPasswordLengthSet");
                }
            }
            if (list.Count > 0)
            {
                store.SetModifiedColumns(list);
            }
        }