-
Notifications
You must be signed in to change notification settings - Fork 24
Allow admins to make updates to any experiment. #917
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
Conversation
vivtsai
left a comment
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.
The title of the PR is misleading—it says "updates to any experiment," but the changes here are only regarding cohort editing (not, for instance, experiment deletion). Could we either rename the PR or include the other update cases?
functions/src/utils/auth-guard.ts
Outdated
| const allowlistDoc = await app | ||
| .firestore() | ||
| .collection('allowlist') | ||
| .doc(email || '') |
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.
The empty string case will throw a Firebase error—maybe just check for whether email is valid before this line?
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.
Done!
vivtsai
left a comment
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.
One more thing! I'm thinking we want this check to be in the functions in functions/src/experiment.utils.ts so that the REST API calls also enable admins to edit. WDYT?
…AdminEmail` checks into utility functions and removing `isCreatorOrAdmin` checks from endpoints.
Description
If a user has isAdmin: true, they should be able to modify any experiment.
Modify.backed.webm
Related issues
This PR fixes: #916, #824