Skip to content

New Endpoint: Add a Person to Project #47

@syedfkabir

Description

@syedfkabir

Endpoint

  • Endpoint /project/123/people
  • Method: POST

Body:

  1. Should be json-schema validated

  2. Should have 3 properties: href and role and name

  3. Role should be one of "member", "manager", "owner".

  4. '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:

  1. You got principal information (great)
  2. 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

enhancementNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions