-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Endpoint
- Endpoint /project/123/people
- Method: POST
Body:
-
Should be json-schema validated
-
Should have 3 properties:
href
androle
andname
-
Role should be one of "member", "manager", "owner".
-
'href' should be in the format
mailto:[email protected]
Form
I recommend you make a 'HAL Form' on the /project/123
endpoint with those 2 fields so it's easy test.
Once you get to this point, I think this is already a good place for the first PR even if the endpoint doesn't do anything yet.
Step 2: Figuring out the principal
With the 'href' in mind, you can call the /user/byhref/{href}
endpoint on a12nserver using the ketting client in this repository. Replace {href}
with the one you got from the body.
There's 2 possible outcomes:
- You got principal information (great)
- You got a 404.
If you got the 404, create a new principal on a12nserver by doing a POST
request on /users
. After this you should get a new principal uri.
This means at this point you have a principal uri for the resource, whether a new principal created, or not.
This is another good checkpoint for a PR.
Step 3: Finding the tt-api 'person'
Now you have a principal URI, see if a user exists in your people
table with that same uri. If it doesn't exists, create the new record.
This is another PR
Step 4: Add the privilege entry
You can do this with the existing addUserPrivilege function in a12n.ts
Done!
Metadata
Metadata
Assignees
Labels
Type
Projects
Status