Released for testing

master
Granfeldt_cp 2013-01-27 07:37:25 -08:00
parent a6bf0f406e
commit 579513ce7d
24 changed files with 2188 additions and 105 deletions

Binary file not shown.

View File

@ -39,6 +39,7 @@ namespace Granfeldt.FIM.ActivityLibrary
this.ConditionalUpdateTarget = new System.Workflow.Activities.IfElseBranchActivity();
this.faultHandlersActivity1 = new System.Workflow.ComponentModel.FaultHandlersActivity();
this.ResolveAndSave = new System.Workflow.Activities.SequenceActivity();
this.ExitGracefully = new System.Workflow.Activities.CodeActivity();
this.ShouldUpdateTargetOrWorkflowData = new System.Workflow.Activities.IfElseActivity();
this.ExecuteCode = new System.Workflow.Activities.CodeActivity();
this.CompileCode = new System.Workflow.Activities.CodeActivity();
@ -105,6 +106,11 @@ namespace Granfeldt.FIM.ActivityLibrary
this.ResolveAndSave.Activities.Add(this.faultHandlersActivity2);
this.ResolveAndSave.Name = "ResolveAndSave";
//
// ExitGracefully
//
this.ExitGracefully.Name = "ExitGracefully";
this.ExitGracefully.ExecuteCode += new System.EventHandler(this.ExitGracefully_ExecuteCode);
//
// ShouldUpdateTargetOrWorkflowData
//
this.ShouldUpdateTargetOrWorkflowData.Activities.Add(this.ConditionalUpdateTarget);
@ -135,6 +141,7 @@ namespace Granfeldt.FIM.ActivityLibrary
this.Activities.Add(this.CompileCode);
this.Activities.Add(this.ExecuteCode);
this.Activities.Add(this.ShouldUpdateTargetOrWorkflowData);
this.Activities.Add(this.ExitGracefully);
this.Name = "CodeRunActivity";
this.CanModifyActivities = false;
@ -142,6 +149,8 @@ namespace Granfeldt.FIM.ActivityLibrary
#endregion
private CodeActivity ExitGracefully;
private UpdateSingleValueAttributeAsNeededActivity UpdateTargetIfNeeded;
private IfElseBranchActivity UpdateWorkflowData;
@ -190,6 +199,7 @@ namespace Granfeldt.FIM.ActivityLibrary

View File

@ -187,6 +187,7 @@ namespace Granfeldt.FIM.ActivityLibrary
private void MoreParametersToResolve_Condition(object sender, ConditionalEventArgs e)
{
Debugging.Log("Activity initialized");
// we need to convert the string array to a list to
// be able to remove values
if (UnresolvedParameters == null)
@ -313,5 +314,9 @@ namespace Granfeldt.FIM.ActivityLibrary
Debugging.Log("Error: Argument Exception");
}
private void ExitGracefully_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Activity exited");
}
}
}

View File

@ -0,0 +1,115 @@
using System;
using System.Text;
using System.Web.UI.WebControls;
using System.Workflow.ComponentModel;
using Microsoft.IdentityManagement.WebUI.Controls;
using Microsoft.ResourceManagement.Workflow.Activities;
namespace Granfeldt.FIM.ActivityLibrary.WebUIs
{
class CopyValuesActivitySettingsPart : BaseActivitySettingsPart
{
const string InstanceTitle = "Title";
const string AttributePairs = "Attribute Pairs";
const string ConditionTrue = "ConditionTrue";
const string AlternativeTargetObject = "AlternativeTargetObject";
/// <summary>
/// Creates a Table that contains the controls used by the activity UI
/// in the Workflow Designer of the FIM portal. Adds that Table to the
/// collection of Controls that defines each activity that can be selected
/// in the Workflow Designer of the FIM Portal. Calls the base class of
/// ActivitySettingsPart to render the controls in the UI.
/// </summary>
protected override void CreateChildControls()
{
Table controlLayoutTable;
controlLayoutTable = new Table();
//Width is set to 100% of the control size
controlLayoutTable.Width = Unit.Percentage(100.0);
controlLayoutTable.BorderWidth = 0;
controlLayoutTable.CellPadding = 2;
//Add a TableRow for each textbox in the UI
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Title:", "txt" + InstanceTitle, 400, 100, false, ""));
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Update pairs:<br/><i>(source value, condition attribute name, target attribute name)</i>", "txt" + AttributePairs, 400, 400, true, ""));
controlLayoutTable.Rows.Add(this.AddCheckbox("Update only on True condition?<br/><i>(if unchecked, updates are performed if condition attribute value is missing or false. If no condition attribute is specified, an update is always done)</i>", "txt"+ConditionTrue, true));
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Alternative target:<br/><i>(you can specify an XPath filter to lookup an object that should be updated instead of the default Target object)</i>", "txt" + AlternativeTargetObject, 400, 100, false, ""));
this.Controls.Add(controlLayoutTable);
base.CreateChildControls();
}
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
{
if (!this.ValidateInputs())
{
return null;
}
CopyValuesActivity ThisActivity = new CopyValuesActivity();
ThisActivity.Title = this.GetText("txt" + InstanceTitle);
ThisActivity.AttributePairs = this.GetTextArray("txt" + AttributePairs);
ThisActivity.UpdateOnTrue = this.GetCheckbox("txt" + ConditionTrue);
ThisActivity.AlternativeTargetObject = this.GetText("txt" + AlternativeTargetObject);
return ThisActivity;
}
public override void LoadActivitySettings(Activity activity)
{
CopyValuesActivity ThisActivity = activity as CopyValuesActivity;
if (ThisActivity != null)
{
this.SetText("txt" + InstanceTitle, ThisActivity.Title);
this.SetTextArray("txt" + AttributePairs, ThisActivity.AttributePairs);
this.SetCheckbox("txt" + ConditionTrue, ThisActivity.UpdateOnTrue);
this.SetText("txt" + AlternativeTargetObject, ThisActivity.AlternativeTargetObject);
}
}
public override ActivitySettingsPartData PersistSettings()
{
ActivitySettingsPartData data = new ActivitySettingsPartData();
data[InstanceTitle] = this.GetText("txt" + InstanceTitle);
data[AttributePairs] = this.GetTextArray("txt" + AttributePairs);
data[ConditionTrue] = this.GetCheckbox("txt" + ConditionTrue);
data[AlternativeTargetObject] = this.GetText("txt" + AlternativeTargetObject);
return data;
}
public override void RestoreSettings(ActivitySettingsPartData data)
{
if (null != data)
{
this.SetText("txt" + InstanceTitle, (string)data[InstanceTitle]);
this.SetTextArray("txt" + AttributePairs, (string[])data[AttributePairs]);
this.SetCheckbox("txt" + ConditionTrue, (bool)data[ConditionTrue]);
this.SetText("txt" + AlternativeTargetObject, (string)data[AlternativeTargetObject]);
}
}
public override void SwitchMode(ActivitySettingsPartMode mode)
{
bool readOnly = (mode == ActivitySettingsPartMode.View);
this.SetTextBoxReadOnlyOption("txt" + InstanceTitle, readOnly);
this.SetTextBoxReadOnlyOption("txt" + AttributePairs, readOnly);
this.SetCheckboxReadOnlyOption("txt" + ConditionTrue, readOnly);
this.SetTextBoxReadOnlyOption("txt" + AlternativeTargetObject, readOnly);
}
public override string Title
{
get
{
return string.Format("Copy Values: {0}", this.GetText("txt" + InstanceTitle));
}
}
public override bool ValidateInputs()
{
return true;
}
}
}

View File

