parse-server
parse-server copied to clipboard
feat: Pass the set of roles the user has to triggers and cloud functions
trafficstars
Pull Request
- Report security issues confidentially.
- Any contribution is under this license.
- Link this pull request to an issue.
Issue
Closes: #9298
Approach
Expose a field getRoles to cloud functions and triggers if the caller is a user. The field, if it exists, is an async function that resolves to a list of strings, which is the set of roles the user has.
The exposed function uses Parse's internal cache of user roles, if it is populated. Otherwise, it queries the set of roles and populates the cache before returning them.
Tasks
- [x] Add tests
- [ ] Add changes to documentation (guides, repository pages, code comments)