Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the privilege entry #53

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

syedfkabir
Copy link
Contributor

Changes

  • addPersonToProject() now returns a Person
  • using addUserPrivilege in the person-collection, we are adding the new Person as a with the designated role

const person = await projectService.addPersonToProject(params);

await addUserPrivilege(
person.principalUri,
Copy link
Contributor Author

@syedfkabir syedfkabir Oct 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @evert, this is giving me an error.
Also, wondering if I was on the right track. My intuition is, I should also be adding the project.href instead of the person.href on line 27.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section should go into the projectService instead, because it's all part of 'adding a person to a project'. There you should also not have this issue because you always have a principalUrl.

params.role,
new URL(project.href, ctx.request.origin),
);
await projectService.addPersonToProject(params, projectId, origin);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this object is now starting to look really weird. What are params, what aren't params? Why are some things in params? Decide on a path, either a parameters object, or do every argument separately.

Also generally avoid passing something like a projectId, you always want to pass the full object.

return person;
project = await findById(projectId);

} finally {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good use of finally. Just leave this outside of this block. It now runs even if there's other errors happening, and we really don't want that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants