Call succeeding despite requireMaster

In the docs (https://docs.moralis.io/moralis-server/cloud-code/cloud-functions#more-advanced-validation)
it says:

Moralis.Cloud.beforeSave(Moralis.User, () => {
  // any additional beforeSave logic here
}, {
    fields: {
      accType: {
        default: 'viewer',
        constant: true
      },
    },
});

that the field accType on Moralis.User will be ‘viewer’ on signup, and will be unchangeable, unless masterKey is provided.

Nonetheless, in the same cloud beforeSave trigger, I am able to call
request.object.set("accType", "moderator");
successfully without a master key.

How is this possible?

1 Like

I’ll have to test it too

1 Like

Any info on this one?

Didn’t test it yet, I will get back to you

What you mean by this part? How did you do it? Can you share your code?

I tested it now and it seems to work, after adding that code, I couldn’t modify that column from browser console directly. The cloud function code is something that you control.