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

Feat: add endpoint to check if user has access to site #89

Merged
merged 2 commits into from
Dec 8, 2020

Conversation

alexanderleegs
Copy link
Contributor

This PR adds a new endpoint to check if users have access to a given site. To be reviewed in conjunction with PR#280 on the isomercms-frontend repo.

To check if a user has access to a site, we check if the user is one of the collaborators on that repo, and throw an error message if either the site does not exist or the user does not have the appropriate permissions. We have opted to throw the same 404 error in both of these cases.

kwajiehao
kwajiehao previously approved these changes Dec 8, 2020
Copy link
Contributor

@kwajiehao kwajiehao left a comment

Choose a reason for hiding this comment

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

lgtm

leaving a comment here for posterity: we can choose to rethrow the error as a 401 or 403 in the future, but a 404 will do for now

routes/sites.js Outdated
"Content-Type": "application/json",
}
})
console.log(resp)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this log statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops thanks for catch that, resolved in ba92d4b

Copy link
Contributor

@kwajiehao kwajiehao left a comment

Choose a reason for hiding this comment

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

lgtm

@alexanderleegs alexanderleegs merged commit f54dbf4 into staging Dec 8, 2020
@alexanderleegs alexanderleegs deleted the feat/add-write-access-check branch December 8, 2020 05:53
@kwajiehao kwajiehao mentioned this pull request Dec 9, 2020
harishv7 pushed a commit that referenced this pull request Feb 17, 2023
* Feat: add endpoint to check if user has access to site

* Fix: remove log statement
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.

2 participants