Role.h 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
  3. * All rights reserved. Distributed under the terms of the MIT license.
  4. */
  5. #ifndef _ROLE_H
  6. #define _ROLE_H
  7. #include <Catalog.h>
  8. #include <String.h>
  9. #include <SupportDefs.h>
  10. #include "Flags.h"
  11. #undef B_TRANSLATION_CONTEXT
  12. #define B_TRANSLATION_CONTEXT "User role"
  13. class Role {
  14. public:
  15. Role()
  16. : fTitle(B_TRANSLATE("Default")), fPerms(0 | PERM_WRITE | PERM_READ),
  17. fPriority(0)
  18. {
  19. }
  20. Role(BString title, int32 perms, int32 priority)
  21. : fTitle(title), fPerms(perms), fPriority(priority)
  22. {
  23. }
  24. const char* fTitle;
  25. int32 fPerms; // Permissions afforded to role, as described above.
  26. int32 fPriority; // 'Rank' of role, with higher being greater priority.
  27. // I.E., a user with a priority of 11 can't kick a user
  28. // with a priority of 12, but can one with 10.
  29. // This sort of hierarchy might not be universal in
  30. // chat protocols, but I think it can be adequately
  31. // simulated in add-ons.
  32. };
  33. #endif // _ROLE_H