Created AdminContext handling

This commit is contained in:
2024-09-30 19:01:39 +02:00
parent 672f0fd2c3
commit 66ddc22012
33 changed files with 582 additions and 7 deletions

View File

@@ -22,4 +22,8 @@
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HopFrame.Web.Admin\HopFrame.Web.Admin.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,22 +1,27 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using HopFrame.Web.Admin.Attributes;
using HopFrame.Web.Admin.Attributes.Members;
namespace HopFrame.Database.Models;
[AdminName("Groups")]
[AdminDescription("On this page you can view, create, edit and delete permission groups.")]
public class PermissionGroup : IPermissionOwner {
[Key, Required, MaxLength(50)]
public string Name { get; init; }
[Required, DefaultValue(false)]
[Required, DefaultValue(false), AdminUnsortable]
public bool IsDefaultGroup { get; set; }
[MaxLength(500)]
public string Description { get; set; }
[Required]
[Required, AdminUneditable]
public DateTime CreatedAt { get; set; }
[AdminIgnore(onlyForListing: true)]
public virtual IList<Permission> Permissions { get; set; }
}

View File

@@ -1,8 +1,11 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using HopFrame.Web.Admin.Attributes;
using HopFrame.Web.Admin.Attributes.Members;
namespace HopFrame.Database.Models;
[AdminDescription("On this page you can manage all user accounts.")]
public class User : IPermissionOwner {
[Key, Required, MinLength(36), MaxLength(36)]
@@ -14,15 +17,16 @@ public class User : IPermissionOwner {
[Required, MaxLength(50), EmailAddress]
public string Email { get; set; }
[Required, MinLength(8), MaxLength(255), JsonIgnore]
[Required, MinLength(8), MaxLength(255), JsonIgnore, AdminIgnore(onlyForListing: true), AdminHideValue]
public string Password { get; set; }
[Required]
[Required, AdminUneditable]
public DateTime CreatedAt { get; set; }
[AdminIgnore(onlyForListing: true)]
public virtual IList<Permission> Permissions { get; set; }
[JsonIgnore]
[JsonIgnore, AdminIgnore]
public virtual IList<Token> Tokens { get; set; }
}