From 003392a1fbf1738cf6e0ecd326efd88bf398f787 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 8 Jun 2018 10:25:03 +0200 Subject: [PATCH] [WIP] --- .../ManageGitHookHandler.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Yavsc/AuthorizationHandlers/ManageGitHookHandler.cs diff --git a/Yavsc/AuthorizationHandlers/ManageGitHookHandler.cs b/Yavsc/AuthorizationHandlers/ManageGitHookHandler.cs new file mode 100644 index 00000000..69136eff --- /dev/null +++ b/Yavsc/AuthorizationHandlers/ManageGitHookHandler.cs @@ -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 + { + 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); + } + + } +} \ No newline at end of file