parse-community / parse-community/parse-server
Add method to get all roles of a `Parse.User`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
Current Limitation
Currently, to get what Roles a user has been assigned, you would need have your own method either to run a query to get Roles the current user has.
Feature / Enhancement Description
I'm hoping that we have a getUserRoles method on the Parse.User object where we can just call the currentUser object and receive an array of Role objects the user has been assigned.
Example Use Case
let currentUserRoles = currentUser.getUserRoles()
Alternatives / Workarounds
Currently, we have to make our own method to run the query like so
Parse.Cloud.define("getUserRoles", async (request) => {
const { user } = request
return await new Parse.Query(Parse.Role).equalTo("users", user).find({useMasterKey:true})
}, {
requireAnyUserRoles: ["admin"]
})
3rd Party References
none that I can think of.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the Parse.User, Parse.Role, Parse.Query, and Parse.Cloud entry points named in the issue to determine where a user-to-role lookup belongs and how the public method should expose it. Define the expected behavior for the current user and confirm that the completed method returns the assigned Role objects without requiring a custom Cloud function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- authorization, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100