Browse Source

Merge pull request #4 from latop2604/initialwork

Some fix for blocking issues
dev
Aimeast 12 years ago
parent
commit
c88d25fe30
  1. 7
      GitCandy/Filters/PublicServerAttribute.cs
  2. 19
      GitCandy/Filters/SmartGitAttribute.cs
  3. 28
      GitCandy/Views/Repository/Coop.cshtml
  4. 2
      GitCandy/Views/Shared/_Layout.cshtml
  5. 8
      GitCandy/Views/Team/Users.cshtml

7
GitCandy/Filters/PublicServerAttribute.cs

@ -11,8 +11,11 @@ namespace GitCandy.Filters
if (UserConfiguration.Current.IsPublicServer)
return;
bool skipAuthorization = filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true)
|| filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true);
bool skipAuthorization =
filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true)
|| filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true)
|| filterContext.ActionDescriptor.IsDefined(typeof(SmartGitAttribute), true)
|| filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(SmartGitAttribute), true);
if (skipAuthorization)
return;

19
GitCandy/Filters/SmartGitAttribute.cs

@ -1,4 +1,5 @@
using GitCandy.Controllers;
using GitCandy.Configuration;
using GitCandy.Controllers;
using System;
using System.Text;
using System.Web.Mvc;
@ -40,18 +41,18 @@ namespace GitCandy.Filters
username = certificate.Substring(0, index);
var user = controller.MembershipService.Login(username, password);
if (user != null)
{
username = user.Name;
}
else
{
username = null;
}
username = user != null ? user.Name : null;
}
}
controller.Session[AuthKey] = username;
if (username == null && !UserConfiguration.Current.IsPublicServer)
{
HandleUnauthorizedRequest(filterContext);
return;
}
var right = false;
var projectField = controller.ValueProvider.GetValue("project");

28
GitCandy/Views/Repository/Coop.cshtml

@ -24,29 +24,29 @@
container: "#choose_user",
add_label: "@SR.Shared_Add",
del_label: "@SR.Shared_Remove",
add_action: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "add" } } },
del_action: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "del" } } },
add_action: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "add" }; } },
del_action: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "del" }; } },
action_array: [
{
key: "AllowRead",
on_label: "@SR.Repository_ShortAllowRead",
off_label: "@SR.Repository_ShortNonAllowRead",
checked: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "read", value: true } } },
unchecked: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "read", value: false } } },
checked: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "read", value: true }; } },
unchecked: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "read", value: false }; } },
},
{
key: "AllowWrite",
on_label: "@SR.Repository_ShortAllowWrite",
off_label: "@SR.Repository_ShortNonAllowWrite",
checked: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "write", value: true } } },
unchecked: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "write", value: false } } },
checked: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "write", value: true }; } },
unchecked: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "write", value: false }; } },
},
{
key: "IsOwner",
on_label: "@SR.Repository_ShortIsOwner",
off_label: "@SR.Repository_ShortNotOwner",
checked: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "owner", value: true } } },
unchecked: { url: "/Repository/ChooseUser", query: function (item) { return { name: repo, user: item, act: "owner", value: false } } },
checked: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "owner", value: true }; } },
unchecked: { url: "@Url.Action("ChooseUser", "Repository")", query: function (item) { return { name: repo, user: item, act: "owner", value: false }; } },
},
]
});
@ -58,22 +58,22 @@
container: "#choose_team",
add_label: "@SR.Shared_Add",
del_label: "@SR.Shared_Remove",
add_action: { url: "/Repository/ChooseTeam", query: function (item) { return { name: repo, team: item, act: "add" } } },
del_action: { url: "/Repository/ChooseTeam", query: function (item) { return { name: repo, team: item, act: "del" } } },
add_action: { url: "@Url.Action("ChooseTeam", "Repository")", query: function (item) { return { name: repo, team: item, act: "add" }; } },
del_action: { url: "@Url.Action("ChooseTeam", "Repository")", query: function (item) { return { name: repo, team: item, act: "del" }; } },
action_array: [
{
key: "AllowRead",
on_label: "@SR.Repository_ShortAllowRead",
off_label: "@SR.Repository_ShortNonAllowRead",
checked: { url: "/Repository/ChooseTeam", query: function (item) { return { name: repo, team: item, act: "read", value: true } } },
unchecked: { url: "/Repository/ChooseTeam", query: function (item) { return { name: repo, team: item, act: "read", value: false } } },
checked: { url: "@Url.Action("ChooseTeam", "Repository")", query: function (item) { return { name: repo, team: item, act: "read", value: true }; } },
unchecked: { url: "@Url.Action("ChooseTeam", "Repository")", query: function (item) { return { name: repo, team: item, act: "read", value: false }; } },
},
{
key: "AllowWrite",
on_label: "@SR.Repository_ShortAllowWrite",
off_label: "@SR.Repository_ShortNonAllowWrite",
checked: { url: "/Repository/ChooseTeam", query: function (item) { return { name: repo, team: item, act: "write", value: true } } },
unchecked: { url: "/Repository/ChooseTeam", query: function (item) { return { name: repo, team: item, act: "write", value: false } } },
checked: { url: "@Url.Action("ChooseTeam", "Repository")", query: function (item) { return { name: repo, team: item, act: "write", value: true }; } },
unchecked: { url: "@Url.Action("ChooseTeam", "Repository")", query: function (item) { return { name: repo, team: item, act: "write", value: false }; } },
},
]
});

2
GitCandy/Views/Shared/_Layout.cshtml

@ -13,7 +13,7 @@
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">@SR.Shared_AppTitle <span class="label">Alpha</span></a>
<a class="brand" href="~/">@SR.Shared_AppTitle <span class="label">Alpha</span></a>
<div class="nav-collapse collapse">
<ul class="nav nav-pills">
<li class="divider-vertical"></li>

8
GitCandy/Views/Team/Users.cshtml

@ -20,15 +20,15 @@
container: "#chooser",
add_label: "@SR.Shared_Add",
del_label: "@SR.Shared_Remove",
add_action: { url: "/Team/ChooseUser", query: function (item) { return { name: team, user: item, act: "add" } } },
del_action: { url: "/Team/ChooseUser", query: function (item) { return { name: team, user: item, act: "del" } } },
add_action: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "add" }; } },
del_action: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "del" }; } },
action_array: [
{
key: "IsAdministrator",
on_label: "@SR.Team_ShortAdministrator",
off_label: "@SR.Team_ShortNonAdministrator",
checked: { url: "/Team/ChooseUser", query: function (item) { return { name: team, user: item, act: "admin" } } },
unchecked: { url: "/Team/ChooseUser", query: function (item) { return { name: team, user: item, act: "member" } } },
checked: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "admin" }; } },
unchecked: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "member" }; } },
}
]
});

Loading…
Cancel
Save