@ -0,0 +1,430 @@
// January 10, 2013 | Soren Granfeldt
// - initial version released for testing
// January 22, 2013 | Soren Granfeldt
// - added function to convert different types/values
// before comparison.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Linq;
using System.Text.RegularExpressions;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
using Microsoft.ResourceManagement.Workflow.Activities;
namespace Granfeldt.FIM.ActivityLibrary
{
public partial class CopyValuesActivity : SequenceActivity
{
public class AttributeValue
{
public string SourceAttributeName { get; set; }
public object SourceAttributeValue { get; set; }
public string TargetAttributeName { get; set; }
public object TargetAttributeValue { get; set; }
public bool ShouldResolve = false;
public string ConditionAttributeName { get; set; }
public bool ConditionAttributeValue { get; set; }
}
#region Properties
public static DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(CopyValuesActivity));
[Description("Title")]
[Category("Title Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string Title
{
get
{
return ((string)(base.GetValue(CopyValuesActivity.TitleProperty)));
}
set
{
base.SetValue(CopyValuesActivity.TitleProperty, value);
}
}
public static DependencyProperty AttributePairsProperty = DependencyProperty.Register("AttributePairs", typeof(string[]), typeof(CopyValuesActivity));
[Description("AttributePairs")]
[Category("AttributePairs Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string[] AttributePairs
{
get
{
return ((string[])(base.GetValue(CopyValuesActivity.AttributePairsProperty)));
}
set
{
base.SetValue(CopyValuesActivity.AttributePairsProperty, value);
}
}
public static DependencyProperty UpdateOnTrueProperty = DependencyProperty.Register("UpdateOnTrue", typeof(bool), typeof(CopyValuesActivity));
[Description("UpdateOnTrue")]
[Category("UpdateOnTrue Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool UpdateOnTrue
{
get
{
return ((bool)(base.GetValue(CopyValuesActivity.UpdateOnTrueProperty)));
}
set
{
base.SetValue(CopyValuesActivity.UpdateOnTrueProperty, value);
}
}
public static DependencyProperty TargetProperty = DependencyProperty.Register("Target", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType), typeof(CopyValuesActivity));
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Parameters")]
public Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType Target
{
get
{
return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType)(base.GetValue(CopyValuesActivity.TargetProperty)));
}
set
{
base.SetValue(CopyValuesActivity.TargetProperty, value);
}
}
public static DependencyProperty ResolvedSourceExpressionProperty = DependencyProperty.Register("ResolvedSourceExpression", typeof(System.String), typeof(CopyValuesActivity));
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Misc")]
public String ResolvedSourceExpression
{
get
{
return ((string)(base.GetValue(CopyValuesActivity.ResolvedSourceExpressionProperty)));
}
set
{
base.SetValue(CopyValuesActivity.ResolvedSourceExpressionProperty, value);
}
}
public static DependencyProperty AlternativeTargetObjectProperty = DependencyProperty.Register("AlternativeTargetObject", typeof(string), typeof(CopyValuesActivity));
[Description("AlternativeTargetObject")]
[Category("AlternativeTargetObject Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string AlternativeTargetObject
{
get
{
return ((string)(base.GetValue(CopyValuesActivity.AlternativeTargetObjectProperty)));
}
set
{
base.SetValue(CopyValuesActivity.AlternativeTargetObjectProperty, value);
}
}
public static DependencyProperty ResolvedAlternativeTargetObjectProperty = DependencyProperty.Register("ResolvedAlternativeTargetObject", typeof(System.String), typeof(CopyValuesActivity));
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Misc")]
public String ResolvedAlternativeTargetObject
{
get
{
return ((string)(base.GetValue(CopyValuesActivity.ResolvedAlternativeTargetObjectProperty)));
}
set
{
base.SetValue(CopyValuesActivity.ResolvedAlternativeTargetObjectProperty, value);
}
}
public static DependencyProperty ObjectIDToUpdateProperty = DependencyProperty.Register("ObjectIDToUpdate", typeof(Guid), typeof(CopyValuesActivity));
[Description("ObjectIDToUpdate")]
[Category("ObjectIDToUpdate Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Guid ObjectIDToUpdate
{
get
{
return ((Guid)(base.GetValue(CopyValuesActivity.ObjectIDToUpdateProperty)));
}
set
{
base.SetValue(CopyValuesActivity.ObjectIDToUpdateProperty, value);
}
}
#endregion
AttributeValue ResolvedAttributeValue;
List<string> selectionAttributes = new List<string>();
List<AttributeValue> attrValues = new List<AttributeValue>();
public CopyValuesActivity()
{
InitializeComponent();
}
public List<Guid> ObjectsToUpdate = new List<Guid>();
private void PrepareResolveValues_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Activity initialized");
// parse attribute pairs and build hashtable for easy processing
foreach (string attribute in this.AttributePairs)
{
string[] s = attribute.Split(new string[] { "," }, StringSplitOptions.None);
if (s.Length == 3)
{
foreach (string se in s.ToList().Where(n => !(n.Contains("[//")) && !(string.IsNullOrEmpty(n))))
{
Debugging.Log("Add selection attribute", se);
selectionAttributes.Add(se);
}
attrValues.Add(new AttributeValue { ShouldResolve = s[0].Trim().Contains("[//"), SourceAttributeName = s[0].Trim(), ConditionAttributeName = s[1].Trim(), TargetAttributeName = s[2].Trim() });
}
}
}
private void MoreToResolve_Condition(object sender, ConditionalEventArgs e)
{
// return true if there are any more source values to resolve
e.Result = attrValues.Where(av => av.ShouldResolve).Count() > 0;
if (e.Result)
{
ResolvedAttributeValue = attrValues.Where(a => a.ShouldResolve).FirstOrDefault();
ResolveSourceGrammar.GrammarExpression = ResolvedAttributeValue.SourceAttributeName;
ResolveSourceGrammar.Closed += new System.EventHandler<ActivityExecutionStatusChangedEventArgs>(ResolveSourceGrammar_Closed);
Debugging.Log("Resolving", ResolvedAttributeValue.SourceAttributeName);
}
else
{
Debugging.Log("No more source values to resolve");
}
}
void ResolveSourceGrammar_Closed(object sender, ActivityExecutionStatusChangedEventArgs e)
{
Debugging.Log(string.Format("Activity {0} result", e.Activity.Name), e.ExecutionResult);
}
private void NonExistingGrammarException_ExecuteCode(object sender, EventArgs e)
{
// if we get here, the resolve has failed. If the value that we're
// trying to resolve doesn't exist, we also get here. We
// assume that there is no value and set source value to null
// which effectively results in a 'Delete' operation on
// the target attribute value (if present)
Debugging.Log("Missing value or invalid XPath reference", this.ResolveSourceGrammar.GrammarExpression);
ResolvedAttributeValue.SourceAttributeValue = null;
ResolvedAttributeValue.ShouldResolve = false;
}
private void FetchResolvedGrammar_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Resolved", this.ResolvedSourceExpression);
ResolvedAttributeValue.SourceAttributeValue = this.ResolvedSourceExpression;
ResolvedAttributeValue.ShouldResolve = false;
}
private void ShouldDoLookup_Condition(object sender, ConditionalEventArgs e)
{
e.Result = false;
if (string.IsNullOrEmpty(this.AlternativeTargetObject))
{
Debugging.Log("No lookup is done. Object to update is //Target");
}
else
{
Debugging.Log("Unresolved alternative object", this.AlternativeTargetObject);
e.Result = true;
}
}
private void ExtractTargetObjectID_ExecuteCode(object sender, EventArgs e)
{
SequentialWorkflow containingWorkflow = null;
if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow))
{
throw new InvalidOperationException("Could not get parent workflow!");
}
ObjectsToUpdate.Add(containingWorkflow.TargetId);
Debugging.Log("Target ObjectID to update", containingWorkflow.TargetId);
}
private void PrepareFindTargetResource_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Preparing lookup of", ResolveLookupGrammar.ResolvedExpression);
FindTargetResource.ActorId = WellKnownGuids.FIMServiceAccount;
FindTargetResource.PageSize = 100;
FindTargetResource.Attributes = new string[] { "ObjectID" };
FindTargetResource.XPathFilter = this.ResolvedAlternativeTargetObject;
FindTargetResource.Closed += new System.EventHandler<ActivityExecutionStatusChangedEventArgs>(FindTargetResource_Closed);
}
void FindTargetResource_Closed(object sender, ActivityExecutionStatusChangedEventArgs e)
{
Debugging.Log(string.Format("Activity {0} result", e.Activity.Name), e.ExecutionResult);
Debugging.Log("Objects found#", FindTargetResource.TotalResultsCount);
if (FindTargetResource.TotalResultsCount > 0)
{
ObjectsToUpdate.AddRange(FindTargetResource.EnumeratedResourceIDs.ToList());
}
}
void ReadTarget_Closed(object sender, ActivityExecutionStatusChangedEventArgs e)
{
Debugging.Log(string.Format("Activity {0} result", e.Activity.Name), e.ExecutionResult);
}
private void MoreTargetsToUpdate_Condition(object sender, ConditionalEventArgs e)
{
if (ObjectsToUpdate.Count > 0)
{
e.Result = true;
this.ObjectIDToUpdate = ObjectsToUpdate[0];
ObjectsToUpdate.RemoveAt(0);
ReadTarget.ActorId = WellKnownGuids.FIMServiceAccount;
ReadTarget.ResourceId = this.ObjectIDToUpdate;
ReadTarget.SelectionAttributes = selectionAttributes.Distinct().ToArray();
ReadTarget.Closed += new System.EventHandler<ActivityExecutionStatusChangedEventArgs>(ReadTarget_Closed);
}
else
{
e.Result = false;
Debugging.Log("No more objects to update");
}
}
private void ShouldUpdate_Condition(object sender, ConditionalEventArgs e)
{
try
{
List<UpdateRequestParameter> updateParameters = new List<UpdateRequestParameter>();
foreach (AttributeValue val in attrValues)
{
val.TargetAttributeValue = this.ReadTarget.Resource[val.TargetAttributeName] != null ? this.ReadTarget.Resource[val.TargetAttributeName] : null;
Debugging.Log(val.TargetAttributeName, val.TargetAttributeValue);
if (!(string.IsNullOrEmpty(val.ConditionAttributeName)))
{
val.ConditionAttributeValue = this.ReadTarget.Resource[val.ConditionAttributeName] != null ? (bool)this.ReadTarget.Resource[val.ConditionAttributeName] : true;
}
else
{
val.ConditionAttributeValue = true;
}
// we need the original (non-converted) value if we are doing a removal as we must specify the original value (even a local date/time)
object originalTargetValue = val.TargetAttributeValue;
val.TargetAttributeValue = FIMAttributeUtilities.FormatValue(val.TargetAttributeValue);
val.SourceAttributeValue = FIMAttributeUtilities.FormatValue(val.SourceAttributeValue);
if (FIMAttributeUtilities.ValuesAreDifferent(val.SourceAttributeValue, val.TargetAttributeValue))
{
if (val.SourceAttributeValue == null)
{
// we are in a delete state
if (val.ConditionAttributeValue == this.UpdateOnTrue)
{
Debugging.Log(string.Format("Deleting value '{1}' from {0}", val.TargetAttributeName, val.TargetAttributeValue == null ? "(null)" : val.TargetAttributeValue));
updateParameters.Add(new UpdateRequestParameter(val.TargetAttributeName, UpdateMode.Remove, originalTargetValue));
}
else
{
Debugging.Log("Condition does not allow deleting", val.TargetAttributeName);
}
}
else
{
// we are in an update state
if (val.ConditionAttributeValue == this.UpdateOnTrue)
{
Debugging.Log(string.Format("Updating {0} from '{1}' to '{2}'", val.TargetAttributeName, val.TargetAttributeValue == null ? "(null)" : val.TargetAttributeValue, val.SourceAttributeValue));
updateParameters.Add(new UpdateRequestParameter(val.TargetAttributeName, UpdateMode.Modify, val.SourceAttributeValue));
}
else
{
Debugging.Log("Condition does not allow updating", val.TargetAttributeName);
}
}
}
else
{
Debugging.Log(string.Format("No need to update {0}. Value is already {1}", val.TargetAttributeName, val.TargetAttributeValue == null ? "(null)" : val.TargetAttributeValue));
}
}
// if we have added any update parameters this means that there are changes
// so we prepare the update activtiy with relevant information and
// set e.Result to true to ensure that the Update activity is called
if (updateParameters.Count > 0)
{
// Important: grap a hold of the proper UpdateResourceActivity instance
// we do this by "digging" down through the activties. I really, really
// need to find a more dynamic way of doing this.
var seqParent = (SequenceActivity)this.LoopUpdateAllTargets.DynamicActivity;
IfElseActivity ifelseact = (IfElseActivity)seqParent.Activities.OfType<IfElseActivity>().FirstOrDefault();
IfElseBranchActivity iebranch = (IfElseBranchActivity)ifelseact.Activities.OfType<IfElseBranchActivity>().FirstOrDefault();
UpdateResourceActivity currentUpdateActivityInstance = (UpdateResourceActivity)iebranch.Activities.OfType<UpdateResourceActivity>().FirstOrDefault();
if (currentUpdateActivityInstance == null)
{
throw new InvalidOperationException("Could not find dynamic UpdateResourceActivity");
}
else
{
e.Result = true;
currentUpdateActivityInstance.ActorId = WellKnownGuids.FIMServiceAccount;
currentUpdateActivityInstance.UpdateParameters = updateParameters.ToArray();
currentUpdateActivityInstance.ResourceId = this.ObjectIDToUpdate;
Debugging.Log("Updating", UpdateTarget.ResourceId);
}
}
else
{
Debugging.Log("Nothing to update for", this.ObjectIDToUpdate);
e.Result = false;
}
}
catch (Exception ex)
{
Debugging.Log(string.Format("Error: '{0}'", ex.Message));
}
}
private void ExitGracefully_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Activity exited");
}
private void FaultArgumentNullException_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Error", UpdateTarget.ExecutionResult);
}
}
}

