IClientRoleAccesser.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace SKMC.Api.Client.Access
  8. {
  9. /// <summary>
  10. /// 角色权限访问接口
  11. /// </summary>
  12. public interface IClientRoleAccesser
  13. {
  14. /// <summary>
  15. /// 当前角色
  16. /// </summary>
  17. ClientRole UserRole { get; set; }
  18. /// <summary>
  19. /// 权限标识, 切换权限时变更
  20. /// </summary>
  21. int AccessToken { get; set; }
  22. /// <summary>
  23. /// 所有角色列表(下拉选择)
  24. /// </summary>
  25. ObservableCollection<ClientRole> ClientRoles { get; set; }
  26. /// <summary>
  27. /// 角色登录
  28. /// </summary>
  29. /// <param name="roleCode">角色码</param>
  30. /// <param name="password">登录密码</param>
  31. /// <param name="action">后置动作</param>
  32. /// <returns></returns>
  33. bool Login(string roleCode, string password, Action action = null);
  34. /// <summary>
  35. /// 当前角色登出
  36. /// </summary>
  37. /// <param name="action">后置动作</param>
  38. void Logout(Action action = null);
  39. /// <summary>
  40. /// 密码验证
  41. /// </summary>
  42. /// <param name="roleCode">角色码</param>
  43. /// <param name="password">登录密码</param>
  44. /// <param name="action">后置动作</param>
  45. /// <returns></returns>
  46. bool CheckPassword(string roleCode, string password, Action action = null);
  47. /// <summary>
  48. /// 更改密码
  49. /// </summary>
  50. /// <param name="roleCode">角色码</param>
  51. /// <param name="password">登录密码</param>
  52. /// <param name="newpwd">新密码</param>
  53. void ChangePassword(string roleCode, string password, string newpwd);
  54. /// <summary>
  55. /// 权限验证
  56. /// </summary>
  57. /// <param name="accessCode"></param>
  58. /// <returns></returns>
  59. bool HasAccess(string accessCode);
  60. /// <summary>
  61. /// 权限验证, 并根据设备状态匹配
  62. /// </summary>
  63. /// <param name="accessCode"></param>
  64. /// <returns></returns>
  65. bool HasAccess(string accessCode, byte deviceStatus);
  66. /// <summary>
  67. /// 加载角色(权限)
  68. /// </summary>
  69. /// <param name="roleCode">角色码, null表示初始角色</param>
  70. /// <returns></returns>
  71. ClientRole LoadRole(string roleCode = null, Action action = null);
  72. /// <summary>
  73. /// 加载角色的事件
  74. /// </summary>
  75. event Action LoadRoleEvent;
  76. /// <summary>
  77. /// 卸载角色(权限)
  78. /// </summary>
  79. void UnloadRole(Action action = null);
  80. }
  81. }