Closed dobro929 closed 2 years ago
@dobro929 Do you have to have any special Beds
config for the gardens?
@pbrozi It is currently not possible to add the same garden to multiple companies, due to the 1 to 0...n relationship between them. Could you look into that?
@jarkenau No, we don't need any special configs, just beds 😆
@jarkenau We never talked about a garden belonging to multiple companies. One garden is owned by exactly one company but you can already give access to a garden to any user you want. Isn't that sufficient? Otherwise many changes would be necessary.
@pbrozi Never mind, I misunderstood the tables from Timo, everything is fine :grin:
@jarkenau Im logged in as Gardener-3
and i have access to garden (id: 4), where do i get the company id from?
Request i have access to: companies/4/gardens/4
The endpoint GET: companies/{company_id}/gardens
returns all gardens of the requested company (company id is in the URL) the user has permissions on.
@pbrozi Yes, but where do i get the company id from?
GET: companies/{company_id}/gardens
returns currently 403 Forbidden
To access this endpoint, the requesting user has to be user of the company, otherwise anyone could see which gardens a company has. To get all companies the user has permissions on, use the endpoint GET: companies
.
GET: companies
200 but empty array ❌
GET: companies/4/gardens
403 Forbidden ❌
GET: companies/4/gardens/4
200 garden object ✔️
Okay, I see. If a user has user permissions on a company, he cannot access any gardens. Garden permissions for each garden need to be set, too. If you only have permission for a single garden, you cannot obtain the corresponding company id.
I would implement the following changes:
GET: gardens
to get all gardens the user has access on.@fmarahre and I just noticed that with the latest updates the endpoint GET: companies/{company_id}/gardens/{garden_id}/beds
does not work anymore. Even as Admin we get 403 Forbidden.
I've been thinking about some demo data to match each case 🤔
Please give the marked gardeners this picture and the coordinates.