Custom Role Permissions to manage features on the UI

Hi!
I am new to parse and wanting to give parse server a try. I have been reading the documentation and tutorials but I am not able to understand the Roles and Permissions part clearly.

Q1

So, basically when a backend is developed from scratch, it typically has Users, Roles and Permissions which is similar to what parse also provides for data classes. But there are cases where sometimes features and functionality are also put behind permissions. For example, a simple permission ALLOW_PRODUCT_EXPORT when given to a Role, will show an “Export to CSV” button on the UI for all the users who are part of that role.
In parse server terminology “Export to CSV” would have to be a data class so that a read role can be assigned to it, but it does not make sense that way.

So, how can the above custom permissions functionality be handled in parse server?

Q2

I was also not able to figure out how to bring the permissions of data classes a user has on to the UI so that features on the UI can be managed accordingly.
The aim being to allow the user to show edit UI or show read only mode UI for some data.

For example, I have a list of products in tabular format on my UI, the UI component is the same across all users. If a user with role “Store_Keeper” views that page, I should be able to show him an “Edit” button based on his role ACL(read and edit) but if a user with “Sales” views the same page, he should not be able to see the “Edit” button on his screen based on his role ACL(edit).

So, basically in terms of managing the UI, how can I get the info from parse server to the UI to see if the currently logged in user is allowed to edit the data he is currently viewing?

Appreciate your help! thanks.

Q1 - “Export to CSV” would probably be a cloud code function, and not a class. You can create the “ALLOW_PRODUCT_EXPORT” role and validate if the user has this role in the beginning of your cloud code function.

Q2 - What is the technology that you are using on your client?

Firstly Thanks for the reply!

So, basically each such permission (ex ALLOW_PRODUCT_EXPORT) can be a role in parse terminology.

So can multiple roles be assigned to a single user?

I usually work on web apps, so the client can be any from angular, react or vue.

Yes. A user can have multiple roles. In order to retrieve the user’s roles you can do something like await new Parse.Query(Parse.Role).equalTo('users', user).find({ useMasterKey: true }) in a cloud code function.