always better
This commit is contained in:
parent
0a374b2e75
commit
14ee4dca29
10 changed files with 102 additions and 28 deletions
|
|
@ -54,7 +54,18 @@ namespace Yavsc {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public class ViewFileHandler : AuthorizationHandler<ViewRequirement, ViewFileContext>
|
||||
{
|
||||
protected override void Handle(AuthorizationContext context, ViewRequirement requirement, ViewFileContext fileContext)
|
||||
{
|
||||
// TODO file access rules
|
||||
if (fileContext.Path.StartsWith("/pub/"))
|
||||
context.Succeed(requirement);
|
||||
else {
|
||||
context.Succeed(requirement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandViewHandler : AuthorizationHandler<ViewRequirement, BookQuery>
|
||||
{
|
||||
|
|
|
|||
11
Yavsc/ViewModels/Auth/ViewFileContext.cs
Normal file
11
Yavsc/ViewModels/Auth/ViewFileContext.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using Microsoft.AspNet.FileProviders;
|
||||
|
||||
namespace Yavsc.ViewModels.Auth
|
||||
{
|
||||
public class ViewFileContext
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public IFileInfo File { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -13,5 +13,7 @@ public class ChatUserInfo
|
|||
|
||||
public string Avatar { get; set; }
|
||||
|
||||
public string[] Roles { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue