permission handling
This commit is contained in:
parent
3495523bd4
commit
71262647b3
27 changed files with 243 additions and 288 deletions
12
src/Yavsc.Server/ViewModels/Auth/DeletePermission.cs
Normal file
12
src/Yavsc.Server/ViewModels/Auth/DeletePermission.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Yavsc.ViewModels.Auth
|
||||
{
|
||||
public class DeletePermission: IAuthorizationRequirement
|
||||
{
|
||||
public DeletePermission()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
src/Yavsc.Server/ViewModels/Auth/EditPermission.cs
Normal file
12
src/Yavsc.Server/ViewModels/Auth/EditPermission.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Yavsc.ViewModels.Auth
|
||||
{
|
||||
public class EditPermission : IAuthorizationRequirement
|
||||
{
|
||||
public EditPermission()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Yavsc.ViewModels.Auth
|
||||
{
|
||||
public class EditPermission : IAuthorizationRequirement
|
||||
{
|
||||
public EditPermission()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ReadPermission: IAuthorizationRequirement
|
||||
{
|
||||
public ReadPermission()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class DeletePermission: IAuthorizationRequirement
|
||||
{
|
||||
public DeletePermission()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,10 +2,11 @@ using Microsoft.AspNetCore.Authorization;
|
|||
|
||||
namespace Yavsc.ViewModels.Auth
|
||||
{
|
||||
public class ViewRequirement : IAuthorizationRequirement
|
||||
public class ReadPermission: IAuthorizationRequirement
|
||||
{
|
||||
public ViewRequirement()
|
||||
public ReadPermission()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
src/Yavsc.Server/ViewModels/BlogSpot/BlogPostEdit.cs
Normal file
11
src/Yavsc.Server/ViewModels/BlogSpot/BlogPostEdit.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.ViewModels.Blog;
|
||||
|
||||
public class BlogPostEditViewModel : BlogPostInputViewModel
|
||||
{
|
||||
|
||||
[Required]
|
||||
|
||||
public required long Id { get; set; }
|
||||
}
|
||||
|
|
@ -8,19 +8,18 @@ namespace Yavsc.ViewModels.Blog
|
|||
public class BlogPostInputViewModel
|
||||
{
|
||||
[StringLength(1024)]
|
||||
public string? Photo { get; set; }
|
||||
public string? Photo { get; set; }
|
||||
|
||||
[StringLength(1024)]
|
||||
public required string Title { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
[StringLength(56224)]
|
||||
public required string Content { get; set; }
|
||||
|
||||
public bool Visible { get; set; }
|
||||
public string Content { get; set; }
|
||||
|
||||
[InverseProperty("Target")]
|
||||
[Display(Name="Liste de contrôle d'accès")]
|
||||
public virtual List<CircleAuthorizationToBlogPost>? ACL { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yavsc.ViewModels.BlogSpot
|
||||
{
|
||||
public class NewPost
|
||||
{
|
||||
[Required]
|
||||
public string Title{ get; set; }
|
||||
|
||||
[Required]
|
||||
public string Content { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue