From 4d58fd3970b805587249cc981b0d1707ae42b5f0 Mon Sep 17 00:00:00 2001 From: BuildFeed Bot Date: Mon, 14 Jan 2019 20:23:39 +0000 Subject: [PATCH] Allow editors to use bulk add; Add sanitised dump tool --- BuildFeed.sln | 24 +++++++-- BuildFeed/Controllers/frontController.cs | 4 +- BuildFeed/Views/shared/_default.cshtml | 3 -- DumpJson/App.config | 9 ++++ DumpJson/DumpJson.csproj | 69 ++++++++++++++++++++++++ DumpJson/Program.cs | 41 ++++++++++++++ DumpJson/Properties/AssemblyInfo.cs | 36 +++++++++++++ DumpJson/packages.config | 4 ++ 8 files changed, 182 insertions(+), 8 deletions(-) create mode 100644 DumpJson/App.config create mode 100644 DumpJson/DumpJson.csproj create mode 100644 DumpJson/Program.cs create mode 100644 DumpJson/Properties/AssemblyInfo.cs create mode 100644 DumpJson/packages.config diff --git a/BuildFeed.sln b/BuildFeed.sln index a687b73..7c49207 100644 --- a/BuildFeed.sln +++ b/BuildFeed.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28407.52 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildFeed", "BuildFeed\BuildFeed.csproj", "{CDDCF754-ECAA-4A66-ADAA-62957A57A51B}" ProjectSection(ProjectDependencies) = postProject @@ -25,7 +25,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildFeed.Local", "BuildFeed.Local\BuildFeed.Local.csproj", "{9EBD4DB1-1D37-456B-AD90-357AA89DD1B7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildFeed.Local", "BuildFeed.Local\BuildFeed.Local.csproj", "{9EBD4DB1-1D37-456B-AD90-357AA89DD1B7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpJson", "DumpJson\DumpJson.csproj", "{6F516C0F-3543-4DF8-833A-0259603A49CC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -127,6 +129,22 @@ Global {9EBD4DB1-1D37-456B-AD90-357AA89DD1B7}.Release|x64.Build.0 = Release|Any CPU {9EBD4DB1-1D37-456B-AD90-357AA89DD1B7}.Release|x86.ActiveCfg = Release|Any CPU {9EBD4DB1-1D37-456B-AD90-357AA89DD1B7}.Release|x86.Build.0 = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|ARM.Build.0 = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|x64.ActiveCfg = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|x64.Build.0 = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|x86.ActiveCfg = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Debug|x86.Build.0 = Debug|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|Any CPU.Build.0 = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|ARM.ActiveCfg = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|ARM.Build.0 = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|x64.ActiveCfg = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|x64.Build.0 = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|x86.ActiveCfg = Release|Any CPU + {6F516C0F-3543-4DF8-833A-0259603A49CC}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BuildFeed/Controllers/frontController.cs b/BuildFeed/Controllers/frontController.cs index 86f354c..7a1a0a5 100644 --- a/BuildFeed/Controllers/frontController.cs +++ b/BuildFeed/Controllers/frontController.cs @@ -553,12 +553,12 @@ namespace BuildFeed.Controllers } [Route("bulk/")] - [Authorize(Roles = "Administrators")] + [Authorize(Roles = "Administrators,Editors")] public ActionResult AddBulk() => View(); [Route("bulk/")] [ValidateAntiForgeryToken] - [Authorize(Roles = "Administrators")] + [Authorize(Roles = "Administrators,Editors")] [HttpPost] public async Task AddBulk(FormCollection values) { diff --git a/BuildFeed/Views/shared/_default.cshtml b/BuildFeed/Views/shared/_default.cshtml index f4e1d73..f4a3ace 100644 --- a/BuildFeed/Views/shared/_default.cshtml +++ b/BuildFeed/Views/shared/_default.cshtml @@ -173,9 +173,6 @@ @VariantTerms.Common_AddBuild - } - if (Roles.IsUserInRole("Administrators")) - {
  • + + + + + + + + \ No newline at end of file diff --git a/DumpJson/DumpJson.csproj b/DumpJson/DumpJson.csproj new file mode 100644 index 0000000..e1b661e --- /dev/null +++ b/DumpJson/DumpJson.csproj @@ -0,0 +1,69 @@ + + + + + Debug + AnyCPU + {6F516C0F-3543-4DF8-833A-0259603A49CC} + Exe + DumpJson + DumpJson + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + latest + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + latest + + + + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + {9ebd4db1-1d37-456b-ad90-357aa89dd1b7} + BuildFeed.Local + + + {7e2b4f61-1c11-4471-af80-5480e94c0664} + BuildFeed.Model + + + + \ No newline at end of file diff --git a/DumpJson/Program.cs b/DumpJson/Program.cs new file mode 100644 index 0000000..f9dd080 --- /dev/null +++ b/DumpJson/Program.cs @@ -0,0 +1,41 @@ +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using BuildFeed.Model; +using Newtonsoft.Json; + +namespace DumpJson +{ + internal class Program + { + public static async Task Main(string[] args) + { + var bRepo = new BuildRepository(); + var builds = (await bRepo.Select()).Select(b => new + { + b.MajorVersion, + b.MinorVersion, + b.Number, + b.Revision, + b.Lab, + b.BuildTime, + + b.Family, + + b.SourceType, + b.SourceDetails, + b.LeakDate, + + b.FullBuildString, + b.AlternateBuildString, + }); + + string outJson = JsonConvert.SerializeObject(builds, Formatting.Indented); + + using (TextWriter writer = File.CreateText("output.json")) + { + writer.Write(outJson); + } + } + } +} diff --git a/DumpJson/Properties/AssemblyInfo.cs b/DumpJson/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5549339 --- /dev/null +++ b/DumpJson/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DumpJson")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DumpJson")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6f516c0f-3543-4df8-833a-0259603a49cc")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DumpJson/packages.config b/DumpJson/packages.config new file mode 100644 index 0000000..97c22dc --- /dev/null +++ b/DumpJson/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file