protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); if (this.User != null) { this.securityPrincipal = SecurityPrincipalIdParameter.GetSecurityPrincipal(base.TenantGlobalCatalogSession, this.User, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); this.trustee = (ADRecipient)SecurityPrincipalIdParameter.GetSecurityPrincipal((IRecipientSession)base.DataSession, this.Trustee, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); List <ActiveDirectoryAccessRule> list = new List <ActiveDirectoryAccessRule>(); foreach (RecipientAccessRight right in this.AccessRights) { list.Add(new ActiveDirectoryAccessRule(((IADSecurityPrincipal)this.trustee).Sid, ActiveDirectoryRights.ExtendedRight, AccessControlType.Allow, RecipientPermissionHelper.GetRecipientAccessRightGuid(right), this.GetInheritanceType(), Guid.Empty)); } this.ApplyModification(list.ToArray()); TaskLogger.LogExit(); }
internal static string GetFriendlyNameOfSecurityIdentifier(SecurityIdentifier sid, IRecipientSession session, Task.TaskErrorLoggingDelegate errorLogger, Task.TaskVerboseLoggingDelegate verboseLogger) { if (!RecipientPermissionTaskHelper.sidToName.ContainsKey(sid)) { ADRecipient adrecipient = (ADRecipient)SecurityPrincipalIdParameter.GetSecurityPrincipal(session, new SecurityPrincipalIdParameter(sid), errorLogger, verboseLogger); if (adrecipient != null) { if (adrecipient.Id != null) { RecipientPermissionTaskHelper.sidToName[sid] = adrecipient.Id.ToString(); } else { RecipientPermissionTaskHelper.sidToName[sid] = SecurityPrincipalIdParameter.GetFriendlyUserName(sid, verboseLogger); } } } return(RecipientPermissionTaskHelper.sidToName[sid]); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (!base.CurrentTaskContext.CanBypassRBACScope) { base.VerifyIsWithinScopes((IRecipientSession)base.DataSession, this.DataObject, true, new DataAccessTask <ADUser> .ADObjectOutOfScopeString(Strings.ErrorCannotChangeMailboxOutOfWriteScope)); } if (this.IsInherited) { this.WriteWarning(Strings.ErrorWillNotPerformOnInheritedAccessRight(this.Instance.Identity.ToString())); return; } if (base.ParameterSetName == "Owner") { return; } if (this.Instance.User != null) { this.securityPrincipal = SecurityPrincipalIdParameter.GetSecurityPrincipal(base.TenantGlobalCatalogSession, this.Instance.User, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } if (this.IsInherited) { return; } if (base.ParameterSetName == "Instance") { if (this.Instance.User == null) { base.WriteError(new ArgumentException(Strings.ErrorUserNull, "User"), ErrorCategory.InvalidArgument, null); } if (this.Instance.AccessRights == null || this.Instance.AccessRights.Length == 0) { base.WriteError(new ArgumentException(Strings.ErrorAccessRightsEmpty, "AccessRights"), ErrorCategory.InvalidArgument, null); } } TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (this.IsInherited) { TPublicObject instance = this.Instance; this.WriteWarning(Strings.ErrorWillNotPerformOnInheritedAccessRight(instance.Identity.ToString())); return; } if (base.ParameterSetName == "Owner") { return; } TPublicObject instance2 = this.Instance; if (instance2.User != null) { IRecipientSession session = this.GlobalCatalogRecipientSession; TPublicObject instance3 = this.Instance; this.securityPrincipal = SecurityPrincipalIdParameter.GetSecurityPrincipal(session, instance3.User, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } TaskLogger.LogExit(); }