Search code examples
react-nativefacebook-loginparse-server

Parse Server app with only one admin user who can change data via Facebook login


Newbie to Parse Server here.

I have an app which reads data from Parse Server and displays it to users without logging them in.

I want to create another 'Admin' app which will allow ONLY ONE pre-populated admin user to login and change the data. Is this possible via Facebook login? I would prefer Facebook login because with normal (user, password) login I can't implement 2FA easily on Parse Server. Facebook login would take care of the issue since the user is already logged into Facebook using 2FA.

Is this possible? Any suggestions / pointers would be appreciated. I am coding both apps in React Native. The first app is complete.


Solution

  • The type of login has nothing to do with the abilities a user has. The simplest solution for your desired setup is using class-level permissions:

    • create a new Role object and name it accordingly, e.g. admin
    • add your admin user to that role
    • set class-level permissions for your data classes: grant public read access, limit write access to the admin role

    Now every user can see all the data, but only members of the admin role are able to manipulate them. If you want you can add more users to the role to also give them write access.

    BTW: all these steps can be performed in Parse Dashboard, no coding required.

    EDIT

    Actually you can have it even simpler, the class-level permissions can also be granted to a single user -- so no need for a role, if you really only need one admin.