protected void PopulateDistributionStatus(PsCompliancePolicyBase psPolicy, PolicyStorage policyStorage)
 {
     if (ExPolicyConfigProvider.IsFFOOnline)
     {
         PolicySettingStatusHelpers.PopulatePolicyDistributionStatus(psPolicy, policyStorage, base.DataSession, this, this.executionLogger);
     }
 }
 protected override void WriteResult(IConfigurable dataObject)
 {
     if (base.NeedSuppressingPiiData && dataObject is PsCompliancePolicyBase)
     {
         base.ExchangeRunspaceConfig.EnablePiiMap = true;
         PsCompliancePolicyBase psCompliancePolicyBase = dataObject as PsCompliancePolicyBase;
         psCompliancePolicyBase.SuppressPiiData(Utils.GetSessionPiiMap(base.ExchangeRunspaceConfig));
     }
     base.WriteResult(dataObject);
 }
        public static void PopulatePolicyDistributionStatus(PsCompliancePolicyBase psPolicy, PolicyStorage policyStorage, IConfigDataProvider dataSession, Task task = null, ExecutionLog logger = null)
        {
            ArgumentValidator.ThrowIfNull("psPolicy", psPolicy);
            ArgumentValidator.ThrowIfNull("policyStorage", policyStorage);
            ArgumentValidator.ThrowIfNull("dataSession", dataSession);
            PolicySettingStatusHelpers            policySettingStatusHelpers = new PolicySettingStatusHelpers(dataSession, task, logger);
            List <PolicyDistributionErrorDetails> value;
            DateTime?lastStatusUpdateTime;

            psPolicy.DistributionStatus   = policySettingStatusHelpers.CalculatePolicyDistributionStatus(policyStorage, psPolicy.StorageBindings, dataSession, out value, out lastStatusUpdateTime);
            psPolicy.LastStatusUpdateTime = lastStatusUpdateTime;
            psPolicy.DistributionResults  = new MultiValuedProperty <PolicyDistributionErrorDetails>(value);
        }
		protected override void WriteResult(IConfigurable dataObject)
		{
			PsCompliancePolicyBase psCompliancePolicyBase = this.CreatePolicyByScenario(dataObject as PolicyStorage);
			if (psCompliancePolicyBase != null)
			{
				psCompliancePolicyBase.StorageBindings = Utils.LoadBindingStoragesByPolicy(base.DataSession, dataObject as PolicyStorage);
				foreach (BindingStorage bindingStorage in psCompliancePolicyBase.StorageBindings)
				{
					base.WriteVerbose(Strings.VerboseLoadBindingStorageObjects(bindingStorage.ToString(), psCompliancePolicyBase.ToString()));
				}
				psCompliancePolicyBase.PopulateTaskProperties(this, base.DataSession as IConfigurationSession);
				if (psCompliancePolicyBase.ReadOnly)
				{
					this.WriteWarning(Strings.WarningTaskPolicyIsTooAdvancedToRead(psCompliancePolicyBase.Name));
				}
				PolicySettingStatusHelpers.PopulatePolicyDistributionStatus(psCompliancePolicyBase, dataObject as PolicyStorage, base.DataSession, this, this.executionLogger);
				base.WriteResult(psCompliancePolicyBase);
			}
		}
Beispiel #5
0
        internal virtual void PopulateTaskProperties(Task task, IConfigurationSession configurationSession)
        {
            this.InitializeBindings();
            foreach (BindingStorage bindingStorage in this.StorageBindings)
            {
                switch (bindingStorage.Workload)
                {
                case Workload.Exchange:
                    this.ExchangeBinding = Utils.GetScopesFromStorage(bindingStorage);
                    break;

                case Workload.SharePoint:
                {
                    MultiValuedProperty <BindingMetadata> scopesFromStorage   = Utils.GetScopesFromStorage(bindingStorage);
                    MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>(PsCompliancePolicyBase.GetBindingsBySubWorkload(scopesFromStorage, Workload.SharePoint));
                    multiValuedProperty.SetIsReadOnly(false, null);
                    if (multiValuedProperty.Any <BindingMetadata>())
                    {
                        this.SharePointBinding = multiValuedProperty;
                    }
                    else
                    {
                        multiValuedProperty = new MultiValuedProperty <BindingMetadata>(PsCompliancePolicyBase.GetBindingsBySubWorkload(scopesFromStorage, Workload.OneDriveForBusiness));
                        multiValuedProperty.SetIsReadOnly(false, null);
                        if (multiValuedProperty.Any <BindingMetadata>())
                        {
                            this.OneDriveBinding = scopesFromStorage;
                        }
                    }
                    break;
                }

                default:
                    this.ReadOnly = true;
                    this.ExchangeBinding.Clear();
                    this.SharePointBinding.Clear();
                    this.OneDriveBinding.Clear();
                    break;
                }
            }
            PolicyStorage policyStorage = base.DataObject as PolicyStorage;
            ADUser        userObjectByExternalDirectoryObjectId  = Utils.GetUserObjectByExternalDirectoryObjectId(policyStorage.CreatedBy, configurationSession);
            ADUser        userObjectByExternalDirectoryObjectId2 = Utils.GetUserObjectByExternalDirectoryObjectId(policyStorage.LastModifiedBy, configurationSession);

            this.CreatedBy      = ((!Utils.ExecutingUserIsForestWideAdmin(task) && userObjectByExternalDirectoryObjectId != null) ? userObjectByExternalDirectoryObjectId.DisplayName : policyStorage.CreatedBy);
            this.LastModifiedBy = ((!Utils.ExecutingUserIsForestWideAdmin(task) && userObjectByExternalDirectoryObjectId2 != null) ? userObjectByExternalDirectoryObjectId2.DisplayName : policyStorage.LastModifiedBy);
        }
 public PolicyIdParameter(PsCompliancePolicyBase policy) : this(policy.Identity.ToString())
 {
 }