[WIP]
This commit is contained in:
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user