View File

@ -0,0 +1,415 @@
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Reflection;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
namespace Granfeldt.FIM.ActivityLibrary
{
public partial class CopyValuesActivity
{
#region Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
[System.Diagnostics.DebuggerNonUserCode]
[System.CodeDom.Compiler.GeneratedCode("", "")]
private void InitializeComponent()
{
this.CanModifyActivities = true;
System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
System.Collections.Generic.List<Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType> list_11 = new System.Collections.Generic.List<Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType>();
System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind4 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind5 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();
System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();
System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();
this.FaultArgumentNullException = new System.Workflow.Activities.CodeActivity();
this.codeActivity1 = new System.Workflow.Activities.CodeActivity();
this.faultHandlerNullException = new System.Workflow.ComponentModel.FaultHandlerActivity();
this.faultHandlerActivity2 = new System.Workflow.ComponentModel.FaultHandlerActivity();
this.faultHandlersActivity2 = new System.Workflow.ComponentModel.FaultHandlersActivity();
this.UpdateTarget = new Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity();
this.NonExistingGrammarException = new System.Workflow.Activities.CodeActivity();
this.faultHandlersActivity3 = new System.Workflow.ComponentModel.FaultHandlersActivity();
this.NoTargetUpdate = new System.Workflow.Activities.IfElseBranchActivity();
this.YesUpdateTarget = new System.Workflow.Activities.IfElseBranchActivity();
this.faultHandlerActivity1 = new System.Workflow.ComponentModel.FaultHandlerActivity();
this.ShouldUpdateTargetObject = new System.Workflow.Activities.IfElseActivity();
this.ReadTarget = new Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity();
this.ExtractTargetObjectID = new System.Workflow.Activities.CodeActivity();
this.FindTargetResource = new Granfeldt.FIM.ActivityLibrary.FindResourcesActivity();
this.PrepareFindTargetResource = new System.Workflow.Activities.CodeActivity();
this.ResolveLookupGrammar = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
this.faultHandlersActivity1 = new System.Workflow.ComponentModel.FaultHandlersActivity();
this.FetchResolvedGrammar = new System.Workflow.Activities.CodeActivity();
this.ResolveSourceGrammar = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
this.UpdateSequence = new System.Workflow.Activities.SequenceActivity();
this.NoGetTargetID = new System.Workflow.Activities.IfElseBranchActivity();
this.YesLookup = new System.Workflow.Activities.IfElseBranchActivity();
this.ResolveValueGrammars = new System.Workflow.Activities.SequenceActivity();
this.ExitGracefully = new System.Workflow.Activities.CodeActivity();
this.LoopUpdateAllTargets = new System.Workflow.Activities.WhileActivity();
this.ShouldLookup = new System.Workflow.Activities.IfElseActivity();
this.ResolveSourceValues = new System.Workflow.Activities.WhileActivity();
this.PrepareResolveValues = new System.Workflow.Activities.CodeActivity();
//
// FaultArgumentNullException
//
this.FaultArgumentNullException.Name = "FaultArgumentNullException";
this.FaultArgumentNullException.ExecuteCode += new System.EventHandler(this.FaultArgumentNullException_ExecuteCode);
//
// codeActivity1
//
this.codeActivity1.Name = "codeActivity1";
this.codeActivity1.ExecuteCode += new System.EventHandler(this.FaultArgumentNullException_ExecuteCode);
//
// faultHandlerNullException
//
this.faultHandlerNullException.Activities.Add(this.FaultArgumentNullException);
this.faultHandlerNullException.FaultType = typeof(System.ArgumentNullException);
this.faultHandlerNullException.Name = "faultHandlerNullException";
//
// faultHandlerActivity2
//
this.faultHandlerActivity2.Activities.Add(this.codeActivity1);
this.faultHandlerActivity2.FaultType = typeof(System.ArgumentNullException);
this.faultHandlerActivity2.Name = "faultHandlerActivity2";
//
// faultHandlersActivity2
//
this.faultHandlersActivity2.Activities.Add(this.faultHandlerNullException);
this.faultHandlersActivity2.Name = "faultHandlersActivity2";
//
// UpdateTarget
//
this.UpdateTarget.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.UpdateTarget.ApplyAuthorizationPolicy = false;
this.UpdateTarget.Name = "UpdateTarget";
this.UpdateTarget.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.UpdateTarget.UpdateParameters = null;
//
// NonExistingGrammarException
//
this.NonExistingGrammarException.Name = "NonExistingGrammarException";
this.NonExistingGrammarException.ExecuteCode += new System.EventHandler(this.NonExistingGrammarException_ExecuteCode);
//
// faultHandlersActivity3
//
this.faultHandlersActivity3.Activities.Add(this.faultHandlerActivity2);
this.faultHandlersActivity3.Name = "faultHandlersActivity3";
//
// NoTargetUpdate
//
this.NoTargetUpdate.Name = "NoTargetUpdate";
//
// YesUpdateTarget
//
this.YesUpdateTarget.Activities.Add(this.UpdateTarget);
this.YesUpdateTarget.Activities.Add(this.faultHandlersActivity2);
codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ShouldUpdate_Condition);
this.YesUpdateTarget.Condition = codecondition1;
this.YesUpdateTarget.Name = "YesUpdateTarget";
//
// faultHandlerActivity1
//
this.faultHandlerActivity1.Activities.Add(this.NonExistingGrammarException);
this.faultHandlerActivity1.FaultType = typeof(System.ArgumentException);
this.faultHandlerActivity1.Name = "faultHandlerActivity1";
//
// ShouldUpdateTargetObject
//
this.ShouldUpdateTargetObject.Activities.Add(this.YesUpdateTarget);
this.ShouldUpdateTargetObject.Activities.Add(this.NoTargetUpdate);
this.ShouldUpdateTargetObject.Activities.Add(this.faultHandlersActivity3);
this.ShouldUpdateTargetObject.Name = "ShouldUpdateTargetObject";
//
// ReadTarget
//
this.ReadTarget.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.ReadTarget.Name = "ReadTarget";
activitybind1.Name = "CopyValuesActivity";
activitybind1.Path = "Target";
this.ReadTarget.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.ReadTarget.SelectionAttributes = null;
this.ReadTarget.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity.ResourceProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
//
// ExtractTargetObjectID
//
this.ExtractTargetObjectID.Name = "ExtractTargetObjectID";
this.ExtractTargetObjectID.ExecuteCode += new System.EventHandler(this.ExtractTargetObjectID_ExecuteCode);
//
// FindTargetResource
//
this.FindTargetResource.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.FindTargetResource.Attributes = new string[] {
"ObjectID"};
this.FindTargetResource.EnumeratedResourceIDs = null;
this.FindTargetResource.EnumeratedResources = list_11;
this.FindTargetResource.Name = "FindTargetResource";
this.FindTargetResource.PageSize = 0;
this.FindTargetResource.SortingAttributes = null;
this.FindTargetResource.TotalResultsCount = 0;
activitybind2.Name = "CopyValuesActivity";
activitybind2.Path = "ResolvedAlternativeTargetObject";
this.FindTargetResource.SetBinding(Granfeldt.FIM.ActivityLibrary.FindResourcesActivity.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
//
// PrepareFindTargetResource
//
this.PrepareFindTargetResource.Name = "PrepareFindTargetResource";
this.PrepareFindTargetResource.ExecuteCode += new System.EventHandler(this.PrepareFindTargetResource_ExecuteCode);
//
// ResolveLookupGrammar
//
activitybind3.Name = "CopyValuesActivity";
activitybind3.Path = "AlternativeTargetObject";
this.ResolveLookupGrammar.Name = "ResolveLookupGrammar";
activitybind4.Name = "CopyValuesActivity";
activitybind4.Path = "ResolvedAlternativeTargetObject";
this.ResolveLookupGrammar.WorkflowDictionaryKey = null;
this.ResolveLookupGrammar.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.GrammarExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
this.ResolveLookupGrammar.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.ResolvedExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
//
// faultHandlersActivity1
//
this.faultHandlersActivity1.Activities.Add(this.faultHandlerActivity1);
this.faultHandlersActivity1.Name = "faultHandlersActivity1";
//
// FetchResolvedGrammar
//
this.FetchResolvedGrammar.Name = "FetchResolvedGrammar";
this.FetchResolvedGrammar.ExecuteCode += new System.EventHandler(this.FetchResolvedGrammar_ExecuteCode);
//
// ResolveSourceGrammar
//
this.ResolveSourceGrammar.GrammarExpression = null;
this.ResolveSourceGrammar.Name = "ResolveSourceGrammar";
activitybind5.Name = "CopyValuesActivity";
activitybind5.Path = "ResolvedSourceExpression";
this.ResolveSourceGrammar.WorkflowDictionaryKey = null;
this.ResolveSourceGrammar.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.ResolvedExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
//
// UpdateSequence
//
this.UpdateSequence.Activities.Add(this.ReadTarget);
this.UpdateSequence.Activities.Add(this.ShouldUpdateTargetObject);
this.UpdateSequence.Name = "UpdateSequence";
//
// NoGetTargetID
//
this.NoGetTargetID.Activities.Add(this.ExtractTargetObjectID);
this.NoGetTargetID.Name = "NoGetTargetID";
//
// YesLookup
//
this.YesLookup.Activities.Add(this.ResolveLookupGrammar);
this.YesLookup.Activities.Add(this.PrepareFindTargetResource);
this.YesLookup.Activities.Add(this.FindTargetResource);
codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ShouldDoLookup_Condition);
this.YesLookup.Condition = codecondition2;
this.YesLookup.Name = "YesLookup";
//
// ResolveValueGrammars
//
this.ResolveValueGrammars.Activities.Add(this.ResolveSourceGrammar);
this.ResolveValueGrammars.Activities.Add(this.FetchResolvedGrammar);
this.ResolveValueGrammars.Activities.Add(this.faultHandlersActivity1);
this.ResolveValueGrammars.Name = "ResolveValueGrammars";
//
// ExitGracefully
//
this.ExitGracefully.Name = "ExitGracefully";
this.ExitGracefully.ExecuteCode += new System.EventHandler(this.ExitGracefully_ExecuteCode);
//
// LoopUpdateAllTargets
//
this.LoopUpdateAllTargets.Activities.Add(this.UpdateSequence);
codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.MoreTargetsToUpdate_Condition);
this.LoopUpdateAllTargets.Condition = codecondition3;
this.LoopUpdateAllTargets.Name = "LoopUpdateAllTargets";
//
// ShouldLookup
//
this.ShouldLookup.Activities.Add(this.YesLookup);
this.ShouldLookup.Activities.Add(this.NoGetTargetID);
this.ShouldLookup.Name = "ShouldLookup";
//
// ResolveSourceValues
//
this.ResolveSourceValues.Activities.Add(this.ResolveValueGrammars);
codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.MoreToResolve_Condition);
this.ResolveSourceValues.Condition = codecondition4;
this.ResolveSourceValues.Name = "ResolveSourceValues";
//
// PrepareResolveValues
//
this.PrepareResolveValues.Name = "PrepareResolveValues";
this.PrepareResolveValues.ExecuteCode += new System.EventHandler(this.PrepareResolveValues_ExecuteCode);
//
// CopyValuesActivity
//
this.Activities.Add(this.PrepareResolveValues);
this.Activities.Add(this.ResolveSourceValues);
this.Activities.Add(this.ShouldLookup);
this.Activities.Add(this.LoopUpdateAllTargets);
this.Activities.Add(this.ExitGracefully);
this.Name = "CopyValuesActivity";
this.CanModifyActivities = false;
}
#endregion
private CodeActivity codeActivity1;
private FaultHandlerActivity faultHandlerActivity2;
private FaultHandlersActivity faultHandlersActivity3;
private CodeActivity FaultArgumentNullException;
private FaultHandlerActivity faultHandlerNullException;
private Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity UpdateTarget;
private FaultHandlersActivity faultHandlersActivity2;
private WhileActivity LoopUpdateAllTargets;
private SequenceActivity UpdateSequence;
private CodeActivity ExtractTargetObjectID;
private CodeActivity ExitGracefully;
private CodeActivity PrepareResolveValues;
private CodeActivity PrepareFindTargetResource;
private FindResourcesActivity FindTargetResource;
private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveLookupGrammar;
private IfElseBranchActivity NoGetTargetID;
private IfElseBranchActivity YesLookup;
private IfElseActivity ShouldLookup;
private CodeActivity NonExistingGrammarException;
private FaultHandlerActivity faultHandlerActivity1;
private FaultHandlersActivity faultHandlersActivity1;
private CodeActivity FetchResolvedGrammar;
private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveSourceGrammar;
private WhileActivity ResolveSourceValues;
private SequenceActivity ResolveValueGrammars;
private IfElseBranchActivity NoTargetUpdate;
private IfElseBranchActivity YesUpdateTarget;
private IfElseActivity ShouldUpdateTargetObject;
private Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity ReadTarget;
}
}

