Skip to content

Commit f306e8c

Browse files
committed
Initial port commit
1 parent 811b704 commit f306e8c

File tree

729 files changed

+55978
-3417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

729 files changed

+55978
-3417
lines changed

Bonobo.Git.Server.sln

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2009
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonobo.Git.Server", "Bonobo.Git.Server\Bonobo.Git.Server.csproj", "{6129B3FE-B282-4F6F-8836-8AF66602F8DA}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bonobo.Git.Server", "Bonobo.Git.Server\Bonobo.Git.Server.csproj", "{6129B3FE-B282-4F6F-8836-8AF66602F8DA}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonobo.Git.Server.Test", "Bonobo.Git.Server.Test\Bonobo.Git.Server.Test.csproj", "{0B124D88-5C2B-47AD-B660-434B709A0DFF}"
99
EndProject
@@ -30,11 +30,12 @@ Global
3030
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
3131
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
3232
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Release|x86.ActiveCfg = Release|Any CPU
33-
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Any CPU.ActiveCfg = Test|Any CPU
34-
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Any CPU.Build.0 = Test|Any CPU
35-
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Mixed Platforms.ActiveCfg = Test|Any CPU
36-
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Mixed Platforms.Build.0 = Test|Any CPU
37-
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|x86.ActiveCfg = Test|Any CPU
33+
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Any CPU.ActiveCfg = Release|Any CPU
34+
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Any CPU.Build.0 = Release|Any CPU
35+
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Mixed Platforms.ActiveCfg = Release|Any CPU
36+
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|Mixed Platforms.Build.0 = Release|Any CPU
37+
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|x86.ActiveCfg = Release|Any CPU
38+
{6129B3FE-B282-4F6F-8836-8AF66602F8DA}.Test|x86.Build.0 = Release|Any CPU
3839
{0B124D88-5C2B-47AD-B660-434B709A0DFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3940
{0B124D88-5C2B-47AD-B660-434B709A0DFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
4041
{0B124D88-5C2B-47AD-B660-434B709A0DFF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -55,6 +56,7 @@ Global
5556
HideSolutionNode = FALSE
5657
EndGlobalSection
5758
GlobalSection(ExtensibilityGlobals) = postSolution
59+
SolutionGuid = {451ECF4B-DC19-4E9A-9D02-DA13796309D7}
5860
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.2\lib\NET35
5961
EndGlobalSection
6062
EndGlobal

Bonobo.Git.Server/.bowerrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory" : "Content/components"
3-
}
2+
"directory": "wwwroot/lib"
3+
}

Bonobo.Git.Server/App_Data/Repositories/note.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

Bonobo.Git.Server/App_Data/Web.config

Lines changed: 0 additions & 12 deletions
This file was deleted.

Bonobo.Git.Server/App_GlobalResources/Resources.it-IT.designer.cs

Whitespace-only changes.

Bonobo.Git.Server/App_GlobalResources/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema

Bonobo.Git.Server/App_Start/BundleConfig.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 102 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,102 @@
1-
using System;
2-
using System.Web.Mvc;
3-
using System.Web.Routing;
4-
5-
namespace Bonobo.Git.Server.App_Start
6-
{
7-
public class RouteConfig
8-
{
9-
public static void RegisterRoutes(RouteCollection routes)
10-
{
11-
routes.MapRoute("SecureInfoRefs",
12-
"{repositoryName}.git/info/refs",
13-
new { controller = "Git", action = "SecureGetInfoRefs" },
14-
new { method = new HttpMethodConstraint("GET") });
15-
16-
routes.MapRoute("SecureUploadPack",
17-
"{repositoryName}.git/git-upload-pack",
18-
new { controller = "Git", action = "SecureUploadPack" },
19-
new { method = new HttpMethodConstraint("POST") });
20-
21-
routes.MapRoute("SecureReceivePack",
22-
"{repositoryName}.git/git-receive-pack",
23-
new { controller = "Git", action = "SecureReceivePack" },
24-
new { method = new HttpMethodConstraint("POST") });
25-
26-
routes.MapRoute("GitBaseUrl",
27-
"{repositoryName}.git",
28-
new { controller = "Git", action = "GitUrl" },
29-
new { method = new HttpMethodConstraint("GET") });
30-
31-
routes.MapRoute("IndexRoute",
32-
"{controller}/Index/",
33-
new { action = "Index" });
34-
35-
routes.MapRoute("CreateRoute",
36-
"{controller}/Create/",
37-
new { action = "Create" });
38-
39-
routes.MapRoute("RepositoryTree",
40-
"Repository/{id}/{encodedName}/Tree/{*encodedPath}",
41-
new { controller = "Repository", action = "Tree" });
42-
43-
routes.MapRoute("RepositoryBlob",
44-
"Repository/{id}/{encodedName}/Blob/{*encodedPath}",
45-
new { controller = "Repository", action = "Blob" },
46-
new { id = @"\d+" });
47-
48-
routes.MapRoute("RepositoryRaw",
49-
"Repository/{id}/{encodedName}/Raw/{*encodedPath}",
50-
new { controller = "Repository", action = "Raw" });
51-
52-
routes.MapRoute("RepositoryBlame",
53-
"Repository/{id}/{encodedName}/Blame/{*encodedPath}",
54-
new { controller = "Repository", action = "Blame" });
55-
56-
routes.MapRoute("RepositoryDownload",
57-
"Repository/{id}/{encodedName}/Download/{*encodedPath}",
58-
new { controller = "Repository", action = "Download" });
59-
60-
routes.MapRoute("RepositoryCommits",
61-
"Repository/{id}/{encodedName}/Commits",
62-
new { controller = "Repository", action = "Commits" });
63-
64-
routes.MapRoute("RepositoryCommit",
65-
"Repository/{id}/{encodedName}/Commit/{commit}/",
66-
new { controller = "Repository", action = "Commit" });
67-
68-
routes.MapRoute("RepositoryHistory",
69-
"Repository/{id}/{encodedName}/History/{*encodedPath}",
70-
new { controller = "Repository", action = "History" },
71-
new { id = @"\d+" });
72-
73-
routes.MapRoute("Repository",
74-
"Repository/{id}/{action}/{reponame}",
75-
new { controller = "Repository", action = "Detail", reponame = UrlParameter.Optional },
76-
new { id = @"\d+" });
77-
78-
routes.MapRoute("Account",
79-
"Account/{id}/{action}/{username}",
80-
new { controller = "Account", action = "Detail", username = UrlParameter.Optional },
81-
new { id = @"\d+" });
82-
83-
routes.MapRoute("Team",
84-
"Team/{id}/{action}/{teamname}",
85-
new { controller = "Team", action = "Detail", teamname = UrlParameter.Optional },
86-
new { id = @"\d+" });
87-
88-
89-
routes.MapRoute("Validation", "Validation/{action}", new { controller = "Validation", action = String.Empty });
90-
91-
routes.MapRoute("RepoCommits",
92-
"Repository/Commits/{id}",
93-
new { controller = "Repository", action = "Commits", id = string.Empty});
94-
95-
routes.MapRoute("Default",
96-
"{controller}/{action}/{id}",
97-
new { controller = "Home", action = "Index", id = String.Empty });
98-
99-
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
100-
101-
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
102-
}
103-
}
104-
}
1+
//using System;
2+
3+
//namespace Bonobo.Git.Server.App_Start
4+
//{
5+
// public class RouteConfig
6+
// {
7+
// public static void RegisterRoutes(RouteCollection routes)
8+
// {
9+
// //routes.MapRoute("SecureInfoRefs",
10+
// // "{repositoryName}.git/info/refs",
11+
// // new { controller = "Git", action = "SecureGetInfoRefs" },
12+
// // new { method = new HttpMethodConstraint("GET") });
13+
14+
// //routes.MapRoute("SecureUploadPack",
15+
// // "{repositoryName}.git/git-upload-pack",
16+
// // new { controller = "Git", action = "SecureUploadPack" },
17+
// // new { method = new HttpMethodConstraint("POST") });
18+
19+
// //routes.MapRoute("SecureReceivePack",
20+
// // "{repositoryName}.git/git-receive-pack",
21+
// // new { controller = "Git", action = "SecureReceivePack" },
22+
// // new { method = new HttpMethodConstraint("POST") });
23+
24+
// //routes.MapRoute("GitBaseUrl",
25+
// // "{repositoryName}.git",
26+
// // new { controller = "Git", action = "GitUrl" },
27+
// // new { method = new HttpMethodConstraint("GET") });
28+
29+
// routes.MapRoute("IndexRoute",
30+
// "{controller}/Index/",
31+
// new { action = "Index" });
32+
33+
// routes.MapRoute("CreateRoute",
34+
// "{controller}/Create/",
35+
// new { action = "Create" });
36+
37+
// routes.MapRoute("RepositoryTree",
38+
// "Repository/{id}/{encodedName}/Tree/{*encodedPath}",
39+
// new { controller = "Repository", action = "Tree" });
40+
41+
// routes.MapRoute("RepositoryBlob",
42+
// "Repository/{id}/{encodedName}/Blob/{*encodedPath}",
43+
// new { controller = "Repository", action = "Blob" },
44+
// new { id = @"\d+" });
45+
46+
// routes.MapRoute("RepositoryRaw",
47+
// "Repository/{id}/{encodedName}/Raw/{*encodedPath}",
48+
// new { controller = "Repository", action = "Raw" });
49+
50+
// routes.MapRoute("RepositoryBlame",
51+
// "Repository/{id}/{encodedName}/Blame/{*encodedPath}",
52+
// new { controller = "Repository", action = "Blame" });
53+
54+
// routes.MapRoute("RepositoryDownload",
55+
// "Repository/{id}/{encodedName}/Download/{*encodedPath}",
56+
// new { controller = "Repository", action = "Download" });
57+
58+
// routes.MapRoute("RepositoryCommits",
59+
// "Repository/{id}/{encodedName}/Commits",
60+
// new { controller = "Repository", action = "Commits" });
61+
62+
// routes.MapRoute("RepositoryCommit",
63+
// "Repository/{id}/{encodedName}/Commit/{commit}/",
64+
// new { controller = "Repository", action = "Commit" });
65+
66+
// routes.MapRoute("RepositoryHistory",
67+
// "Repository/{id}/{encodedName}/History/{*encodedPath}",
68+
// new { controller = "Repository", action = "History" },
69+
// new { id = @"\d+" });
70+
71+
// routes.MapRoute("Repository",
72+
// "Repository/{id}/{action}/{reponame}",
73+
// new { controller = "Repository", action = "Detail", reponame = UrlParameter.Optional },
74+
// new { id = @"\d+" });
75+
76+
// routes.MapRoute("Account",
77+
// "Account/{id}/{action}/{username}",
78+
// new { controller = "Account", action = "Detail", username = UrlParameter.Optional },
79+
// new { id = @"\d+" });
80+
81+
// routes.MapRoute("Team",
82+
// "Team/{id}/{action}/{teamname}",
83+
// new { controller = "Team", action = "Detail", teamname = UrlParameter.Optional },
84+
// new { id = @"\d+" });
85+
86+
87+
// routes.MapRoute("Validation", "Validation/{action}", new { controller = "Validation", action = String.Empty });
88+
89+
// routes.MapRoute("RepoCommits",
90+
// "Repository/Commits/{id}",
91+
// new { controller = "Repository", action = "Commits", id = string.Empty });
92+
93+
// routes.MapRoute("Default",
94+
// "{controller}/{action}/{id}",
95+
// new { controller = "Home", action = "Index", id = String.Empty });
96+
97+
// routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
98+
99+
// routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
100+
// }
101+
// }
102+
//}

Bonobo.Git.Server/Attributes/AllViewsAttribute.cs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using Bonobo.Git.Server.App_GlobalResources;
2-
using Bonobo.Git.Server.Models;
3-
using Bonobo.Git.Server.Security;
4-
using Microsoft.Practices.Unity;
5-
using System;
1+
using System;
62
using System.Collections.Generic;
73
using System.Linq;
8-
using System.Web.Mvc;
4+
using Bonobo.Git.Server.App_GlobalResources;
5+
using Bonobo.Git.Server.Models;
6+
using Bonobo.Git.Server.Security;
7+
using Microsoft.AspNetCore.Mvc;
8+
using Microsoft.AspNetCore.Mvc.Filters;
9+
using Microsoft.AspNetCore.Mvc.Rendering;
10+
using Microsoft.AspNetCore.Mvc.Routing;
11+
using Microsoft.Extensions.DependencyInjection;
912

1013
namespace Bonobo.Git.Server.Attributes
1114
{
@@ -33,29 +36,31 @@ public int GetHashCode(T obj)
3336

3437
public class AllViewsFilter : ActionFilterAttribute
3538
{
36-
[Dependency]
37-
public IRepositoryPermissionService RepoPermissions { get; set; }
38-
3939
public override void OnActionExecuting(ActionExecutingContext filterContext)
4040
{
41-
filterContext.Controller.ViewBag.PermittedRepositories = PopulateRepoGoToList(filterContext.HttpContext.User.Id(), filterContext.Controller.ControllerContext);
41+
if (filterContext.Controller is Controller ctrl)
42+
{
43+
ctrl.ViewBag.PermittedRepositories = PopulateRepoGoToList(filterContext, filterContext.HttpContext.User.Id());
44+
}
4245
}
4346

44-
private List<SelectListItem> PopulateRepoGoToList(Guid id, ControllerContext ControllerContext)
47+
private List<SelectListItem> PopulateRepoGoToList(ActionExecutingContext filterContext, Guid id)
4548
{
46-
var pullList = RepoPermissions.GetAllPermittedRepositories(id, RepositoryAccessLevel.Pull);
47-
var adminList = RepoPermissions.GetAllPermittedRepositories(id, RepositoryAccessLevel.Administer);
49+
var repoPermissions = filterContext.HttpContext.RequestServices.GetService<IRepositoryPermissionService>();
50+
51+
var pullList = repoPermissions.GetAllPermittedRepositories(id, RepositoryAccessLevel.Pull);
52+
var adminList = repoPermissions.GetAllPermittedRepositories(id, RepositoryAccessLevel.Administer);
4853
var firstList = pullList.Union(adminList, new InlineComparer<RepositoryModel>((lhs, rhs) => lhs.Id == rhs.Id, obj => obj.Id.GetHashCode()))
4954
.OrderBy(x => x.Name.ToLowerInvariant())
50-
.GroupBy(x => x.Group == null ? Resources.Repository_No_Group : x.Group);
55+
.GroupBy(x => x.Group ?? Resources.Repository_No_Group);
56+
5157
List<SelectListItem> items = new List<SelectListItem>();
52-
var u = new UrlHelper(ControllerContext.RequestContext);
58+
var u = new UrlHelper(filterContext);
5359
var groups = new Dictionary<string, SelectListGroup>();
5460
foreach (var grouped in firstList)
5561
{
56-
SelectListGroup group = null;
5762
string key = grouped.Key;
58-
if (!groups.TryGetValue(key, out group))
63+
if (!groups.TryGetValue(key, out SelectListGroup group))
5964
{
6065
group = new SelectListGroup();
6166
group.Name = key;
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
using System.ComponentModel.DataAnnotations;
1+
using System.ComponentModel.DataAnnotations;
62

73
namespace Bonobo.Git.Server
84
{
95
public class EmailAttribute : RegularExpressionAttribute
10-
{
6+
{
117
public EmailAttribute() :
12-
base(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,63}$")
13-
{
8+
base(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,63}$")
9+
{
1410
}
1511
}
1612
}

0 commit comments

Comments
 (0)