public RoutingControl(IPolicyChannel channel) { InitializeComponent(); if (null != channel) { this.routingsgb.Visible = false; this.routingsgb.Height = 0; this.functionsgb.Visible = false; this.functionsgb.Height = 0; this.headingtxt.Text = channel.Name; this.descriptiontxt.Text = channel["Description"]; MatrixTableControl routingTableControl = new MatrixTableControl(channel); routingTableControl.Dock = DockStyle.Fill; routingTableControl.Parent = this.routingtablegb; routingTableControl.Refresh(); } else { MatrixTableControl routingTableControl = new MatrixTableControl(null); routingTableControl.Dock = DockStyle.Fill; routingTableControl.Parent = this.routingtablegb; routingTableControl.Refresh(); this.headingtxt.Text = "Routings"; this.descriptiontxt.Text = "Allows the user to create, modify, or remove existing routing tables."; } this.AutoSize = true; }
public ChannelSummary(IPolicyChannel channel) { m_channel = channel; Dictionary<KeyValuePair<Guid, Guid>, IRoutingMatrixCell>.Enumerator enumerator = m_channel.Routing.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair<KeyValuePair<Guid, Guid>, IRoutingMatrixCell> current = enumerator.Current; //string matrixDescription = current.Value.Description.Value; IActionMatrixCell action = m_channel.Actions[current.Key.Key, current.Key.Value]; string routingName = current.Value.Description.Value; if (action != null) { foreach (IActionConditionGroup acg in action.ActionConditionGroups) { if (acg.ActionGroup.Actions.Count > 0) { m_routingActions.Add(new ActionSetSummary(acg.ActionGroup, routingName)); } } } } }
private SortedList<int, IAction> GetExternalActions(IPolicyChannel channel) { SortedList<int, IAction> externalActions = new SortedList<int, IAction>(); IRoutingTable routing = channel.Routing; if (routing == null) return externalActions; Guid unprivDestinationId = routing.DefaultDestination.Identifier; Guid unprivSourceId = routing.DefaultSource.Identifier; IRoutingMatrixCell routingMatrixCell = routing[unprivSourceId, unprivDestinationId]; if (routingMatrixCell == null) return externalActions; IActionMatrixCell actionMatrixCell = channel.Actions[unprivSourceId, unprivDestinationId]; if (actionMatrixCell == null) return externalActions; foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups) { foreach (IAction action in actionCondtionGroup.ActionGroup.Actions) { externalActions.Add(action.Precedence, action); } } return externalActions; }
public override void Enter() { if (null == m_channel) { m_channel = m_policy.Channels[0]; } if (false == m_policy.Channels.Contains(m_channel)) { m_channel = m_policy.Channels[0]; } SetControlLabels(); List<RoutingHelper.RoutingType> routingTypes = RoutingHelper.SupportedRoutingTypes(m_channel.Type); m_actionPanel.RoutingTypes = routingTypes; m_actionPanel.ShowRoutingTypeSelection = (routingTypes.Count > 1) ? true : false; m_actionPanel.RoutingType = RoutingHelper.GetRoutingType(m_channel.Routing); m_actionPanel.Policy = m_policy; m_actionPanel.Channel = m_channel; m_actionPanel.PublishPolicySetEnabled = PolicyDesigner.CheckLicense(); m_actionPanel.Display(); StateMachine.ChildForm.TreeViewController.SelectNode(m_channel, true); }
public ActionMatrixEventArgs(IPolicy policy, IPolicyChannel channel, IRoutingItemCollection senderCollection, IRoutingItemCollection recipientCollection, Workshare.Policy.ObjectModel.IAction action) { m_policy = policy; m_channel = channel; m_senderCollection = senderCollection; m_recipientCollection = recipientCollection; m_action = action; }
public NxOfflineRoutingSet(IPolicyChannel channel, NxObjectWriter objectWriter, IResourceManager resourceManager, Guid offlineRoutingId) : base(offlineRoutingId.ToString()) { m_Pow = objectWriter; m_PolicyChannel = channel; m_OfflineRoutingId = offlineRoutingId; m_resourceManager = resourceManager; CreateOfflineRoutingSet(); }
public NxRoutingSet(IPolicyChannel channel, NxObjectWriter objectWriter, IResourceManager resourceManager) { m_objectWriter = objectWriter; m_policyChannel = channel; m_routingId = channel.Routing.Identifier.ToString(); m_routingSet = new NxSet(m_routingId); m_routingSet.Append(new NxComment("Online routing")); m_resourceManager = resourceManager; InitialiseObjectLookups(); }
public NxPreRoutingSet(IPolicyChannel channel, IPolicyObject parent, Guid preRoutingId, Guid offlineRoutingId) : base(preRoutingId.ToString()) { m_channel = channel; m_parent = parent; m_ChannelRoutingId = channel.Identifier; m_OfflineRoutingId = offlineRoutingId; CreatePreRoutingSet(); }
public void SetChannel(IPolicyChannel channel) { Clear(); this.descriptionText.Text = channel["Description"]; //TODO: PW check why there are multiple routing tables here foreach (IRoutingTable table in channel.Routing) { this.matrixTableControl.Refresh(table); } this.Refresh(); }
private void WriteRouting(XmlNode parentNode, IPolicyChannel channel) { IRoutingTable routingTable = channel.Routing; if (null == routingTable) return; XmlNode xmlRoutingTableNode = m_xmlDocument.CreateElement("RoutingTable"); parentNode.AppendChild(xmlRoutingTableNode); XmlHelpers.AddIdAttribute(xmlRoutingTableNode, routingTable); XmlHelpers.AddReadOnlyAttribute(xmlRoutingTableNode, routingTable.ReadOnly); XmlHelpers.AddCustomAttributes(xmlRoutingTableNode, routingTable); }
public void Initialise(IPolicy policy, IPolicyChannel channel, IActionGroup group) { //if the action group has changed, don't bother trying to select the //same action that was selected prior to this call if (group != m_actionGroup) { m_selectedActionIndex = -1; } m_policy = policy; m_channel = channel; m_actionGroup = group; FillCatalogActions(); FillAssignedActions(); this.actiongroupNameTextBox.Focus(); }
private void ValidateChannel1(IPolicyChannel channel) { Assert.IsNotNull(channel, "Expected a valid channel"); Assert.AreEqual(new Guid("{EB97BB54-CB76-46EE-B024-3F747ED4424F}"), channel.Identifier); Assert.AreEqual("Email PolicySets", channel.Name.Value); IRoutingTable smtpRouting = channel.Routing; Assert.IsNotNull(smtpRouting, "Expected the routing table type to be SMTP"); Assert.AreEqual(new Guid("{AF6E5D89-0C6F-4B10-9A6C-658D13CD3EA8}"), smtpRouting.Identifier); Assert.AreEqual("Internal financial users", smtpRouting.Name.Value); Assert.IsNotNull(smtpRouting.Sources, "Expected a valid sources collection"); IRoutingItemCollections senders = smtpRouting.Sources; Assert.IsNotNull(senders); Assert.AreEqual(3, senders.Count); IRoutingItemCollection sender = senders[0]; Assert.IsNotNull(sender); Assert.AreEqual(new Guid("{A81631A6-6AA3-45f7-AADD-4853447E5BD6}"), sender.Identifier); Assert.AreEqual("Financial Users", sender.Name.Value); Assert.AreEqual(4, sender.Count); Assert.AreEqual("James", sender[0].Name.Value); Assert.AreEqual("[email protected]", sender[0].Content); Assert.AreEqual("Jane", sender[1].Name.Value); Assert.AreEqual("[email protected]", sender[1].Content); Assert.AreEqual("Ann", sender[2].Name.Value); Assert.AreEqual("[email protected]", sender[2].Content); Assert.AreEqual("Sally", sender[3].Name.Value); Assert.AreEqual("[email protected]", sender[3].Content); IRoutingItemCollections recipients = smtpRouting.Destinations; Assert.IsNotNull(recipients); Assert.AreEqual(2, recipients.Count); IRoutingItemCollection recipient = recipients[0]; Assert.IsNotNull(recipient); Assert.AreEqual("Sales and Finance", recipient.Name.Value); recipient = recipients[1]; Assert.AreEqual("Training", recipient.Name.Value); }
private void ShowPanelForChannel(IPolicyChannel channel) { this.descriptiontxt.Text = channel["Description"]; RoutingTableManager manager = new RoutingTableManager(channel); manager.DisplayControl += new DisplayControlDelegate(manager_DisplayControl); Control ctrl = manager.GetRoutingTableControl(); this.controlpnl1.Height = ctrl.Height; ctrl.Dock = DockStyle.Fill; ctrl.Parent = this.controlpnl1; this.controlpnl2.Height = 0; //For the conditions on the actions, the condition control will be displayed in the 2nd panel /*ConditionControl conditioncontrol = new ConditionControl(null); this.controlpnl2.Height = conditioncontrol.Height; conditioncontrol.Dock = DockStyle.Fill; conditioncontrol.Parent = this.controlpnl2;*/ }
public void RemoveAction(IPolicyChannel channel, Routing routing, IAction action) { switch (routing) { case Routing.Internal: RemoveInternalAction(channel, action); break; case Routing.External: RemoveExternalAction(channel, action); break; default: throw new System.Exception(Properties.Resources.ERROR_UNKNOWN_ROUTING_TYPE); } }
private void ValidateChannel2(IPolicyChannel channel) { Assert.IsNotNull(channel); Assert.AreEqual(new Guid("{B28CD900-603B-4FE7-9994-EE2B7BCAD2F8}"), channel.Identifier); Assert.AreEqual("File Transfer PolicySets", channel.Name.Value); IRoutingTable smtpRouting = channel.Routing; Assert.IsNotNull(smtpRouting, "Expected the routing table type to be SMTP"); Assert.AreEqual(new Guid("{533515D4-A339-419D-A4AC-8642BBFF4C82}"), smtpRouting.Identifier); Assert.AreEqual("Internal legal users", smtpRouting.Name.Value); Assert.IsNotNull(smtpRouting.Sources, "Expected a valid sources collection"); Assert.AreEqual(3, smtpRouting.Sources.Count); Assert.IsNotNull(smtpRouting.Destinations, "Expected a valid destinations collection"); Assert.AreEqual(2, smtpRouting.Destinations.Count); }
private SortedList<int, IAction> GetInternalActions(IPolicyChannel channel) { SortedList<int, IAction> internalActions = new SortedList<int, IAction>(); IRoutingTable routing = channel.Routing; if (null == routing) return internalActions; Guid trustedSourceId = routing.DefaultSource.Identifier; Guid trustedDestinationId = Guid.Empty; foreach (IRoutingItemCollection destination in routing.Destinations) { if ("true" == destination["DefaultGroup"].Value.ToLower(System.Globalization.CultureInfo.InvariantCulture)) continue; trustedDestinationId = destination.Identifier; } IRoutingMatrixCell routingMatrixCell = routing[trustedSourceId, trustedDestinationId]; if (routingMatrixCell == null) return internalActions; IActionMatrixCell actionMatrixCell = channel.Actions[trustedSourceId, trustedDestinationId]; if (actionMatrixCell == null) return internalActions; foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups) { foreach (IAction action in actionCondtionGroup.ActionGroup.Actions) { internalActions.Add(action.Precedence, action); } } return internalActions; }
private static bool ValidateRoutingItemCollections(string policyName, IPolicyChannel channel, PolicySetValidator.AddViolationMessageHandler AddMessage) { bool valid = true; if (channel.Type == ChannelType.SMTP || channel.Type == ChannelType.RemoveableDevice) { IRoutingTable routingTable = channel.Routing; IRoutingItemCollection defaultSource = null; if (routingTable.HasDefaultSources) { defaultSource = routingTable.DefaultSource; } foreach (IRoutingItemCollection routingItemCollection in routingTable.Sources) { if (routingItemCollection != defaultSource) { if (routingItemCollection.Count == 0) { string msg = string.Format(CultureInfo.InvariantCulture, Properties.Resources.VALIDATION_INTRAPOLICY_ROUTING_NOSENDERS, routingItemCollection.Name.Value, Workshare.Policy.UI.DisplayTranslations.ChannelTypeDisplayTranslator.Instance.GetDisplayType(routingTable.Type)); if (null != AddMessage) AddMessage(policyName, msg, true); valid = false; } } } IRoutingItemCollection defaultDestination = null; if (routingTable.HasDefaultDestinations) { defaultDestination = routingTable.DefaultDestination; } foreach (IRoutingItemCollection routingItemCollection in routingTable.Destinations) { if (routingItemCollection != defaultDestination) { if (routingItemCollection.Count == 0) { string msg = string.Format(CultureInfo.InvariantCulture, Properties.Resources.VALIDATION_INTRAPOLICY_ROUTING_NORECIPIENTS, routingItemCollection.Name.Value, Workshare.Policy.UI.DisplayTranslations.ChannelTypeDisplayTranslator.Instance.GetDisplayType(routingTable.Type)); if (null != AddMessage) AddMessage(policyName, msg, true); valid = false; } } } } return valid; }
public int GetCountInternalActions(IPolicyChannel channel) { return GetInternalActions(channel).Count; }
public bool IsLDAPRouting(IPolicyChannel channel) { //IRoutingTable routing = channel.Routing; //if ((routing.Sources.Count != 1) || (routing.Destinations.Count != 2)) // return true; //else if ((routing.Sources.Count == 1) || (routing.Destinations.Count == 2)) //{ // if ((routing.Sources[0].Name.Value != "Everyone") || // (routing.Destinations[0].Name.Value != "Internal Recipients") || // (routing.Destinations[1].Name.Value != "External Recipients")) // return true; //} return false; }
/// <summary> /// Removes a Channel from a policy set's master catalogue /// </summary> /// <param name="policySet">The policy set from whose catalogue we will remove the Channel</param> /// <param name="channel">The Channel to remove</param> private static void RemoveChannel(IPolicySet policySet, IPolicyChannel channel) { if (null == policySet || null == channel) { return; } IRoutingTable routingTable = channel.Routing; foreach(IRoutingItemCollection sender in routingTable.Sources) { foreach (IRoutingItemCollection recipient in routingTable.Destinations) { if (channel.Actions.HasCell(sender, recipient)) { IActionMatrixCell cell = channel.Actions[sender, recipient]; foreach (IActionConditionGroup actionConditionGroup in cell.ActionConditionGroups) { RemoveConditionGroup(policySet, actionConditionGroup); } } } } //remove routing table RemoveRoutingTable(policySet, channel.Routing); IChannel channelInCatalogue = policySet.MasterCatalogue.Channels[channel.Identifier]; policySet.MasterCatalogue.Channels.Remove(channelInCatalogue); }
//public MatrixTableControl() public MatrixTableControl(IPolicyChannel policyChannel) { InitializeComponent(); m_policyChannel = policyChannel; }
protected void ChangeRoutingType() { if (!RoutingHelper.SupportedRoutingTypes(m_channel.Type).Contains(m_requestedRoutingType)) { ArgumentException ex = new ArgumentException("channel does not support routing type selection"); Logger.LogError(ex.Message); throw ex; } if (DialogResult.Yes == MessageBox.Show(Properties.Resources.ROUTINGTYPE_CHANGE_CONFIRMATION, Properties.Resources.ROUTINGTYPE_CHANGE, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2)) { IPolicyChannel newChannel = ChannelFactory.CreateChannel(m_channel.Name.Value, m_channel.Type, m_requestedRoutingType); m_policy.Channels.Remove(m_channel); MasterCatalogueUtils.RemovePolicyObjectFromCatalogue(m_policy.PolicySet, m_channel); m_channel = newChannel; m_policy.Channels.Add(m_channel); StateMachine.ChildForm.IsModified = true; StateMachine.ChildForm.TreeViewController.Display(); } }
public static List<CellActionsCollection> GetActions(IPolicyChannel channel, IPolicySet policyset, bool checkForAllowInterpolicyDuplicates) { List<CellActionsCollection> returnVal = new List<CellActionsCollection>(); IActionMatrix matrix = channel.Actions; IActionMatrixCell cell = null; if (matrix.HasOffline) { CellActionsCollection collection = new CellActionsCollection(); collection.Actions = ExtractActionsFromActionGroups(matrix.Offline.ActionConditionGroups, policyset, checkForAllowInterpolicyDuplicates); collection.ChannelType = channel.Type; returnVal.Add(collection); } switch (ExpressionHelpers.GetRoutingType(channel.Routing)) { case ExpressionHelpers.RoutingType.Undefined: return returnVal; case ExpressionHelpers.RoutingType.SingleCell: IRoutingTable singleCelledRoutingTable = channel.Routing as IRoutingTable; cell = channel.Actions[singleCelledRoutingTable.DefaultSource, singleCelledRoutingTable.DefaultDestination]; if (null == cell) return returnVal; CellActionsCollection collection = new CellActionsCollection(); collection.Actions = ExtractActionsFromActionGroups(cell.ActionConditionGroups, policyset, checkForAllowInterpolicyDuplicates); collection.ChannelType = channel.Type; returnVal.Add(collection); break; default: IRoutingTable multiCelledRoutingTable = channel.Routing; foreach (IRoutingItemCollection sender in multiCelledRoutingTable.Sources) { foreach (IRoutingItemCollection recipient in multiCelledRoutingTable.Destinations) { cell = channel.Actions[sender, recipient]; if (null == cell) continue; collection = new CellActionsCollection(); collection.Actions = ExtractActionsFromActionGroups(cell.ActionConditionGroups, policyset, checkForAllowInterpolicyDuplicates); collection.ChannelType = channel.Type; returnVal.Add(collection); } } break; } return returnVal; }
private void RemoveExternalAction(IPolicyChannel channel, IAction action) { IRoutingTable routing = channel.Routing; if (routing == null) throw new System.Exception("Invalid routing table"); Guid unprivDestinationId = routing.DefaultDestination.Identifier; Guid unprivSourceId = routing.DefaultSource.Identifier; IRoutingMatrixCell routingMatrixCell = routing[unprivSourceId, unprivDestinationId]; if (routingMatrixCell == null) return; // No Routing IActionMatrixCell actionMatrixCell = channel.Actions[unprivSourceId, unprivDestinationId]; if (actionMatrixCell == null) return; // No Actions foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups) { IPolicyObjectCollection<IAction> actions = actionCondtionGroup.ActionGroup.Actions; foreach (IAction act in actions) { if (action.Assembly == act.Assembly) { actions.Remove(act); return; } } } }
public RoutingMatrixEventArgs(IPolicyChannel channel, IRoutingItemCollections addressGroup, IRoutingItemCollection addressCollection) { m_channel = channel; m_addressGroup = addressGroup; m_addressCollection = addressCollection; }
public static void RemoveCollectionFromAddressGroup(IPolicyChannel channel, IRoutingItemCollections addressGroup, IRoutingItemCollection addressCollection) { IRoutingTable routingTable = channel.Routing; if (null == routingTable) { return; } if (AddressCollectionHelper.AllowCollectionDelete(routingTable, addressCollection)) { if (Object.ReferenceEquals(routingTable.Sources, addressGroup)) { // Removing location collection from sources group routingTable.Sources.Remove(addressCollection); //remove cells from action matrix foreach (IRoutingItemCollection recipient in routingTable.Destinations) { if (channel.Actions.HasCell(addressCollection, recipient)) { RemoveCellFromActionMatrix(channel.Actions, addressCollection, recipient); } } if (1 == routingTable.Sources.Count) { IRoutingItemCollection defaultSenders = routingTable.DefaultSource; defaultSenders.Name.Value = Properties.Resources.ROUTING_EVERYONE; } } else if (Object.ReferenceEquals(routingTable.Destinations, addressGroup)) { // Removing location collection from destinations group routingTable.Destinations.Remove(addressCollection); //remove cells from action matrix foreach (IRoutingItemCollection recipient in routingTable.Destinations) { if (channel.Actions.HasCell(addressCollection, recipient)) { RemoveCellFromActionMatrix(channel.Actions, addressCollection, recipient); } } if (1 == routingTable.Destinations.Count) { IRoutingItemCollection defaultRecipients = routingTable.DefaultDestination; defaultRecipients.Name.Value = Properties.Resources.ROUTING_EVERYONE; } } else { // group is neither sources nor destinations Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage( "ADDRESSGROUPTYPE_INVALID", "Workshare.PolicyDesigner.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly()); Logger.LogError(errorMessage.LogString); throw new ArgumentException(errorMessage.DisplayString); } RefreshRoutingMatrixTablePrecedences(routingTable); } }
public SortedList<int, IAction> GetChannelActions(IPolicyChannel channel, Routing routing) { SortedList<int, IAction> actions = new SortedList<int, IAction>(); switch (routing) { case Routing.External: actions = GetExternalActions(channel); break; case Routing.Internal: actions = GetInternalActions(channel); break; default: throw new System.Exception("Unknown routing."); } return actions; }
public RoutingTableManager(IPolicyChannel channel) { m_Table = channel.Routing; m_tablecontrol.OnLinkLabelClicked += new MatrixTableControl.OnLinkLabelClickedHandler(m_tablecontrol_OnLinkLabelClicked); m_tablecontrol.OnContentCellClicked += new MatrixTableControl.OnContentCellClickedHandler(m_tablecontrol_OnContentCellClicked); }
private void AddChannel(IPolicyChannel channel, List<CustomGXNode> channels, List<IPolicyChannel> policychannels) { foreach (IPolicyChannel duplicate in policychannels) { if (channel.Name == duplicate.Name) return; } policychannels.Add(channel); CustomGXNode node = new CustomGXNode(channel.Name, channel); node.Style = DevComponents.Tree.NodeStyles.PurpleMist; //MatrixTableControl routingTableControl = new MatrixTableControl(channel); //routingTableControl.Refresh(); //TreeGxNodeControl control = new TreeGxNodeControl(channel.Name, routingTableControl, Color.FromArgb(198, 186, 206)); //node.HostedControl = control; channels.Add(node); /*foreach (IRoutingTable table in channel.Routing) { DevComponents.Tree.Node senders = new DevComponents.Tree.Node(); senders.Text = "Senders"; node.Nodes.Add(senders); DevComponents.Tree.Node receivers = new DevComponents.Tree.Node(); receivers.Text = "Receivers"; node.Nodes.Add(receivers); AddAddresses(senders, table.Senders); AddAddresses(receivers, table.Recipients); }*/ }
private void RemoveInternalAction(IPolicyChannel channel, IAction action) { IRoutingTable routing = channel.Routing; if (null == routing) throw new System.Exception("Invalid routing table"); Guid trustedSourceId = routing.DefaultSource.Identifier; Guid trustedDestinationId = Guid.Empty; foreach (IRoutingItemCollection destination in routing.Destinations) { if ("true" == destination["DefaultGroup"].Value.ToLower(System.Globalization.CultureInfo.InvariantCulture)) continue; trustedDestinationId = destination.Identifier; } IRoutingMatrixCell routingMatrixCell = routing[trustedSourceId, trustedDestinationId]; if (routingMatrixCell == null) return; // No Routing IActionMatrixCell actionMatrixCell = channel.Actions[trustedSourceId, trustedDestinationId]; if (actionMatrixCell == null) return; // No Actions foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups) { IPolicyObjectCollection<IAction> actions = actionCondtionGroup.ActionGroup.Actions; foreach (IAction act in actions) { if (action.Assembly == act.Assembly) { actions.Remove(act); return; } } } }