View File

@ -0,0 +1,278 @@
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Reflection;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
namespace Granfeldt.FIM.ActivityLibrary
{
public partial class CreateObjectActivity
{
#region Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
[System.Diagnostics.DebuggerNonUserCode]
[System.CodeDom.Compiler.GeneratedCode("", "")]
private void InitializeComponent()
{
this.CanModifyActivities = true;
System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
System.Collections.Generic.List<Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType> list_11 = new System.Collections.Generic.List<Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType>();
System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();
System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();
this.NonExistingGrammarException = new System.Workflow.Activities.CodeActivity();
this.InvalidGrammerOrArgument = new System.Workflow.ComponentModel.FaultHandlerActivity();
this.faultHandlersActivity1 = new System.Workflow.ComponentModel.FaultHandlersActivity();
this.FetchResolvedGrammar = new System.Workflow.Activities.CodeActivity();
this.ResolveInitialValueGrammar = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
this.ResolveAndFetchSequence = new System.Workflow.Activities.SequenceActivity();
this.CreateNewObject = new Microsoft.ResourceManagement.Workflow.Activities.CreateResourceActivity();
this.PrepareCreateObject = new System.Workflow.Activities.CodeActivity();
this.ResolveInitialValueWhile = new System.Workflow.Activities.WhileActivity();
this.PrepareResolveInitialValues = new System.Workflow.Activities.CodeActivity();
this.VerifyExistenceLookupResult = new System.Workflow.Activities.CodeActivity();
this.ExistenceLookup = new Granfeldt.FIM.ActivityLibrary.FindResourcesActivity();
this.PrepareExistenceCheckLookup = new System.Workflow.Activities.CodeActivity();
this.ResolveExistenceTestFilter = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
this.NoCreateObject = new System.Workflow.Activities.IfElseBranchActivity();
this.YesCreateObject = new System.Workflow.Activities.IfElseBranchActivity();
this.DontCheckExistence = new System.Workflow.Activities.IfElseBranchActivity();
this.CheckExistence = new System.Workflow.Activities.IfElseBranchActivity();
this.ExitGracefully = new System.Workflow.Activities.CodeActivity();
this.ShouldCreateObject = new System.Workflow.Activities.IfElseActivity();
this.DoExistenceTest = new System.Workflow.Activities.IfElseActivity();
//
// NonExistingGrammarException
//
this.NonExistingGrammarException.Name = "NonExistingGrammarException";
this.NonExistingGrammarException.ExecuteCode += new System.EventHandler(this.NonExistingGrammarException_ExecuteCode);
//
// InvalidGrammerOrArgument
//
this.InvalidGrammerOrArgument.Activities.Add(this.NonExistingGrammarException);
this.InvalidGrammerOrArgument.FaultType = typeof(System.ArgumentException);
this.InvalidGrammerOrArgument.Name = "InvalidGrammerOrArgument";
//
// faultHandlersActivity1
//
this.faultHandlersActivity1.Activities.Add(this.InvalidGrammerOrArgument);
this.faultHandlersActivity1.Name = "faultHandlersActivity1";
//
// FetchResolvedGrammar
//
this.FetchResolvedGrammar.Name = "FetchResolvedGrammar";
this.FetchResolvedGrammar.ExecuteCode += new System.EventHandler(this.FetchResolvedGrammar_ExecuteCode);
//
// ResolveInitialValueGrammar
//
this.ResolveInitialValueGrammar.GrammarExpression = null;
this.ResolveInitialValueGrammar.Name = "ResolveInitialValueGrammar";
activitybind1.Name = "CreateObjectActivity";
activitybind1.Path = "ResolvedInitialValueGrammer";
this.ResolveInitialValueGrammar.WorkflowDictionaryKey = null;
this.ResolveInitialValueGrammar.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.ResolvedExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
//
// ResolveAndFetchSequence
//
this.ResolveAndFetchSequence.Activities.Add(this.ResolveInitialValueGrammar);
this.ResolveAndFetchSequence.Activities.Add(this.FetchResolvedGrammar);
this.ResolveAndFetchSequence.Activities.Add(this.faultHandlersActivity1);
this.ResolveAndFetchSequence.Name = "ResolveAndFetchSequence";
//
// CreateNewObject
//
this.CreateNewObject.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.CreateNewObject.ApplyAuthorizationPolicy = false;
activitybind2.Name = "CreateObjectActivity";
activitybind2.Path = "CreatedObjectId";
this.CreateNewObject.CreateParameters = null;
this.CreateNewObject.Name = "CreateNewObject";
this.CreateNewObject.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.CreateResourceActivity.CreatedResourceIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
//
// PrepareCreateObject
//
this.PrepareCreateObject.Name = "PrepareCreateObject";
this.PrepareCreateObject.ExecuteCode += new System.EventHandler(this.PrepareCreateObject_ExecuteCode);
//
// ResolveInitialValueWhile
//
this.ResolveInitialValueWhile.Activities.Add(this.ResolveAndFetchSequence);
codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.MoreToResolve_Condition);
this.ResolveInitialValueWhile.Condition = codecondition1;
this.ResolveInitialValueWhile.Name = "ResolveInitialValueWhile";
//
// PrepareResolveInitialValues
//
this.PrepareResolveInitialValues.Name = "PrepareResolveInitialValues";
this.PrepareResolveInitialValues.ExecuteCode += new System.EventHandler(this.PrepareResolveInitialValues_ExecuteCode);
//
// VerifyExistenceLookupResult
//
this.VerifyExistenceLookupResult.Name = "VerifyExistenceLookupResult";
this.VerifyExistenceLookupResult.ExecuteCode += new System.EventHandler(this.VerifyExistenceLookupResult_ExecuteCode);
//
// ExistenceLookup
//
this.ExistenceLookup.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.ExistenceLookup.Attributes = null;
this.ExistenceLookup.EnumeratedResourceIDs = null;
this.ExistenceLookup.EnumeratedResources = list_11;
this.ExistenceLookup.Name = "ExistenceLookup";
this.ExistenceLookup.PageSize = 0;
this.ExistenceLookup.SortingAttributes = null;
this.ExistenceLookup.TotalResultsCount = 0;
this.ExistenceLookup.XPathFilter = null;
//
// PrepareExistenceCheckLookup
//
this.PrepareExistenceCheckLookup.Name = "PrepareExistenceCheckLookup";
this.PrepareExistenceCheckLookup.ExecuteCode += new System.EventHandler(this.PrepareExistenceCheckLookup_ExecuteCode);
//
// ResolveExistenceTestFilter
//
this.ResolveExistenceTestFilter.GrammarExpression = null;
this.ResolveExistenceTestFilter.Name = "ResolveExistenceTestFilter";
this.ResolveExistenceTestFilter.ResolvedExpression = null;
this.ResolveExistenceTestFilter.WorkflowDictionaryKey = null;
//
// NoCreateObject
//
this.NoCreateObject.Name = "NoCreateObject";
//
// YesCreateObject
//
this.YesCreateObject.Activities.Add(this.PrepareResolveInitialValues);
this.YesCreateObject.Activities.Add(this.ResolveInitialValueWhile);
this.YesCreateObject.Activities.Add(this.PrepareCreateObject);
this.YesCreateObject.Activities.Add(this.CreateNewObject);
codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ShouldCreateObject_Condition);
this.YesCreateObject.Condition = codecondition2;
this.YesCreateObject.Name = "YesCreateObject";
//
// DontCheckExistence
//
this.DontCheckExistence.Name = "DontCheckExistence";
//
// CheckExistence
//
this.CheckExistence.Activities.Add(this.ResolveExistenceTestFilter);
this.CheckExistence.Activities.Add(this.PrepareExistenceCheckLookup);
this.CheckExistence.Activities.Add(this.ExistenceLookup);
this.CheckExistence.Activities.Add(this.VerifyExistenceLookupResult);
codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DoExistenceCheck_Condition);
this.CheckExistence.Condition = codecondition3;
this.CheckExistence.Name = "CheckExistence";
//
// ExitGracefully
//
this.ExitGracefully.Name = "ExitGracefully";
this.ExitGracefully.ExecuteCode += new System.EventHandler(this.ExitGracefully_ExecuteCode);
//
// ShouldCreateObject
//
this.ShouldCreateObject.Activities.Add(this.YesCreateObject);
this.ShouldCreateObject.Activities.Add(this.NoCreateObject);
this.ShouldCreateObject.Name = "ShouldCreateObject";
//
// DoExistenceTest
//
this.DoExistenceTest.Activities.Add(this.CheckExistence);
this.DoExistenceTest.Activities.Add(this.DontCheckExistence);
this.DoExistenceTest.Name = "DoExistenceTest";
//
// CreateObjectActivity
//
this.Activities.Add(this.DoExistenceTest);
this.Activities.Add(this.ShouldCreateObject);
this.Activities.Add(this.ExitGracefully);
this.Name = "CreateObjectActivity";
this.CanModifyActivities = false;
}
#endregion
private CodeActivity ExitGracefully;
private CodeActivity PrepareCreateObject;
private Microsoft.ResourceManagement.Workflow.Activities.CreateResourceActivity CreateNewObject;
private CodeActivity NonExistingGrammarException;
private FaultHandlerActivity InvalidGrammerOrArgument;
private FaultHandlersActivity faultHandlersActivity1;
private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveInitialValueGrammar;
private SequenceActivity ResolveAndFetchSequence;
private CodeActivity FetchResolvedGrammar;
private WhileActivity ResolveInitialValueWhile;
private IfElseBranchActivity NoCreateObject;
private IfElseBranchActivity YesCreateObject;
private IfElseActivity ShouldCreateObject;
private CodeActivity PrepareResolveInitialValues;
private CodeActivity VerifyExistenceLookupResult;
private FindResourcesActivity ExistenceLookup;
private CodeActivity PrepareExistenceCheckLookup;
private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveExistenceTestFilter;
private IfElseBranchActivity DontCheckExistence;
private IfElseBranchActivity CheckExistence;
private IfElseActivity DoExistenceTest;
}
}

