files tree made better.
This commit is contained in:
parent
ffbf032480
commit
ccc91bbf19
1630 changed files with 18209 additions and 41860 deletions
22
src/Yavsc/AuthorizationHandlers/BillViewHandlers.cs
Normal file
22
src/Yavsc/AuthorizationHandlers/BillViewHandlers.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
|
||||
namespace Yavsc.ViewModels.Auth.Handlers
|
||||
{
|
||||
using Billing;
|
||||
|
||||
public class BillViewHandler : AuthorizationHandler<ViewRequirement, IBillable>
|
||||
{
|
||||
protected override void Handle(AuthorizationContext context, ViewRequirement requirement, IBillable resource)
|
||||
{
|
||||
if (context.User.IsInRole("FrontOffice"))
|
||||
context.Succeed(requirement);
|
||||
else if (context.User.Identity.IsAuthenticated)
|
||||
if (resource.ClientId == context.User.GetUserId())
|
||||
context.Succeed(requirement);
|
||||
else if (resource.PerformerId == context.User.GetUserId())
|
||||
context.Succeed(requirement);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue