예제 #1
0
 protected override bool UpdateAssociation(MailboxAssociation association)
 {
     if (this.shouldEscalate == association.ShouldEscalate)
     {
         UpdateAssociationCommand.Tracer.TraceDebug <UserMailboxLocator, bool>((long)this.GetHashCode(), "User {0} escalate state is already same {1}", association.User, this.shouldEscalate);
         return(false);
     }
     if (this.shouldEscalate && !association.IsMember)
     {
         UpdateAssociationCommand.Tracer.TraceError <UserMailboxLocator, IMailboxLocator>((long)this.GetHashCode(), "Only Members can Subscribe to group, throwing NotAMemberException. User={0}, Group={1}", association.User, base.MasterAdaptor.MasterLocator);
         throw new NotAMemberException(Strings.CannotEscalateForNonMember);
     }
     if (this.shouldEscalate && GetEscalatedAssociations.GetEscalatedAssociationsCount(base.MasterAdaptor) >= this.maxEscalatedMembers)
     {
         throw new ExceededMaxSubscribersException(Strings.MaxSubscriptionsForGroupReached);
     }
     association.UserSmtpAddress = this.userSmtpAddress;
     association.ShouldEscalate  = this.shouldEscalate;
     return(true);
 }
예제 #2
0
 protected override void OnPostExecute()
 {
     if (this.groupAdUser.AutoSubscribeNewGroupMembers && GetEscalatedAssociations.GetEscalatedAssociationsCount(base.MasterAdaptor) > 100)
     {
         LocalizedException ex = null;
         try
         {
             this.groupAdUser.AutoSubscribeNewGroupMembers = false;
             this.adSession.Save(this.groupAdUser);
         }
         catch (ADTransientException ex2)
         {
             ex = ex2;
         }
         catch (ADExternalException ex3)
         {
             ex = ex3;
         }
         catch (ADOperationException ex4)
         {
             ex = ex4;
         }
         finally
         {
             if (ex != null)
             {
                 this.Logger.LogEvent(new SchemaBasedLogEvent <MailboxAssociationLogSchema.Error>
                 {
                     {
                         MailboxAssociationLogSchema.Error.Context,
                         "SetUserMembershipState: failed to save ADUserObject after unsetting auto-subscribe bit."
                     },
                     {
                         MailboxAssociationLogSchema.Error.Exception,
                         ex
                     }
                 });
             }
         }
     }
 }