Role.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.ComponentModel.DataAnnotations;
  2. using System.Threading.Tasks;
  3. using Abp.Domain.Uow;
  4. using Abp.MultiTenancy;
  5. using WeApp.Authorization.Users;
  6. using WeApp.Configuration;
  7. using IwbZero.Authorization.Roles;
  8. using IwbZero.Zero.Configuration;
  9. using Microsoft.AspNet.Identity;
  10. namespace WeApp.Authorization.Roles
  11. {
  12. public class Role : IwbSysRole<User>
  13. {
  14. public const int MaxDescriptionLength = 5000;
  15. public Role()
  16. {
  17. }
  18. public Role(int? tenantId, string displayName)
  19. : base(tenantId, displayName)
  20. {
  21. }
  22. public Role(int? tenantId, string name, string displayName)
  23. : base(tenantId, name, displayName)
  24. {
  25. }
  26. [MaxLength(MaxDescriptionLength)]
  27. public string Description { get; set; }
  28. [UnitOfWork]
  29. public static Role CreateStaticRoles(int tenantId)
  30. {
  31. return new Role
  32. {
  33. TenantId = tenantId,
  34. AccountType = AccountTypeDefinition.System,
  35. RoleType = UsersAndRolesTypeDefinition.Supper,
  36. IsStatic = true
  37. }; ;
  38. }
  39. }
  40. }