View File

@ -0,0 +1,118 @@
// January 24, 2013 | Soren Granfeldt
// - initial version
using System;
using System.Text;
using System.Web.UI.WebControls;
using System.Workflow.ComponentModel;
using Microsoft.IdentityManagement.WebUI.Controls;
using Microsoft.ResourceManagement.Workflow.Activities;
namespace Granfeldt.FIM.ActivityLibrary.WebUIs
{
class CreateObjectActivitySettingsPart : BaseActivitySettingsPart
{
const string InstanceTitle = "Title";
const string InitialValuePairs = "Initial value pairs";
const string ExistenceLookupFilter = "ExistenceLookupFilter";
const string NewObjectType = "NewObjectType";
/// <summary>
/// Creates a Table that contains the controls used by the activity UI
/// in the Workflow Designer of the FIM portal. Adds that Table to the
/// collection of Controls that defines each activity that can be selected
/// in the Workflow Designer of the FIM Portal. Calls the base class of
/// ActivitySettingsPart to render the controls in the UI.
/// </summary>
protected override void CreateChildControls()
{
Table controlLayoutTable;
controlLayoutTable = new Table();
//Width is set to 100% of the control size
controlLayoutTable.Width = Unit.Percentage(100.0);
controlLayoutTable.BorderWidth = 0;
controlLayoutTable.CellPadding = 2;
//Add a TableRow for each textbox in the UI
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Title:", "txt" + InstanceTitle, 400, 100, false, ""));
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Initial values:<br/><i>(initial value, attribute name)</i>", "txt" + InitialValuePairs, 400, 400, true, ""));
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Existence lookup filter:<br/><i>(specify an XPath filter to do a pre-create lookup. If one or more objects are found, the new object is not created. If this field is left blank, a new object is always created)</i>", "txt" + ExistenceLookupFilter, 400, 100, false, ""));
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("New object type:<br/><i>(specify type of the new object, i.e. Person, Group or other)</i>", "txt" + NewObjectType, 400, 100, false, ""));
this.Controls.Add(controlLayoutTable);
base.CreateChildControls();
}
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
{
if (!this.ValidateInputs())
{
return null;
}
CreateObjectActivity ThisActivity = new CreateObjectActivity();
ThisActivity.Title = this.GetText("txt" + InstanceTitle);
ThisActivity.InitialValuePairs = this.GetTextArray("txt" + InitialValuePairs);
ThisActivity.ExistenceLookupFilter = this.GetText("txt" + ExistenceLookupFilter);
ThisActivity.NewObjectType = this.GetText("txt" + NewObjectType);
return ThisActivity;
}
public override void LoadActivitySettings(Activity activity)
{
CreateObjectActivity ThisActivity = activity as CreateObjectActivity;
if (ThisActivity != null)
{
this.SetText("txt" + InstanceTitle, ThisActivity.Title);
this.SetTextArray("txt" + InitialValuePairs, ThisActivity.InitialValuePairs);
this.SetText("txt" + ExistenceLookupFilter, ThisActivity.ExistenceLookupFilter);
this.SetText("txt" + NewObjectType, ThisActivity.NewObjectType);
}
}
public override ActivitySettingsPartData PersistSettings()
{
ActivitySettingsPartData data = new ActivitySettingsPartData();
data[InstanceTitle] = this.GetText("txt" + InstanceTitle);
data[InitialValuePairs] = this.GetTextArray("txt" + InitialValuePairs);
data[NewObjectType] = this.GetText("txt" + NewObjectType);
data[ExistenceLookupFilter] = this.GetText("txt" + ExistenceLookupFilter);
return data;
}
public override void RestoreSettings(ActivitySettingsPartData data)
{
if (null != data)
{
this.SetText("txt" + InstanceTitle, (string)data[InstanceTitle]);
this.SetTextArray("txt" + InitialValuePairs, (string[])data[InitialValuePairs]);
this.SetText("txt" + NewObjectType, (string)data[NewObjectType]);
this.SetText("txt" + ExistenceLookupFilter, (string)data[ExistenceLookupFilter]);
}
}
public override void SwitchMode(ActivitySettingsPartMode mode)
{
bool readOnly = (mode == ActivitySettingsPartMode.View);
this.SetTextBoxReadOnlyOption("txt" + InstanceTitle, readOnly);
this.SetTextBoxReadOnlyOption("txt" + InitialValuePairs, readOnly);
this.SetTextBoxReadOnlyOption("txt" + NewObjectType, readOnly);
this.SetTextBoxReadOnlyOption("txt" + ExistenceLookupFilter, readOnly);
}
public override string Title
{
get
{
return string.Format("Create Object: {0}", this.GetText("txt" + InstanceTitle));
}
}
public override bool ValidateInputs()
{
return true;
}
}
}

View File

