protected override void InternalProcessRecord() { int priority = 0; bool flag = false; int clientAccessRulesLimit = AppSettings.Current.ClientAccessRulesLimit; ClientAccessRulesPriorityManager clientAccessRulesPriorityManager = new ClientAccessRulesPriorityManager(ClientAccessRulesStorageManager.GetClientAccessRules((IConfigurationSession)base.DataSession)); if (clientAccessRulesPriorityManager.ADClientAccessRules.Count >= clientAccessRulesLimit) { base.WriteError(new InvalidOperationException(RulesTasksStrings.ClientAccessRulesLimitError(clientAccessRulesLimit)), ErrorCategory.InvalidOperation, null); } if (!ClientAccessRulesStorageManager.IsADRuleValid(this.DataObject)) { base.WriteError(new InvalidOperationException(RulesTasksStrings.ClientAccessRulesAuthenticationTypeInvalid), ErrorCategory.InvalidOperation, null); } this.DataObject.InternalPriority = clientAccessRulesPriorityManager.GetInternalPriority(this.Priority, this.DatacenterAdminsOnly, out priority, out flag); this.DataObject.RuleName = this.DataObject.Name; this.DataObject.Priority = priority; if (flag) { ClientAccessRulesStorageManager.SaveRules((IConfigurationSession)base.DataSession, clientAccessRulesPriorityManager.ADClientAccessRules); } base.CreateParentContainerIfNeeded(this.DataObject); base.InternalProcessRecord(); }
protected override void InternalProcessRecord() { if (!ClientAccessRulesStorageManager.IsADRuleValid(this.DataObject)) { base.WriteError(new InvalidOperationException(RulesTasksStrings.ClientAccessRulesAuthenticationTypeInvalid), ErrorCategory.InvalidOperation, null); } if (this.DataObject.IsModified(ADObjectSchema.Name) || this.DataObject.IsModified(ADClientAccessRuleSchema.Priority)) { List <ADClientAccessRule> list = new List <ADClientAccessRule>(ClientAccessRulesStorageManager.GetClientAccessRules((IConfigurationSession)base.DataSession)); if (this.DataObject.IsModified(ADObjectSchema.Name)) { foreach (ADClientAccessRule adclientAccessRule in list) { if (!adclientAccessRule.Identity.Equals(this.DataObject.Identity) && adclientAccessRule.Name.Equals(this.DataObject.Name)) { base.WriteError(new InvalidOperationException(RulesTasksStrings.ClientAccessRulesNameAlreadyInUse), ErrorCategory.InvalidOperation, null); } } } if (this.DataObject.IsModified(ADClientAccessRuleSchema.Priority)) { bool flag = false; ClientAccessRulesPriorityManager clientAccessRulesPriorityManager = new ClientAccessRulesPriorityManager(list); this.DataObject.InternalPriority = clientAccessRulesPriorityManager.GetInternalPriority(this.DataObject.Priority, this.DataObject, out flag); if (flag) { ClientAccessRulesStorageManager.SaveRules((IConfigurationSession)base.DataSession, clientAccessRulesPriorityManager.ADClientAccessRules); } } } base.InternalProcessRecord(); }