Does beforeSave act different than the JS Client for Roles?

I have written a beforeSave trigger that I want to use to read the roles of the logged in user before saving a class:

Parse.Cloud.beforeSave('Project', async (request) => {
     const { object: project, user } = request
     const rQuery = new Parse.Query(Parse.Role)

     const roles = await rQuery.find()
     ....
})

This returns an empty array for the roles but:

const query = new Parse.Query(Parse.Role)
const user = await Parse.User.logIn("[email protected]", “123123”)

if (user) {
const results = await query.find()
.catch(console.log)
if (results) {
console.log(results)
}
}

Returns what I was expecting to return (a list of roles). Both pieces of code are using the same logged in user.

If I set the object level ACL to public read, it seems to work.

Hopefully that makes sense.

try const roles = await rQuery.find({ useMasterKey: true })

Thanks for responding. I had assumed it would run the queries based on the permissions of the logged in user, but I guess I’d just have to filter the roles query myself based on the user that is logged in.

Thanks for the help!