@ -0,0 +1,266 @@
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Linq;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Collections.Generic;
using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
// The workflow was triggered, and I get Denied on the Group creation. I've populated all of the required attribute required to create a group (ObjectType = Group, Type = Distribution, Scope = Universal, DisplayName = SomeUniqueName, MembershipLocked = false, MembershipAddWorkflow = Owner Approval, Domain = MyDomain, DisplayedOwner = containingWorkflow.ActorId, Owner = containingWorkflow.ActorId, MailNickname = SomeUniqueName, AccountName = SomeUniqueName).
// http://www.fimspecialist.com/fim-portal/custom-workflow-examples/createresourceactivity-example/
namespace Granfeldt.FIM.ActivityLibrary
{
public partial class CreateObjectActivity : SequenceActivity
{
#region Properties
public static DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(CreateObjectActivity));
[Description("Title")]
[Category("Title Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string Title
{
get
{
return ((string)(base.GetValue(CreateObjectActivity.TitleProperty)));
}
set
{
base.SetValue(CreateObjectActivity.TitleProperty, value);
}
}
public static DependencyProperty InitialValuePairsProperty = DependencyProperty.Register("InitialValuePairs", typeof(string[]), typeof(CreateObjectActivity));
[Description("InitialValuePairs")]
[Category("InitialValuePairs Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string[] InitialValuePairs
{
get
{
return ((string[])(base.GetValue(CreateObjectActivity.InitialValuePairsProperty)));
}
set
{
base.SetValue(CreateObjectActivity.InitialValuePairsProperty, value);
}
}
public static DependencyProperty NewObjectTypeProperty = DependencyProperty.Register("NewObjectType", typeof(string), typeof(CreateObjectActivity));
[Description("NewObjectType")]
[Category("NewObjectType Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string NewObjectType
{
get
{
return ((string)(base.GetValue(CreateObjectActivity.NewObjectTypeProperty)));
}
set
{
base.SetValue(CreateObjectActivity.NewObjectTypeProperty, value);
}
}
public static DependencyProperty ExistenceLookupFilterProperty = DependencyProperty.Register("ExistenceLookupFilter", typeof(string), typeof(CreateObjectActivity));
[Description("ExistenceLookupFilter")]
[Category("ExistenceLookupFilter Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string ExistenceLookupFilter
{
get
{
return ((string)(base.GetValue(CreateObjectActivity.ExistenceLookupFilterProperty)));
}
set
{
base.SetValue(CreateObjectActivity.ExistenceLookupFilterProperty, value);
}
}
public static DependencyProperty ResolvedInitialValueGrammerProperty = DependencyProperty.Register("ResolvedInitialValueGrammer", typeof(string), typeof(CreateObjectActivity));
[Description("ResolvedInitialValueGrammer")]
[Category("ResolvedInitialValueGrammer Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string ResolvedInitialValueGrammer
{
get
{
return ((string)(base.GetValue(CreateObjectActivity.ResolvedInitialValueGrammerProperty)));
}
set
{
base.SetValue(CreateObjectActivity.ResolvedInitialValueGrammerProperty, value);
}
}
public static DependencyProperty CreatedObjectIdProperty = DependencyProperty.Register("CreatedObjectId", typeof(System.Guid), typeof(Granfeldt.FIM.ActivityLibrary.CreateObjectActivity));
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Parameters")]
public Guid CreatedObjectId
{
get
{
return ((System.Guid)(base.GetValue(Granfeldt.FIM.ActivityLibrary.CreateObjectActivity.CreatedObjectIdProperty)));
}
set
{
base.SetValue(Granfeldt.FIM.ActivityLibrary.CreateObjectActivity.CreatedObjectIdProperty, value);
}
}
#endregion
public CreateObjectActivity()
{
InitializeComponent();
}
private void DoExistenceCheck_Condition(object sender, ConditionalEventArgs e)
{
Debugging.Log("Activity initialized");
e.Result = false;
if (string.IsNullOrEmpty(this.ExistenceLookupFilter))
{
Debugging.Log("Existence filter is empty. No existence check will be done.");
}
else
{
e.Result = true;
Debugging.Log("Resolving existence test filer", this.ExistenceLookupFilter);
ResolveExistenceTestFilter.GrammarExpression = this.ExistenceLookupFilter;
}
}
private void PrepareExistenceCheckLookup_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Preparing lookup of", ResolveExistenceTestFilter.ResolvedExpression);
ExistenceLookup.ActorId = WellKnownGuids.FIMServiceAccount;
ExistenceLookup.PageSize = 100;
ExistenceLookup.Attributes = new string[] { "ObjectID" };
ExistenceLookup.XPathFilter = ResolveExistenceTestFilter.ResolvedExpression;
}
private void VerifyExistenceLookupResult_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Found results #", ExistenceLookup.TotalResultsCount);
}
private void ShouldCreateObject_Condition(object sender, ConditionalEventArgs e)
{
e.Result = !(ExistenceLookup.TotalResultsCount > 0);
Debugging.Log(string.Format("Object will {0}be created", e.Result ? "" : "NOT "));
}
public class AttributeValue
{
public object Value { get; set; }
public string TargetAttributeName { get; set; }
public bool ShouldResolve = false;
}
List<AttributeValue> AttributeValues = new List<AttributeValue>();
AttributeValue ResolvedAttributeValue;
private void PrepareResolveInitialValues_ExecuteCode(object sender, EventArgs e)
{
// parse attribute pairs and build hashtable for easy processing
foreach (string attribute in this.InitialValuePairs)
{
string[] s = attribute.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 2)
{
Debugging.Log("Adding initial value expression", attribute);
AttributeValues.Add(new AttributeValue { ShouldResolve = s[0].Trim().Contains("[//"), Value = s[0].Trim(), TargetAttributeName = s[1].Trim() });
}
else
{
Debugging.Log("Invalid initial value entry", attribute);
}
}
}
private void MoreToResolve_Condition(object sender, ConditionalEventArgs e)
{
// return true if there are any more source values to resolve
e.Result = AttributeValues.Where(av => av.ShouldResolve).Count() > 0;
if (e.Result)
{
ResolvedAttributeValue = AttributeValues.Where(a => a.ShouldResolve).FirstOrDefault();
Debugging.Log("Resolving", ResolvedAttributeValue.Value);
// prepare ResolveGrammer activity
ResolveInitialValueGrammar.GrammarExpression = (string)ResolvedAttributeValue.Value;
//ResolveInitialValueGrammar.ResolvedExpression = this.ResolvedInitialValueGrammer;
}
else
{
Debugging.Log("No more source values to resolve");
}
}
private void FetchResolvedGrammar_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Resolved value", ResolveInitialValueGrammar.ResolvedExpression);
Debugging.Log("Resolved value (this)", this.ResolvedInitialValueGrammer);
ResolvedAttributeValue.Value = ResolveInitialValueGrammar.ResolvedExpression;
ResolvedAttributeValue.ShouldResolve = false;
}
private void NonExistingGrammarException_ExecuteCode(object sender, EventArgs e)
{
// if we get here, the resolve has failed. If the value that we're
// trying to resolve doesn't exist, we also get here. We
// assume that there is no value and set source value to null
// which effectively results in a 'Delete' operation on
// the target attribute value (if present)
Debugging.Log("Missing value or invalid XPath reference", this.ResolveInitialValueGrammar.GrammarExpression);
ResolvedAttributeValue.Value = null;
ResolvedAttributeValue.ShouldResolve = false;
}
private void PrepareCreateObject_ExecuteCode(object sender, EventArgs e)
{
List<CreateRequestParameter> RequestParameters = new List<CreateRequestParameter>();
Debugging.Log("Preparing to create object type", this.NewObjectType);
RequestParameters.Add(new CreateRequestParameter("ObjectType", this.NewObjectType));
foreach (AttributeValue value in AttributeValues)
{
if (value.Value == null)
{
Debugging.Log("Skip adding NULL parameter", value.TargetAttributeName);
}
else
{
object formattedValue = FIMAttributeUtilities.FormatValue(value.Value);
Debugging.Log(string.Format("Adding {0} (formatted value)", value.TargetAttributeName), formattedValue);
RequestParameters.Add(new CreateRequestParameter(value.TargetAttributeName, formattedValue));
}
}
CreateNewObject.ActorId = WellKnownGuids.FIMServiceAccount;
CreateNewObject.CreateParameters = RequestParameters.ToArray();
}
private void ExitGracefully_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Activity exited");
}
}
}

View File

@ -0,0 +1,24 @@
<RuleDefinitions xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow">
<RuleDefinitions.Conditions>
<RuleExpressionCondition Name="Condition1">
<RuleExpressionCondition.Expression>
<ns0:CodeBinaryOperatorExpression Operator="ValueEquality" xmlns:ns0="clr-namespace:System.CodeDom;Assembly=System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<ns0:CodeBinaryOperatorExpression.Right>
<ns0:CodePrimitiveExpression>
<ns0:CodePrimitiveExpression.Value>
<ns1:Boolean xmlns:ns1="clr-namespace:System;Assembly=mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">false</ns1:Boolean>
</ns0:CodePrimitiveExpression.Value>
</ns0:CodePrimitiveExpression>
</ns0:CodeBinaryOperatorExpression.Right>
<ns0:CodeBinaryOperatorExpression.Left>
<ns0:CodeFieldReferenceExpression FieldName="ObjectAlreadyExists">
<ns0:CodeFieldReferenceExpression.TargetObject>
<ns0:CodeThisReferenceExpression />
</ns0:CodeFieldReferenceExpression.TargetObject>
</ns0:CodeFieldReferenceExpression>
</ns0:CodeBinaryOperatorExpression.Left>
</ns0:CodeBinaryOperatorExpression>
</RuleExpressionCondition.Expression>
</RuleExpressionCondition>
</RuleDefinitions.Conditions>
</RuleDefinitions>

View File

@ -0,0 +1,97 @@
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Reflection;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
namespace Granfeldt.FIM.ActivityLibrary
{
public partial class DeleteObjectActivity
{
#region Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
[System.Diagnostics.DebuggerNonUserCode]
[System.CodeDom.Compiler.GeneratedCode("", "")]
private void InitializeComponent()
{
this.CanModifyActivities = true;
System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
this.ExitGracefully = new System.Workflow.Activities.CodeActivity();
this.DeleteObject = new Microsoft.ResourceManagement.Workflow.Activities.DeleteResourceActivity();
this.PrepareDeleteObject = new System.Workflow.Activities.CodeActivity();
this.ResolveObjectIDToDeleteGrammar = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
this.PrepareResolveDeleteObjectID = new System.Workflow.Activities.CodeActivity();
//
// ExitGracefully
//
this.ExitGracefully.Name = "ExitGracefully";
this.ExitGracefully.ExecuteCode += new System.EventHandler(this.ExitGracefully_ExecuteCode);
//
// DeleteObject
//
this.DeleteObject.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
this.DeleteObject.ApplyAuthorizationPolicy = false;
this.DeleteObject.Name = "DeleteObject";
this.DeleteObject.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
//
// PrepareDeleteObject
//
this.PrepareDeleteObject.Name = "PrepareDeleteObject";
this.PrepareDeleteObject.ExecuteCode += new System.EventHandler(this.PrepareDeleteObject_ExecuteCode);
//
// ResolveObjectIDToDeleteGrammar
//
this.ResolveObjectIDToDeleteGrammar.GrammarExpression = null;
this.ResolveObjectIDToDeleteGrammar.Name = "ResolveObjectIDToDeleteGrammar";
activitybind1.Name = "DeleteObjectActivity";
activitybind1.Path = "ResolvedObjectIDToDelete";
this.ResolveObjectIDToDeleteGrammar.WorkflowDictionaryKey = null;
this.ResolveObjectIDToDeleteGrammar.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.ResolvedExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
//
// PrepareResolveDeleteObjectID
//
this.PrepareResolveDeleteObjectID.Name = "PrepareResolveDeleteObjectID";
this.PrepareResolveDeleteObjectID.ExecuteCode += new System.EventHandler(this.PrepareResolveDeleteObjectID_ExecuteCode);
//
// DeleteObjectActivity
//
this.Activities.Add(this.PrepareResolveDeleteObjectID);
this.Activities.Add(this.ResolveObjectIDToDeleteGrammar);
this.Activities.Add(this.PrepareDeleteObject);
this.Activities.Add(this.DeleteObject);
this.Activities.Add(this.ExitGracefully);
this.Name = "DeleteObjectActivity";
this.CanModifyActivities = false;
}
#endregion
private Microsoft.ResourceManagement.Workflow.Activities.DeleteResourceActivity DeleteObject;
private CodeActivity PrepareDeleteObject;
private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveObjectIDToDeleteGrammar;
private CodeActivity ExitGracefully;
private CodeActivity PrepareResolveDeleteObjectID;
}
}

View File

@ -0,0 +1,103 @@
// January 24, 2013 | Soren Granfeldt
// - initial version
using System;
using System.Text;
using System.Web.UI.WebControls;
using System.Workflow.ComponentModel;
using Microsoft.IdentityManagement.WebUI.Controls;
using Microsoft.ResourceManagement.Workflow.Activities;
namespace Granfeldt.FIM.ActivityLibrary.WebUIs
{
class DeleteObjectActivitySettingsPart : BaseActivitySettingsPart
{
const string InstanceTitle = "Title";
const string ObjectIDToDelete = "ObjectIDToDelete";
/// <summary>
/// Creates a Table that contains the controls used by the activity UI
/// in the Workflow Designer of the FIM portal. Adds that Table to the
/// collection of Controls that defines each activity that can be selected
/// in the Workflow Designer of the FIM Portal. Calls the base class of
/// ActivitySettingsPart to render the controls in the UI.
/// </summary>
protected override void CreateChildControls()
{
Table controlLayoutTable;
controlLayoutTable = new Table();
//Width is set to 100% of the control size
controlLayoutTable.Width = Unit.Percentage(100.0);
controlLayoutTable.BorderWidth = 0;
controlLayoutTable.CellPadding = 2;
//Add a TableRow for each textbox in the UI
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Title:", "txt" + InstanceTitle, 400, 100, false, ""));
controlLayoutTable.Rows.Add(this.AddTableRowTextBox("ObjectID:<br/><i>(ID of object to delete, i.e. [//Target/ObjectID] or [//WorkflowData/DeleteObjectID])</i>", "txt" + ObjectIDToDelete, 400, 400, false, "[//Target/ObjectID]"));
this.Controls.Add(controlLayoutTable);
base.CreateChildControls();
}
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
{
if (!this.ValidateInputs())
{
return null;
}
DeleteObjectActivity ThisActivity = new DeleteObjectActivity();
ThisActivity.Title = this.GetText("txt" + InstanceTitle);
ThisActivity.ObjectIDToDelete = this.GetText("txt" + ObjectIDToDelete);
return ThisActivity;
}
public override void LoadActivitySettings(Activity activity)
{
DeleteObjectActivity ThisActivity = activity as DeleteObjectActivity;
if (ThisActivity != null)
{
this.SetText("txt" + InstanceTitle, ThisActivity.Title);
this.SetText("txt" + ObjectIDToDelete, ThisActivity.ObjectIDToDelete);
}
}
public override ActivitySettingsPartData PersistSettings()
{
ActivitySettingsPartData data = new ActivitySettingsPartData();
data[InstanceTitle] = this.GetText("txt" + InstanceTitle);
data[ObjectIDToDelete] = this.GetText("txt" + ObjectIDToDelete);
return data;
}
public override void RestoreSettings(ActivitySettingsPartData data)
{
if (null != data)
{
this.SetText("txt" + InstanceTitle, (string)data[InstanceTitle]);
this.SetText("txt" + ObjectIDToDelete, (string)data[ObjectIDToDelete]);
}
}
public override void SwitchMode(ActivitySettingsPartMode mode)
{
bool readOnly = (mode == ActivitySettingsPartMode.View);
this.SetTextBoxReadOnlyOption("txt" + InstanceTitle, readOnly);
this.SetTextBoxReadOnlyOption("txt" + ObjectIDToDelete, readOnly);
}
public override string Title
{
get
{
return string.Format("Delete Object: {0}", this.GetText("txt" + InstanceTitle));
}
}
public override bool ValidateInputs()
{
return true;
}
}
}

View File

@ -0,0 +1,113 @@
// January 24, 2013 | Soren Granfeldt
// - initial version
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Linq;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
namespace Granfeldt.FIM.ActivityLibrary
{
public partial class DeleteObjectActivity : SequenceActivity
{
#region Properties
public static DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(DeleteObjectActivity));
[Description("Title")]
[Category("Title Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string Title
{
get
{
return ((string)(base.GetValue(DeleteObjectActivity.TitleProperty)));
}
set
{
base.SetValue(DeleteObjectActivity.TitleProperty, value);
}
}
public static DependencyProperty ObjectIDToDeleteProperty = DependencyProperty.Register("ObjectIDToDelete", typeof(string), typeof(DeleteObjectActivity));
[Description("ObjectIDToDelete")]
[Category("ObjectIDToDelete Category")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string ObjectIDToDelete
{
get
{
return ((string)(base.GetValue(DeleteObjectActivity.ObjectIDToDeleteProperty)));
}
set
{
base.SetValue(DeleteObjectActivity.ObjectIDToDeleteProperty, value);
}
}
public static DependencyProperty ResolvedObjectIDToDeleteProperty = DependencyProperty.Register("ResolvedObjectIDToDelete", typeof(System.String), typeof(Granfeldt.FIM.ActivityLibrary.DeleteObjectActivity));
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute("Misc")]
public String ResolvedObjectIDToDelete
{
get
{
return ((string)(base.GetValue(Granfeldt.FIM.ActivityLibrary.DeleteObjectActivity.ResolvedObjectIDToDeleteProperty)));
}
set
{
base.SetValue(Granfeldt.FIM.ActivityLibrary.DeleteObjectActivity.ResolvedObjectIDToDeleteProperty, value);
}
}
#endregion
public DeleteObjectActivity()
{
InitializeComponent();
}
private void PrepareResolveDeleteObjectID_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Activity initialized");
Debugging.Log("Resolving", this.ObjectIDToDelete);
ResolveObjectIDToDeleteGrammar.GrammarExpression = this.ObjectIDToDelete;
ResolveObjectIDToDeleteGrammar.Closed += new System.EventHandler<ActivityExecutionStatusChangedEventArgs>(ResolveObjectIDToDeleteGrammar_Closed);
}
private void PrepareDeleteObject_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Preparing delete of", this.ResolvedObjectIDToDelete);
DeleteObject.ActorId = WellKnownGuids.FIMServiceAccount;
DeleteObject.ResourceId = new Guid(this.ResolvedObjectIDToDelete);
DeleteObject.Closed += new System.EventHandler<ActivityExecutionStatusChangedEventArgs>(DeleteObject_Closed);
}
private void ExitGracefully_ExecuteCode(object sender, EventArgs e)
{
Debugging.Log("Activity exited");
}
void ResolveObjectIDToDeleteGrammar_Closed(object sender, ActivityExecutionStatusChangedEventArgs e)
{
Debugging.Log("Resolve execution result", e.ExecutionResult);
}
void DeleteObject_Closed(object sender, ActivityExecutionStatusChangedEventArgs e)
{
Debugging.Log("Delete execution result", e.ExecutionResult);
}
}
}

View File

@ -1,6 +1,6 @@
// January 17, 2013 | Soren Granfeldt
// - code revised and partially rewritten before CodePlex release
// Januar 22, 2013 | Kristian Birk Thim
// January 22, 2013 | Kristian Birk Thim
// - Added support to return results in Enumerate.TotalResultsCount where count is 1.
using System;

View File

@ -49,7 +49,6 @@ namespace Granfeldt.FIM.ActivityLibrary
protected TableRow AddLookupActionDropDownList(String labelText, String controlID, int width, String defaultValue)
{
Debugging.Log("Enter AddLookupActionDropDownList");
TableRow row = new TableRow();
TableCell labelCell = new TableCell();
TableCell controlCell = new TableCell();
@ -73,13 +72,11 @@ namespace Granfeldt.FIM.ActivityLibrary
row.Cells.Add(labelCell);
row.Cells.Add(controlCell);
Debugging.Log("Leave AddLookupActionDropDownList");
return row;
}
protected string GetLookupActionDropDownList(string dropDownListID)
{
Debugging.Log("Enter GetLookupActionDropDownList");
string g = "";
DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
if (ddl != null)
@ -89,13 +86,11 @@ namespace Granfeldt.FIM.ActivityLibrary
}
else
Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
Debugging.Log("Leave GetLookupActionDropDownList");
return g;
}
protected void SetLookupActionDropDownList(string dropDownListID, string value)
{
Debugging.Log("Enter SetLookupActionDropDownList");
DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
if (ddl != null)
{
@ -104,7 +99,6 @@ namespace Granfeldt.FIM.ActivityLibrary
}
else
Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
Debugging.Log("Leave SetLookupActionDropDownList");
}
#endregion
@ -113,7 +107,6 @@ namespace Granfeldt.FIM.ActivityLibrary
protected TableRow AddActorDropDownList(String labelText, String controlID, int width, String defaultValue)
{
Debugging.Log("Enter AddActorDropDownList");
TableRow row = new TableRow();
TableCell labelCell = new TableCell();
TableCell controlCell = new TableCell();
@ -141,13 +134,11 @@ namespace Granfeldt.FIM.ActivityLibrary
row.Cells.Add(labelCell);
row.Cells.Add(controlCell);
Debugging.Log("Leave AddActorDropDownList");
return row;
}
protected string GetActorDropDownList(string dropDownListID)
{
Debugging.Log("Enter GetActorDropDownList");
string g = WellKnownGuids.FIMServiceAccount.ToString();
DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
if (ddl != null)
@ -157,13 +148,11 @@ namespace Granfeldt.FIM.ActivityLibrary
}
else
Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
Debugging.Log("Leave GetActorDropDownList");
return g;
}
protected void SetActorDropDownList(string dropDownListID, object Guid)
{
Debugging.Log("Enter SetActorDropDownList");
DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
if (ddl != null)
{
@ -172,14 +161,12 @@ namespace Granfeldt.FIM.ActivityLibrary
}
else
Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
Debugging.Log("Leave SetActorDropDownList");
}
#endregion
protected TableRow AddCheckbox(String labelText, String controlID, bool defaultValue)
{
Debugging.Log("Enter AddCheckbox");
TableRow row = new TableRow();
TableCell labelCell = new TableCell();
TableCell controlCell = new TableCell();
@ -198,7 +185,6 @@ namespace Granfeldt.FIM.ActivityLibrary
row.Cells.Add(labelCell);
row.Cells.Add(controlCell);
Debugging.Log("Leave AddCheckbox");
return row;
}
@ -269,11 +255,8 @@ namespace Granfeldt.FIM.ActivityLibrary
textBox.Enabled = !readOnly;
}
protected void SetDropDownListDisabled(string dropDownListID, bool disabled)
{
Debugging.Log("Enter SetDropDownListEnabled");
DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
if (ddl != null)
{
@ -281,7 +264,6 @@ namespace Granfeldt.FIM.ActivityLibrary
}
else
Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
Debugging.Log("Leave SetDropDownListEnabled");
}
#endregion

