PermissionSetting.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System.ComponentModel.DataAnnotations;
  2. using System.ComponentModel.DataAnnotations.Schema;
  3. using Abp.Domain.Entities;
  4. using Abp.Domain.Entities.Auditing;
  5. namespace IwbZero.Authorization.Base.Permissions
  6. {
  7. /// <summary>
  8. /// Used to grant/deny a permission for a role or user.
  9. /// </summary>
  10. [Table("Sys_Permissions")]
  11. public class PermissionSetting : CreationAuditedEntity<long>, IMayHaveTenant
  12. {
  13. /// <summary>
  14. /// Maximum length of the <see cref="Name"/> field.
  15. /// </summary>
  16. public const int NameMaxLength = 500;
  17. public const int MasterValueMaxLength = 100;
  18. public const int AccessValueMaxLength = 500;
  19. public virtual int? TenantId { get; set; }
  20. /// <summary>
  21. /// Unique name of the permission.
  22. /// </summary>
  23. [Required]
  24. [StringLength(NameMaxLength)]
  25. public virtual string Name { get; set; }
  26. public int? Master { get; set; }
  27. [StringLength(MasterValueMaxLength)]
  28. public string MasterValue { get; set; }
  29. public int? Access { get; set; }
  30. [StringLength(AccessValueMaxLength)]
  31. public string AccessValue { get; set; }
  32. /// <summary>
  33. /// Is this role granted for this permission.
  34. /// Default value: true.
  35. /// </summary>
  36. public virtual bool IsGranted { get; set; }
  37. /// <summary>
  38. /// Creates a new <see cref="PermissionSetting"/> entity.
  39. /// </summary>
  40. public PermissionSetting() => IsGranted = true;
  41. }
  42. }