Created static object provider + added some properties

This commit is contained in:
2024-10-05 12:18:32 +02:00
parent 66ddc22012
commit 9cf818c55d
30 changed files with 186 additions and 77 deletions

View File

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

View File

@@ -1,27 +1,22 @@
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), AdminUnsortable]
[Required, DefaultValue(false)]
public bool IsDefaultGroup { get; set; }
[MaxLength(500)]
public string Description { get; set; }
[Required, AdminUneditable]
[Required]
public DateTime CreatedAt { get; set; }
[AdminIgnore(onlyForListing: true)]
public virtual IList<Permission> Permissions { get; set; }
}

View File

@@ -1,11 +1,8 @@
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)]
@@ -17,16 +14,15 @@ public class User : IPermissionOwner {
[Required, MaxLength(50), EmailAddress]
public string Email { get; set; }
[Required, MinLength(8), MaxLength(255), JsonIgnore, AdminIgnore(onlyForListing: true), AdminHideValue]
[Required, MinLength(8), MaxLength(255), JsonIgnore]
public string Password { get; set; }
[Required, AdminUneditable]
[Required]
public DateTime CreatedAt { get; set; }
[AdminIgnore(onlyForListing: true)]
public virtual IList<Permission> Permissions { get; set; }
[JsonIgnore, AdminIgnore]
[JsonIgnore]
public virtual IList<Token> Tokens { get; set; }
}