Beep backend handling user permissions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. # beep-permissions
  2. Beep backend handling user permissions. Currently, permissions are defined as user-scope (i.e. userid in conversationid). If no such pairing exists, permission is denied. Might consider moving to searchms style user-scope-action system later.
  3. Relations are cached in redis to avoid excessive querying time. A listener updates the cache on database changes.
  4. This service is meant to be used internally. Otherwise, people can systematically query it finding out which conversation a said user is in.
  5. ## Environment variables
  6. Supply environment variables by either exporting them or editing `.env`.
  7. | ENV | Description | Default |
  8. | --- | ----------- | ------- |
  9. | LISTEN | Host and port for service to listen on | :80 |
  10. | POSTGRES | URL of postgres | postgresql://root@pg:5432/core?sslmode=disable |
  11. | REDIS | URL of redis | redis:6379 |
  12. ## API
  13. | Contents |
  14. | -------- |
  15. | Get Permission |
  16. ---
  17. ### Get Permission
  18. ```
  19. GET /user/:userid/conversation/:conversationid
  20. ```
  21. Query to see if userid-conversationid is permissable.
  22. #### Params
  23. | Name | Type | Description |
  24. | ---- | ---- | ----------- |
  25. | userid | String | User's ID |
  26. | conversationid | Conversation ID |
  27. #### Success (200 OK)
  28. Empty body.
  29. #### Errors
  30. It is recommended to intrepet both as a rejection regardless of error type.
  31. | Code | Description |
  32. | ---- | ----------- |
  33. | 401 | Matching userid-conversationid pair not found |
  34. | 500 | Error accessing cache |