[WIP]
This commit is contained in:
parent
6ff5419791
commit
bcf46d3942
1 changed files with 20 additions and 0 deletions
20
Yavsc/AuthorizationHandlers/ManageGitHookHandler.cs
Normal file
20
Yavsc/AuthorizationHandlers/ManageGitHookHandler.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using Microsoft.AspNet.Authorization;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using Yavsc.Models.IT;
|
||||||
|
using Yavsc.Server.Models.IT.SourceCode;
|
||||||
|
using Yavsc.ViewModels.Auth;
|
||||||
|
|
||||||
|
namespace Yavsc.AuthorizationHandlers
|
||||||
|
{
|
||||||
|
public class ManageGitHookHandler: AuthorizationHandler<EditRequirement, GitRepositoryReference>
|
||||||
|
{
|
||||||
|
protected override void Handle(AuthorizationContext context, EditRequirement requirement, GitRepositoryReference resource)
|
||||||
|
{
|
||||||
|
if (context.User.IsInRole("FrontOffice"))
|
||||||
|
context.Succeed(requirement);
|
||||||
|
else if (context.User.Identity.IsAuthenticated)
|
||||||
|
context.Succeed(requirement);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue