예제 #1
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            bool flag = false;

            if (base.Fields.IsModified(ADGroupSchema.Members))
            {
                if (this.DataObject.RoleGroupType == RoleGroupType.Linked)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorLinkedRoleGroupCannotHaveMembers), (ErrorCategory)1000, null);
                }
                List <ADObjectId> list = null;
                SecurityPrincipalIdParameter[] parameters    = this.GetChangedValues(true);
                SecurityPrincipalIdParameter[] changedValues = this.GetChangedValues(false);
                if (this.Members == null || !this.Members.IsChangesOnlyCopy)
                {
                    flag = true;
                    if (this.Members != null)
                    {
                        parameters = this.Members.ToArray();
                    }
                    list = this.DataObject.Members.ToList <ADObjectId>();
                    this.DataObject.Members = new MultiValuedProperty <ADObjectId>();
                }
                SyncTaskHelper.ResolveModifiedMultiReferenceParameter <SecurityPrincipalIdParameter>("Members", "AddedMembers", parameters, new GetRecipientDelegate <SecurityPrincipalIdParameter>(this.GetRecipient), this.ReferenceErrorReporter, this.recipientIdsDictionary, this.recipientsDictionary, this.parameterDictionary);
                SyncTaskHelper.ValidateModifiedMultiReferenceParameter <ADGroup>("Members", "AddedMembers", this.DataObject, new ValidateRecipientWithBaseObjectDelegate <ADGroup>(MailboxTaskHelper.ValidateGroupMember), this.ReferenceErrorReporter, this.recipientsDictionary, this.parameterDictionary);
                SyncTaskHelper.AddModifiedRecipientIds("AddedMembers", SyncDistributionGroupSchema.Members, this.DataObject, this.recipientIdsDictionary);
                if (flag)
                {
                    MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();
                    foreach (ADObjectId item in list)
                    {
                        if (!this.DataObject.Members.Contains(item))
                        {
                            multiValuedProperty.Add(item);
                        }
                    }
                    this.recipientIdsDictionary["RemovedMembers"] = multiValuedProperty;
                }
                else
                {
                    SyncTaskHelper.ResolveModifiedMultiReferenceParameter <SecurityPrincipalIdParameter>("Members", "RemovedMembers", changedValues, new GetRecipientDelegate <SecurityPrincipalIdParameter>(this.GetRecipient), this.ReferenceErrorReporter, this.recipientIdsDictionary, this.recipientsDictionary, this.parameterDictionary);
                    SyncTaskHelper.RemoveModifiedRecipientIds("RemovedMembers", SyncDistributionGroupSchema.Members, this.DataObject, this.recipientIdsDictionary);
                }
            }
            MailboxTaskHelper.ValidateAddedMembers(base.TenantGlobalCatalogSession, this.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>));
            if (this.recipientIdsDictionary.ContainsKey("RemovedMembers") && this.recipientIdsDictionary["RemovedMembers"].Count > 0)
            {
                RoleAssignmentsGlobalConstraints roleAssignmentsGlobalConstraints = new RoleAssignmentsGlobalConstraints(this.ConfigurationSession, base.TenantGlobalCatalogSession, new Task.ErrorLoggerDelegate(base.WriteError));
                roleAssignmentsGlobalConstraints.ValidateIsSafeToRemoveRoleGroupMember(this.DataObject, new List <ADObjectId>(this.recipientIdsDictionary["RemovedMembers"]));
            }
            TaskLogger.LogExit();
        }
예제 #2
0
 private void UpdateMembersWhenRawMembersChanged()
 {
     if (this.addedValues.Length > 0)
     {
         SyncTaskHelper.ResolveModifiedMultiReferenceParameter <RecipientWithAdUserGroupIdParameter <RecipientIdParameter> >("RawMembers", "AddedMembers", this.addedValues, new GetRecipientDelegate <RecipientWithAdUserGroupIdParameter <RecipientIdParameter> >(this.GetRecipient), this.ReferenceErrorReporter, this.recipientIdsDictionary, this.recipientsDictionary, this.parameterDictionary);
         SyncTaskHelper.ValidateModifiedMultiReferenceParameter <ADGroup>("RawMembers", "AddedMembers", this.DataObject, SyncTaskHelper.ValidateWithBaseObjectBypassADUser <ADGroup>(new ValidateRecipientWithBaseObjectDelegate <ADGroup>(MailboxTaskHelper.ValidateGroupMember)), this.ReferenceErrorReporter, this.recipientsDictionary, this.parameterDictionary);
         SyncTaskHelper.AddModifiedRecipientIds("AddedMembers", SyncDistributionGroupSchema.Members, this.DataObject, this.recipientIdsDictionary, new Func <ADGroup, ADObjectId, IConfigDataProvider, bool>(MailboxTaskHelper.GroupContainsMember), base.TenantGlobalCatalogSession);
     }
     if (this.removedValues.Length > 0)
     {
         SyncTaskHelper.ResolveModifiedMultiReferenceParameter <RecipientWithAdUserGroupIdParameter <RecipientIdParameter> >("RawMembers", "RemovedMembers", this.removedValues, new GetRecipientDelegate <RecipientWithAdUserGroupIdParameter <RecipientIdParameter> >(this.GetRecipient), this.ReferenceErrorReporter, this.recipientIdsDictionary, this.recipientsDictionary, this.parameterDictionary);
         SyncTaskHelper.RemoveModifiedRecipientIds("RemovedMembers", SyncDistributionGroupSchema.Members, this.DataObject, this.recipientIdsDictionary, new Func <ADGroup, ADObjectId, IConfigDataProvider, bool>(MailboxTaskHelper.GroupContainsMember), base.TenantGlobalCatalogSession);
     }
 }