naturerobots / HSOS-SEP-PlantMap-2022

PlantMap Digital Logbook: A tool to support sustainable micro farming :link: https://naturerobots.github.io/HSOS-SEP-PlantMap-2022/
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

Permission endpoints #213

Closed dobro929 closed 2 years ago

dobro929 commented 2 years ago

Im not sure if the permission system works that way. How do I as admin get the user_id of the user I want to give rights to? Example: POST: /companies/{company_id}/createPermission

{
  "user_id": "42",
  "permission": "a"
}
pbrozi commented 2 years ago

The user you want to give permissions currently needs to tell you his or her id. The user can obtain it with GET: /user.

Would it make sense to implement an endpoint to get the user id from a user specified by username? This endpoint would be accessible for any registered user.

dobro929 commented 2 years ago

I think the better solution is to replace user_id with username and the server then searches for the user_id itself.