Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }