コード例 #1
0
        public async Task <JsonResult> Save(PlatformConstant id, long specId, long?justificationId, SimplePortDirectionTypeConstant direction, PortTypeConstant portType,
                                            string justification, string ports)
        {
            if (!_justificationFactory.IsValidText(justification))
            {
                return(Json(JsonEnvelope.Error("The Justifcation cannot be empty whitespace.")));
            }

            if (!justificationId.HasValue)
            {
                Logger.LogInformation($"{UserSecurity.SamAccountName} added a new justification for ports: {justification}");
                justificationId =
                    await _justificationFactory.AddJustification(JustificationTypeConstant.Port, specId, justification);
            }
            else
            {
                Logger.LogInformation($"{UserSecurity.SamAccountName} updated justification {justificationId} for ports: {justification}");
                await _justificationFactory.UpdateJustification(justificationId.Value, justification);
            }

            await _portFactory.AddOrUpdatePorts(specId, justificationId.Value, direction == SimplePortDirectionTypeConstant.PortListeningToOutsideTraffic, direction == SimplePortDirectionTypeConstant.SendingTrafficToOusidePort, portType, ports);

            Logger.LogInformation($"{UserSecurity.SamAccountName} added or updated ports for spec {specId} ports are: {ports}");
            return(Json(JsonEnvelope.Success(new { url = Url.PartialOnePort(id, specId, justificationId.Value) })));
        }
コード例 #2
0
        private static void RecurseSpecs(BuildSpecification spec, bool runningCoreOs, PciScopeConstant pciScope,
                                         int environmentId, out List <Port> ports, out List <SoftwareComponent> softwares,
                                         out string osName, out string osVersion, ref PlatformConstant pt)
        {
            softwares = new List <SoftwareComponent>();
            ports     = new List <Port>();
            osName    = spec.OperatingSystemName;
            osVersion = spec.OperatingSystemVersion;
            var it = spec;

            while (it != null)
            {
                osName    = it.OperatingSystemName;
                osVersion = it.OperatingSystemVersion;
                var softToAdd = runningCoreOs
                    ? it.SoftwareComponents.Where(p => !p.NonCore)
                    : it.SoftwareComponents;
                softToAdd = softToAdd.Where(p => p.PciScope == null || (p.PciScope & pciScope) != 0);
                softToAdd = softToAdd.Where(p => !p.SoftwareComponentEnvironments.Any() || p.SoftwareComponentEnvironments.Any(q => q.EnvironmentId == environmentId));
                softwares.AddRange(softToAdd);
                ports.AddRange(it.Ports.Where(p => !p.IsOutgoing));
                if (it.Platform.HasValue)
                {
                    pt = it.Platform.Value;
                }
                it = it.Parent;
            }
        }
コード例 #3
0
 public OsSpecSearchResult(long id, string name, long ownerId, string owner, PlatformConstant platform, Counts counts)
 {
     Id       = id;
     Name     = name;
     OwnerId  = ownerId;
     Owner    = owner;
     Platform = platform;
     Counts   = counts;
 }
コード例 #4
0
 public OwnerScoreCardRow(long id, string specName, long?parentId, string parentName, BuildSpecificationTypeConstant buildSpecificationType, PlatformConstant platform, int nodeCount, int passingNodeCount, int failingNodeCount,
                          ScoreCardCount totalSoftwareCount, ScoreCardCount unjustifiedSoftwareCount, ScoreCardCount portCount)
 {
     Id                       = id;
     SpecName                 = specName;
     ParentId                 = parentId;
     ParentName               = parentName;
     BuildSpecificationType   = buildSpecificationType;
     Platform                 = platform;
     NodeCount                = nodeCount;
     PassingNodeCount         = passingNodeCount;
     FailingNodeCount         = failingNodeCount;
     TotalSoftwareCount       = totalSoftwareCount;
     UnjustifiedSoftwareCount = unjustifiedSoftwareCount;
     PortCount                = portCount;
 }
コード例 #5
0
 public NodeSearchResult(long id, string fqdn, string owner, string product, string function, PciScopeConstant pciScope, int environmentId, string environmentName, string environmentDescription, string environmentColor, PlatformConstant platform, long?buildSpecId, string buildSpecName, ComplianceStatusConstant complianceStatus, DateTime?lastComplianceDate, Guid?chefId, bool showButtons)
 {
     Id                     = id;
     Fqdn                   = fqdn;
     Owner                  = owner;
     Product                = product;
     Function               = function;
     SecurityClass          = pciScope.ToString();
     EnvironmentDescription = environmentDescription;
     EnvironmentColor       = environmentColor;
     EnvironmentName        = environmentName;
     EnvironmentId          = environmentId;
     Platform               = platform;
     BuildSpecId            = buildSpecId;
     BuildSpecName          = buildSpecName;
     ComplianceStatus       = complianceStatus;
     LastComplianceDate     = lastComplianceDate;
     ChefId                 = chefId;
     ShowButtons            = showButtons;
 }
コード例 #6
0
 public static string PartialBulkNewPorts(this IUrlHelper helper, PlatformConstant platform, long specId)
 {
     return(helper.RouteUrl("default", new { controller = "Ports", action = "Bulk", id = platform, specId }));
 }
コード例 #7
0
 public static string PartialPortsScreen(this IUrlHelper helper, PlatformConstant platform)
 {
     return(helper.RouteUrl("default", new { controller = "Ports", action = "ForSpec", id = platform }));
 }
コード例 #8
0
 public static IQueryable<Node> ByPlatform(this IQueryable<Node> nodes, PlatformConstant platform)
 {
     return nodes.Where(p => p.Platform == platform);
 }
コード例 #9
0
 public ViewPort(PlatformConstant platform, long specId, SimplePort port) : base(platform, specId, port)
 {
 }
コード例 #10
0
 public PortsScreen(PlatformConstant platform, long specId)
 {
     Platform = platform;
     SpecId   = specId;
 }
コード例 #11
0
        public async Task <PartialViewResult> One(PlatformConstant id, long specId, long justificationId)
        {
            var port = await _portFactory.GetPort(justificationId);

            return(PartialView(new ViewPort(id, specId, port)));
        }
コード例 #12
0
        public async Task <PartialViewResult> Get(PlatformConstant id, long specId)
        {
            var ports = await _portFactory.GetPorts(specId);

            return(PartialView(new SimplePorts(id, ports.Select(p => new ViewPort(id, specId, p)))));
        }
コード例 #13
0
 public PartialViewResult ForSpec(PlatformConstant id, long specId)
 {
     return(PartialView(new PortsScreen(id, specId)));
 }
コード例 #14
0
 public SimplePorts(PlatformConstant platform, IEnumerable <ViewPort> ports) : base(ports)
 {
     Platform = platform;
 }
コード例 #15
0
 public static string JsonSavePort(this IUrlHelper helper, PlatformConstant platform)
 {
     return(helper.RouteUrl("default", new { controller = "Ports", action = "Save", id = platform }));
 }
コード例 #16
0
 public static string PartialOnePort(this IUrlHelper helper, PlatformConstant platform, long specId, long justificationId)
 {
     return(helper.RouteUrl("default", new { controller = "Ports", action = "One", id = platform, specId, justificationId }));
 }
コード例 #17
0
 public PartialViewResult New(PlatformConstant id, long specId)
 {
     return(PartialView(new NewPort(id, specId)));
 }
コード例 #18
0
 public NewPort(PlatformConstant platform, long specId)
 {
     Platform = platform;
     SpecId   = specId;
 }
コード例 #19
0
 public PartialViewResult Bulk(PlatformConstant id, long specId)
 {
     return(PartialView(new BulkNewPorts(id, specId)));
 }
コード例 #20
0
 public BulkNewPorts(PlatformConstant platform, long specId) : base(platform, specId)
 {
 }
コード例 #21
0
 public EditPort(PlatformConstant platform, long specId, SimplePort port) : base(platform, specId)
 {
     Port = port;
 }