Skip to content

What does the useMasterKey column in the _User class is useful for ? #4669

Closed

Description

@somq

I know there is a limitation where a given user can't edit any other users than himself (except by using masterkey) for security reasons.

I have a case (which seems trivial in this kind of dev) where I need to edit others users while one of my users is logged in as admin. I bypassed the issue by using a cloud function and checking by-hand if the user has the right role to edit another one.

By default in the _User class there exists a useMasterKey column. I guessed that this column could eventually be set only by using the masterkey and then the user would be able to CRUD on any object and behind the hood it would use the masterkey but it seems I'm wrong.

useMasterKey column

So, could you tell me what does this column is useful for ? Is there any dev planned behind it ? Am I using it the wrong way ?

Thanks in advance for your answers.

Activity

  1. flovilmart commented on Mar 22, 2018

    @flovilmart
    Contributor

    There's no useMasterKey column in the user table you may have created it when saving the user with

    user.save({useMasterKey: true})
    

    instead of user.save(null, {useMasterKey: true})  as per the correct usage of the API.

    http://parseplatform.org/Parse-SDK-JS/api/v1.11.1/Parse.Object.html#save

  2. somq commented on Mar 22, 2018

    @somq
    Author

    Many thanks @flovilmart. I must be exhausted not being able to think that out by myself...
    So, I'm having the right approach by using cloud function for the admin stuff ?

  3. flovilmart commented on Mar 22, 2018

    @flovilmart
    Contributor

    You should be fine as long as you roles are tightly controled.

  4. somq commented on Mar 22, 2018

    @somq
    Author

    Alright, thanks again for your answer, good evening!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions