示例#1
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);
        }