internal override bool HasPermissionForProperty(string propertyName, bool canUpdate) { if (EnvironmentAnalyzer.IsWorkGroup() || !base.ProfileBuilder.CanEnableUICustomization()) { return(true); } ColumnProfile columnProfile = (from DataColumn c in base.Table.Columns where c.ColumnName == propertyName select c).First <DataColumn>().ExtendedProperties["ColumnProfile"] as ColumnProfile; string dataObjectName = columnProfile.DataObjectName; IEnumerable <ReaderTaskProfile> source = from c in this.readerTaskProfileList where c.DataObjectName == dataObjectName select c; ReaderTaskProfile readerTaskProfile = null; if (source.Count <ReaderTaskProfile>() > 0) { readerTaskProfile = source.First <ReaderTaskProfile>(); } if (readerTaskProfile != null && !readerTaskProfile.HasPermission()) { return(false); } if (canUpdate) { if (columnProfile.IgnoreChangeTracking) { return(true); } IEnumerable <SaverTaskProfile> source2 = from c in this.saverTaskProfileList where (c.Runner as Saver).GetConsumedDataObjectName() == dataObjectName && !string.IsNullOrEmpty(dataObjectName) select c; SaverTaskProfile saverTaskProfile = null; if (source2.Count <SaverTaskProfile>() > 0) { saverTaskProfile = source2.First <SaverTaskProfile>(); } if (saverTaskProfile == null) { IEnumerable <SaverTaskProfile> enumerable = from c in this.saverTaskProfileList where (from p in c.ParameterProfileList where p.Reference == propertyName select p).Count <ParameterProfile>() > 0 select c; using (IEnumerator <SaverTaskProfile> enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { SaverTaskProfile saverTaskProfile2 = enumerator.Current; if (!saverTaskProfile2.HasPermission(columnProfile.MappingProperty)) { return(false); } } return(true); } } if (saverTaskProfile != null && !saverTaskProfile.HasPermission(columnProfile.MappingProperty)) { return(false); } } return(true); }
public override void Execute(TaskProfileBase profile, DataRow row, DataObjectStore store) { ReaderTaskProfile readerTaskProfile = profile as ReaderTaskProfile; if (readerTaskProfile != null && !readerTaskProfile.HasPermission() && this.IsPropertyPage) { return; } Stopwatch stopwatch = new Stopwatch(); MonadCommand monadCommand = null; if (profile.Runner is MonadReadTask) { monadCommand = ((MonadReadTask)profile.Runner).Command; } else if (profile.Runner is GroupReadTask) { monadCommand = ((GroupReadTask)profile.Runner).Command; } else if (profile.Runner is MonadSaveTask) { monadCommand = ((MonadSaveTask)profile.Runner).Command; } else if (profile.Runner is MonadPipelineSaveTask) { monadCommand = ((MonadPipelineSaveTask)profile.Runner).Command; } else if (!(profile.Runner is CreateDataObjectReader)) { if (profile.Runner is MembersSaveTask) { (profile.Runner as MembersSaveTask).UpdateConnection(this.connection); } else if (profile.Runner is GroupSaveTask) { (profile.Runner as GroupSaveTask).UpdateConnection(this.connection); } else if (profile.Runner is ClientPermissionSaveTask) { (profile.Runner as ClientPermissionSaveTask).UpdateConnection(this.connection); } } if (monadCommand != null) { monadCommand.Connection = this.connection; } try { if (monadCommand != null) { ExTraceGlobals.DataFlowTracer.TracePerformance <string, Guid, RunspaceState>((long)Thread.CurrentThread.ManagedThreadId, "MonadScriptExecutionContext.Execute: In runspace {1}[State:{2}], before executing command '{0}' .", monadCommand.CommandText, monadCommand.Connection.RunspaceProxy.InstanceId, monadCommand.Connection.RunspaceProxy.State); } stopwatch.Start(); profile.Run(null, row, store); } catch (CommandExecutionException) { if (!profile.IgnoreException) { throw; } } catch (CmdletInvocationException) { if (!profile.IgnoreException) { throw; } } catch (PipelineStoppedException) { if (!profile.IgnoreException) { throw; } } finally { stopwatch.Stop(); if (monadCommand != null) { ExTraceGlobals.DataFlowTracer.TracePerformance((long)Thread.CurrentThread.ManagedThreadId, "MonadScriptExecutionContext.Execute: In the runspace {1}[State:{2}], {3} Milliseconds are taken to finish the command {0}.", new object[] { monadCommand.CommandText, monadCommand.Connection.RunspaceProxy.InstanceId, monadCommand.Connection.RunspaceProxy.State, stopwatch.ElapsedMilliseconds }); } } }