Role.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace GreenTree.Nachtragsmanagement.Core.Domain.User
  7. {
  8. public class Role : BaseEntity
  9. {
  10. #region Fields
  11. /// <summary>
  12. /// Users related to the role
  13. /// </summary>
  14. private ICollection<User> _users;
  15. /// <summary>
  16. /// Functionlist
  17. /// </summary>
  18. private ICollection<Function> _functions;
  19. #endregion
  20. /// <summary>
  21. /// Description
  22. /// </summary>
  23. public string Description { get; set; }
  24. /// <summary>
  25. /// Level of right (higher value means higher right)
  26. /// </summary>
  27. public int Level { get; set; }
  28. /// <summary>
  29. /// Determines if the role can only see sites which it is assigned to
  30. /// </summary>
  31. public bool SeeOnlyAssigned { get; set; }
  32. /// <summary>
  33. /// Users assigned to the role
  34. /// </summary>
  35. public virtual ICollection<User> Users
  36. {
  37. get { return _users ?? (_users = new List<User>()); }
  38. protected set { _users = value; }
  39. }
  40. /// <summary>
  41. /// Functions the role have
  42. /// </summary>
  43. public virtual ICollection<Function> Functions
  44. {
  45. get { return _functions ?? (_functions = new List<Function>()); }
  46. protected set { _functions = value; }
  47. }
  48. #region Helper
  49. /// <summary>
  50. /// Adds missing functions and removes not selected functions
  51. /// </summary>
  52. /// <param name="functions">Functions.</param>
  53. public void SetFunctions(ICollection<Function> functions)
  54. {
  55. Functions = functions;
  56. }
  57. #endregion
  58. }
  59. }