View File

@ -81,6 +81,68 @@ namespace Granfeldt.FIM.ActivityLibrary
}
public static class FIMAttributeUtilities
{
/// <summary>
/// Returns a formatted value ready for committing to create/update resource built-in activity
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static object FormatValue(object value)
{
if (value == null)
return null;
if (value.GetType() == typeof(bool))
return value;
// if the source value is a date, we need to format the date for the update to take the value
DateTime outputDate;
if (DateTime.TryParse(value.ToString(), out outputDate))
{
value = outputDate.ToString("yyyy-MM-ddTHH:mm:ss.000");
return value;
}
// if it's a reference value, we need to remove leading urn:uuid text before later comparison
value = Regex.Replace(value.ToString(), "^urn:uuid:", "", RegexOptions.IgnoreCase);
return value;
}
/// <summary>
/// Returns true if the two values are different (FIM evaluation)
/// </summary>
/// <param name="sourceValue"></param>
/// <param name="targetValue"></param>
/// <returns></returns>
public static bool ValuesAreDifferent(object sourceValue, object targetValue)
{
if (targetValue == null || sourceValue == null)
{
if (targetValue != null || sourceValue != null)
{
return true;
}
else
{
return false;
}
}
else
{
if (!targetValue.ToString().Equals(sourceValue.ToString(), StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
return false;
}
}
}
}
public class StringUtilities
{
/// <summary>
@ -93,10 +155,10 @@ namespace Granfeldt.FIM.ActivityLibrary
public static void ExtractWorkflowExpression(string Expression, out string Destination, out string DestinationAttribute)
{
Regex regex = new Regex(@"^\[//(?<destination>\w+)/+?(?<destinationattribute>\w*[^]])", RegexOptions.IgnoreCase);
Destination = regex.Match(Expression).Result("${destination}");
DestinationAttribute = regex.Match(Expression).Result("${destinationattribute}");
}
}
}

View File

