roles.proto 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. // Public role metadata used for rendering role mentions, labels, and catalogs.
  5. message Role {
  6. // Stable role name used in permission and assignment records.
  7. string name = 1;
  8. // Display name shown in user-facing role UIs.
  9. string display_name = 2;
  10. // Optional role description.
  11. string description = 3;
  12. // Whether this is a built-in role.
  13. bool is_system = 4;
  14. // Display/order position.
  15. int32 position = 5;
  16. // Whether messages may notify users assigned to this role.
  17. bool pingable = 6;
  18. }
  19. // Request the current role catalog.
  20. message ListRolesRequest {}
  21. // Snapshot of the role catalog visible to the authenticated viewer.
  22. message ListRolesResponse {
  23. // Roles sorted by position.
  24. repeated Role roles = 1;
  25. }
  26. // Request one public role by stable role name.
  27. message GetRoleRequest {
  28. // Required stable role name.
  29. string name = 1 [(buf.validate.field).string.min_len = 1];
  30. }
  31. // Public role lookup response.
  32. message GetRoleResponse {
  33. // Requested role.
  34. Role role = 1;
  35. }
  36. // Request public role records for a set of stable role names.
  37. message BatchGetRolesRequest {
  38. // Required role names. Unknown names are omitted from the response.
  39. repeated string names = 1 [(buf.validate.field).repeated = {
  40. min_items: 1
  41. max_items: 100
  42. items: {
  43. string: {min_len: 1}
  44. }
  45. }];
  46. }
  47. // Batch public role response.
  48. message BatchGetRolesResponse {
  49. // Found roles. The server preserves first-seen request order and
  50. // de-duplicates repeated names.
  51. repeated Role roles = 1;
  52. }
  53. // Provides authenticated reads for public role metadata.
  54. service RoleService {
  55. // Lists the current role catalog as a finite snapshot. Requires an
  56. // authenticated user.
  57. rpc ListRoles(ListRolesRequest) returns (ListRolesResponse);
  58. // Gets one public role by stable name. Returns NOT_FOUND when the role is
  59. // unknown.
  60. rpc GetRole(GetRoleRequest) returns (GetRoleResponse);
  61. // Gets public role records for multiple role names referenced by member rows,
  62. // mentions, or integration clients.
  63. rpc BatchGetRoles(BatchGetRolesRequest) returns (BatchGetRolesResponse);
  64. }