コード例 #1
0
        public static void AddTrustBoundaryTemplateRule(this IRuleEditor ruleEditor, [NotNull] IThreatModel model)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(Scope.AnyTrustBoundary),
                ImagePosition = eImagePosition.Left,
                Text          = "Trust Boundary Template",
                Tooltip       = "Flow crossing a Trust Boundary derived from a specific Template.\nEvaluates to false if the object is not a flow.",
                Tag           = new TrustBoundaryTemplateItemContext(model, Scope.AnyTrustBoundary)
            };

            ruleEditor.AddButton(item, Scope.AnyTrustBoundary);
        }
コード例 #2
0
        public static void AddOutgoingRule(this IRuleEditor ruleEditor, Scope scope = Scope.Object)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(scope),
                ImagePosition = eImagePosition.Left,
                Text          = "Outgoing Flows",
                Tooltip       = "One or more outgoing flows to a specific entity type.\nEvaluates to false if the object is a flow.",
                Tag           = new FlowsItemContext(false, scope)
            };

            ruleEditor.AddButton(item, scope);
        }
コード例 #3
0
        public static void AddFlowTemplateRule(this IRuleEditor ruleEditor, [NotNull] IThreatModel model)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(Scope.Object),
                ImagePosition = eImagePosition.Left,
                Text          = "Flow Template",
                Tooltip       = "Flow derived from a specific Flow Template.\nEvaluates to false if the object is a not a Flow\nor is not derived from a Flow Template.",
                Tag           = new FlowTemplateItemContext(model, Scope.Object)
            };

            ruleEditor.AddButton(item, Scope.Object);
        }
コード例 #4
0
        public static void AddDataStoreTemplateRule(this IRuleEditor ruleEditor, [NotNull] IThreatModel model, Scope scope = Scope.Object)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(scope),
                ImagePosition = eImagePosition.Left,
                Text          = "Data Store Template",
                Tooltip       = "Object derived from a specific Data Store Template.\nEvaluates to false if the object is a Flow,\na Trust Boundary or is not derived from a Data Store Template.",
                Tag           = new DataStoreTemplateItemContext(model, scope)
            };

            ruleEditor.AddButton(item, scope);
        }
コード例 #5
0
        public static void  AddPropertyRule(this IRuleEditor ruleEditor, [NotNull] IPropertyType propertyType,
                                            [NotNull] IPropertySchema schema, Scope scope = Scope.Object)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(scope),
                ImagePosition = eImagePosition.Left,
                Text          = propertyType.Name,
                Tooltip       = $"Name = {propertyType.Name}\nSchema = {schema.Name}\nNamespace = {schema.Namespace}",
                Tag           = new PropertyTypeItemContext(propertyType, scope)
            };

            ruleEditor.AddButton(item, scope);
        }
コード例 #6
0
        public static void AddEnumValueRule(this IRuleEditor ruleEditor, [NotNull] string propertyName,
                                            [NotNull] IEnumerable <string> names, Scope scope = Scope.Object)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(scope),
                ImagePosition = eImagePosition.Left,
                Text          = propertyName,
                Tooltip       = "Select a value among the available ones.",
                Tag           = new EnumValueItemContext(names, scope)
            };

            ruleEditor.AddButton(item, scope);
        }
コード例 #7
0
        public static void AddCrossTrustBoundaryRule(this IRuleEditor ruleEditor,
                                                     [NotNull] string propertyName, Scope scope = Scope.Object)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(scope),
                ImagePosition = eImagePosition.Left,
                Text          = propertyName,
                Tooltip       = propertyName,
                Tag           = new CrossTrustBoundaryItemContext()
            };

            ruleEditor.AddButton(item, scope);
        }
コード例 #8
0
        public static void AddComparisonRule(this IRuleEditor ruleEditor,
                                             [NotNull] string propertyName, Scope scope = Scope.Object)
        {
            ButtonItem item = new ButtonItem()
            {
                ButtonStyle   = eButtonStyle.ImageAndText,
                Image         = GetImage(scope),
                ImagePosition = eImagePosition.Left,
                Text          = propertyName,
                Tooltip       = "Search for objects with a specific text",
                Tag           = new ComparisonItemContext(scope)
            };

            ruleEditor.AddButton(item, scope);
        }
コード例 #9
0
        private async Task EditRule(IRule parameter)
        {
            IRuleEditor editor = null;

            switch (parameter.Rule)
            {
            case Rule.AD_DontImportUser: editor = new AD_DontImportUser(parameter); break;
            }
            if (editor != null)
            {
                await DialogHost.Show(
                    editor,
                    "RootDialog"
                    ).ConfigureAwait(false);
            }
        }
コード例 #10
0
        private async Task EditRule(IRule parameter)
        {
            var rule = parameter as IRule;

            IRuleEditor editor = null;

            switch (rule.Rule)
            {
            case Rule.SS_DiscardGroup: editor = new Views.Dialogs.SS_DiscardGroupEditor(rule); break;

            case Rule.SS_NoSubGroups: editor = new Views.Dialogs.SS_DiscardSubGroupEditor(rule); break;
            }

            if (editor != null)
            {
                await DialogHost.Show(
                    editor,
                    "RootDialog"
                    );
            }
        }
コード例 #11
0
        private async Task EditRule(IRule parameter)
        {
            IRuleEditor editor = null;

            switch (parameter.Rule)
            {
            case Rule.WI_ReplaceInstitution: editor = new WI_ReplaceInstitute(parameter); break;

            case Rule.WI_DontImportClass: editor = new WI_DontImportClass(parameter); break;

            case Rule.WI_MarkAsVirtual: editor = new WI_MarkAsVirtual(parameter); break;

            case Rule.WI_DontImportUser: editor = new WI_DontImportUser(parameter); break;
            }
            if (editor != null)
            {
                await DialogHost.Show(
                    editor,
                    "RootDialog"
                    ).ConfigureAwait(false);
            }
        }