protected override void InternalValidate() { base.InternalValidate(); IList <RoleAssignmentPolicy> policies = RoleAssignmentPolicyHelper.GetPolicies((IConfigurationSession)base.DataSession, null); this.CheckFirstPolicyIsDefault(policies); this.CheckForExistingDefaultPolicies(policies); this.CheckForAdminRoles(); }
protected override void InternalValidate() { base.InternalValidate(); if (base.DataObject.IsDefault) { base.WriteError(new InvalidOperationException(Strings.RemovingDefaultPolicyIsNotSupported(this.Identity.ToString())), ErrorCategory.WriteError, base.DataObject); } if (RoleAssignmentPolicyHelper.RoleAssignmentsForPolicyExist((IConfigurationSession)base.DataSession, base.DataObject)) { base.WriteError(new InvalidOperationException(Strings.ErrorRemovingPolicyInUse(base.DataObject.Id.ToString())), ErrorCategory.WriteError, base.DataObject); } }
public static IList <RoleAssignmentPolicy> GetDefaultPolicies(IConfigurationSession session, QueryFilter extraFilter) { QueryFilter queryFilter = RoleAssignmentPolicyHelper.filter; if (extraFilter != null) { queryFilter = new AndFilter(new QueryFilter[] { extraFilter, RoleAssignmentPolicyHelper.filter }); } return(RoleAssignmentPolicyHelper.GetPolicies(session, queryFilter)); }
protected override void InternalValidate() { base.InternalValidate(); if (this.IsDefault) { this.DataObject.IsDefault = true; QueryFilter extraFilter = new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Guid, this.DataObject.Id.ObjectGuid); this.otherDefaultPolicies = RoleAssignmentPolicyHelper.GetDefaultPolicies((IConfigurationSession)base.DataSession, extraFilter); } else if (!this.IsDefault && base.Fields.IsChanged("IsDefault") && this.DataObject.IsDefault) { base.WriteError(new InvalidOperationException(Strings.ResettingIsDefaultIsNotSupported("IsDefault", "RoleAssignmentPolicy")), ErrorCategory.WriteError, this.DataObject); } if (base.Fields.IsChanged("Description")) { this.DataObject.Description = this.Description; } }
protected override void InternalProcessRecord() { if (this.UpdateOtherDefaultPolicies && !base.ShouldContinue(Strings.ConfirmationMessageSwitchMailboxPolicy("RoleAssignmentPolicy", this.Identity.ToString()))) { return; } base.InternalProcessRecord(); if (this.UpdateOtherDefaultPolicies) { try { RoleAssignmentPolicyHelper.ClearIsDefaultOnPolicies((IConfigurationSession)base.DataSession, this.otherDefaultPolicies); } catch (DataSourceTransientException exception) { base.WriteError(exception, ErrorCategory.ReadError, null); } } }