@ -118,58 +118,6 @@ namespace Granfeldt.FIM.ActivityLibrary
InitializeComponent();
}
private static bool ShouldUpdateAttribute(object sourceValue, object targetValue)
{
if (targetValue == null || sourceValue == null)
{
if (targetValue != null || sourceValue != null)
{
return true;
}
else
{
return false;
}
}
else
{
Debugging.Log("Source value", sourceValue);
Debugging.Log("Target value", targetValue);
if (!targetValue.ToString().Equals(sourceValue.ToString(), StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
return false;
}
}
}
private static object CleanAndFormatFIMValue(object value)
{
if (value == null)
return null;
if (value.GetType() == typeof(bool))
return value;
// if the source value is a date, we need to
// format the date for the update to take
// the value
DateTime outputDate;
if (DateTime.TryParse(value.ToString(), out outputDate))
{
value = outputDate.ToString("yyyy-MM-ddTHH:mm:ss.000");
return value;
}
// if it's a reference value, we need to remove leading urn:uuid text
// before later comparison
value = Regex.Replace(value.ToString(), "^urn:uuid:", "", RegexOptions.IgnoreCase);
return value;
}
private void TargetUpdateNeeded_Condition(object sender, ConditionalEventArgs e)
{
List<UpdateRequestParameter> updateParameters = new List<UpdateRequestParameter>();
@ -177,10 +125,10 @@ namespace Granfeldt.FIM.ActivityLibrary
e.Result = false;
object CurrentValue = TargetResource[this.AttributeName];
object convertedSourceValue = CleanAndFormatFIMValue(CurrentValue);
object convertedNewValue = CleanAndFormatFIMValue(this.NewValue);
object convertedSourceValue = FIMAttributeUtilities.FormatValue(CurrentValue);
object convertedNewValue = FIMAttributeUtilities.FormatValue(this.NewValue);
if (ShouldUpdateAttribute(convertedSourceValue, convertedNewValue))
if (FIMAttributeUtilities.ValuesAreDifferent(convertedSourceValue, convertedNewValue))
{
e.Result = true;

View File

@ -74,6 +74,27 @@
<Compile Include="Activity.CodeRun\Activity.CodeRun.Designer.cs">
<DependentUpon>Activity.CodeRun.cs</DependentUpon>
</Compile>
<Compile Include="Activity.CopyValues\Activity.CopyValues.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Activity.CopyValues\Activity.CopyValues.designer.cs">
<DependentUpon>Activity.CopyValues.cs</DependentUpon>
</Compile>
<Compile Include="Activity.CopyValues\Activity.CopyValues.SettingsPart.cs" />
<Compile Include="Activity.CreateObject\Activity.CreateObject.SettingsPart.cs" />
<Compile Include="Activity.CreateObject\Activity.CreateObject.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Activity.CreateObject\Activity.CreateObject.Designer.cs">
<DependentUpon>Activity.CreateObject.cs</DependentUpon>
</Compile>
<Compile Include="Activity.DeleteObject\Activity.DeleteObject.SettingsPart.cs" />
<Compile Include="Activity.DeleteObject\Activity.DeleteObject.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Activity.DeleteObject\Activity.DeleteObject.Designer.cs">
<DependentUpon>Activity.DeleteObject.cs</DependentUpon>
</Compile>
<Compile Include="Activity.LookupAttributeValue\Activity.LookupAttributeValue.cs">
<SubType>Component</SubType>
</Compile>
@ -125,6 +146,11 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Activity.CreateObject\Activity.CreateObject.rules">
<DependentUpon>Activity.CreateObject.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
<Import Project="$(MSBuildToolsPath)\Workflow.Targets" />

View File

@ -2,7 +2,10 @@
(
[string] $AssemblyName = "Granfeldt.FIM.ActivityLibrary.dll",
[switch] $CreateCodeRunActivity,
[switch] $CreateLookupActivity
[switch] $CreateLookupValueActivity,
[switch] $CreateCopyValuesActivity,
[switch] $CreateCreateObjectActivity,
[switch] $CreateDeleteObjectActivity
)
BEGIN
@ -33,7 +36,7 @@ PROCESS
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateLookupActivity)
if ($CreateLookupValueActivity)
{
$Params = @{ `
DisplayName = 'Lookup Attribute Value'
@ -46,6 +49,49 @@ PROCESS
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateCopyValuesActivity)
{
$Params = @{ `
DisplayName = 'Copy Values'
Description = 'Copies values to target or enumerated object'
ActivityName = "$ManifestModule.CopyValuesActivity"
TypeName = "$ManifestModule.WebUIs.CopyValuesActivitySettingsPart"
IsActionActivity = $true
AssemblyName = $LoadedAssembly.Fullname
}
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateCreateObjectActivity)
{
$Params = @{ `
DisplayName = 'Create Object'
Description = 'Creates new object with initial values'
ActivityName = "$ManifestModule.CreateObjectActivity"
TypeName = "$ManifestModule.WebUIs.CreateObjectActivitySettingsPart"
IsActionActivity = $true
AssemblyName = $LoadedAssembly.Fullname
}
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateDeleteObjectActivity)
{
$Params = @{ `
DisplayName = 'Delete Object'
Description = 'Deletes an object'
ActivityName = "$ManifestModule.DeleteObjectActivity"
TypeName = "$ManifestModule.WebUIs.DeleteObjectActivitySettingsPart"
IsActionActivity = $true
AssemblyName = $LoadedAssembly.Fullname
}
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
}
END

View File

@ -30,3 +30,4 @@ using System.Runtime.InteropServices;
//NOTE: When updating the namespaces in the project please add new or update existing the XmlnsDefinitionAttribute
//You can add additional attributes in order to map any additional namespaces you have in the project
//[assembly: System.Workflow.ComponentModel.Serialization.XmlnsDefinition("http://schemas.com/Granfeldt.FIM.ActivityLibrary", "Granfeldt.FIM.ActivityLibrary")]
[assembly: AssemblyFileVersionAttribute("1.3.0.0")]

View File

@ -4,21 +4,20 @@
)
function get-webpageWithAuthN([string]$url,[System.Net.NetworkCredential]$cred=$null){
write-host -foregroundcolor green "Warming up $url";
$wc = new-object net.webclient;
$wc.credentials = $cred;
#$wc.Headers.Add("user-agent", "PowerShell");
$html = $wc.DownloadString($url);
#$html
function Get-WebpageWithAuthN([string]$Url, [System.Net.NetworkCredential] $cred=$null){
Write-Verbose "Warming up $url"
$wc = New-Object Net.WebClient
$wc.Credentials = $cred
$html = $wc.DownloadString($url)
}
if (Test-Path "C:\Temp\_FIM-WF-*.log") { Del "C:\Temp\_FIM-WF-*.log" }
(Join-Path $PWD Granfeldt.FIM.ActivityLibrary.dll) | .\Add-AssemblyToGlobalAssemblyCache.ps1
Get-Service FIMService | Restart-Service -Verbose
if ($IISReset) { IISRESET }
#FIM
$website = "http://localhost/IdentityManagement"
$credentials = [System.Net.CredentialCache]::DefaultCredentials;
#get-webpageWithAuthN -url $website -cred $credentials
if ($IISReset) {
IISRESET
$website = "http://localhost/IdentityManagement"
$credentials = [System.Net.CredentialCache]::DefaultCredentials;
get-webpageWithAuthN -url $website -cred $credentials
}

View File

@ -2,7 +2,10 @@
(
[string] $AssemblyName = "Granfeldt.FIM.ActivityLibrary.dll",
[switch] $CreateCodeRunActivity,
[switch] $CreateLookupActivity
[switch] $CreateLookupValueActivity,
[switch] $CreateCopyValuesActivity,
[switch] $CreateCreateObjectActivity,
[switch] $CreateDeleteObjectActivity
)
BEGIN
@ -33,7 +36,7 @@ PROCESS
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateLookupActivity)
if ($CreateLookupValueActivity)
{
$Params = @{ `
DisplayName = 'Lookup Attribute Value'
@ -46,6 +49,49 @@ PROCESS
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateCopyValuesActivity)
{
$Params = @{ `
DisplayName = 'Copy Values'
Description = 'Copies values to target or enumerated object'
ActivityName = "$ManifestModule.CopyValuesActivity"
TypeName = "$ManifestModule.WebUIs.CopyValuesActivitySettingsPart"
IsActionActivity = $true
AssemblyName = $LoadedAssembly.Fullname
}
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateCreateObjectActivity)
{
$Params = @{ `
DisplayName = 'Create Object'
Description = 'Creates new object with initial values'
ActivityName = "$ManifestModule.CreateObjectActivity"
TypeName = "$ManifestModule.WebUIs.CreateObjectActivitySettingsPart"
IsActionActivity = $true
AssemblyName = $LoadedAssembly.Fullname
}
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
if ($CreateDeleteObjectActivity)
{
$Params = @{ `
DisplayName = 'Delete Object'
Description = 'Deletes an object'
ActivityName = "$ManifestModule.DeleteObjectActivity"
TypeName = "$ManifestModule.WebUIs.DeleteObjectActivitySettingsPart"
IsActionActivity = $true
AssemblyName = $LoadedAssembly.Fullname
}
$Params
.\New-FIMActivityInformationConfigurationObject.ps1 @Params
}
}
END

View File

@ -4,21 +4,20 @@
)
function get-webpageWithAuthN([string]$url,[System.Net.NetworkCredential]$cred=$null){
write-host -foregroundcolor green "Warming up $url";
$wc = new-object net.webclient;
$wc.credentials = $cred;
#$wc.Headers.Add("user-agent", "PowerShell");
$html = $wc.DownloadString($url);
#$html
function Get-WebpageWithAuthN([string]$Url, [System.Net.NetworkCredential] $cred=$null){
Write-Verbose "Warming up $url"
$wc = New-Object Net.WebClient
$wc.Credentials = $cred
$html = $wc.DownloadString($url)
}
if (Test-Path "C:\Temp\_FIM-WF-*.log") { Del "C:\Temp\_FIM-WF-*.log" }
(Join-Path $PWD Granfeldt.FIM.ActivityLibrary.dll) | .\Add-AssemblyToGlobalAssemblyCache.ps1
Get-Service FIMService | Restart-Service -Verbose
if ($IISReset) { IISRESET }
#FIM
$website = "http://localhost/IdentityManagement"
$credentials = [System.Net.CredentialCache]::DefaultCredentials;
#get-webpageWithAuthN -url $website -cred $credentials
if ($IISReset) {
IISRESET
$website = "http://localhost/IdentityManagement"
$credentials = [System.Net.CredentialCache]::DefaultCredentials;
get-webpageWithAuthN -url $website -cred $credentials
}