-
Notifications
You must be signed in to change notification settings - Fork 19
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
Protect asset create endpoint #263
base: main
Are you sure you want to change the base?
Conversation
My changes in #264 throws a wrench in your work. Happy to pair on merge conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't assets with that are "offers"/ "donations" created by users without orgs? It's only the "request" asset type that needs this guard.
@@ -59,6 +59,17 @@ export class UserOrganizationsService { | |||
return userOrg; | |||
} | |||
|
|||
async getAllByUserId(userId: number): Promise<UserOrganization[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder that relations do this for us. I.e, we already have a method on the user entity, user.organizations, that does the same thing as this method.
This sounds right. |
Dev Summary
only a user that is part of an org should be able to create an asset/post
to do this i added a new auth guard and used it on the endpoint
still to do -> fix the test that's breaking locally
(later to come, checking that updating/deleting a post can only be done by user within poster's org)
Test Plan
repro steps:
for these tests you can see that i have the seeded users and orgs, but i also inserted into user_orgs userId, organizationsId values 1, 1 to create a relationship between my user 1 and the first org
Resources