G-Node / tonic

Framework for building services that interact with GIN
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

Lab project: Test for team membership #25

Open achilleas-k opened 4 years ago

achilleas-k commented 4 years ago

If a user specifies a team for the new project and they're not a member, the creation should fail. This requires an API endpoint for retrieving a list of members for a team, or a list of teams that a user is a member of.

jcolomb commented 4 years ago

Indeed, the best would be a dropdown menu of teams he is part of (so the user cannot specify a team is not in).

jcolomb commented 4 years ago

Unfortunately, testing a user for team membership isn't supported by the GIN API currently

Since the organisation is specified first, one can get member lists for all teams of the orga. GET /orgs/:orgname/teams then get member list for each team: GET /admin/teams/:teamid/members

and then check whether the user is part of each team. (it seems one needs admin rights at the moment ?)

This way, there is no need to work the gogs API.

achilleas-k commented 4 years ago

Right, I misspoke (typed): The API endpoint exists, but it's not exposed in the client.

Indeed, the best would be a dropdown menu of teams he is part of (so the user cannot specify a team is not in).

But then there wouldn't be a way to specify a new team name. So we need a free text field, which allows specification of an existing team.

There's also another issue: The forms, in their current state, are static (once rendered), so we can't change the team list after the org is selected. It would be possible, but I don't want to overcomplicate things. Currently, the Team entry is a free text field with suggestions from the team list of all the organisations that the user belongs to.

achilleas-k commented 4 years ago

Right, I misspoke (typed): The API endpoint exists, but it's not exposed in the client.

To clarify, I'd like to add the entry in the client rather than hack around it in the microservice.

jcolomb commented 4 years ago

I am wondering if we should not abandon the idea for the first version and implement it nicely later. Having a "hack-looking" team name entry may make things more complicated and disturb the users. ?

(it also looks like doing some work to get a working but messy function, because we do not have the time to create the full featured version, while the latter will not use the functions we create for the messy function...)

achilleas-k commented 4 years ago

We could. Let's keep it in the code. It can be disabled with a single line change later when we finally deploy it if we're not happy and then it will fall back to using the project name.

achilleas-k commented 4 years ago

Issue will be solvable once gogs/go-gogs-client#121 is merged.