Hi, i’m new to backendless so please help me in this issue.
i want to know how can i create multiple users table .
e.g: In my project there are two actors , workshop admin and car user each with different relationship to data service tables
so i need to create two tables in Users for login purposes so how can i do that because there in no option i have seen . kindly help
Hello,
When you say “i need to create two tables in Users”, did you mean to say “two user objects in the Users” table?
From what I understood, you need to differentiate between the roles of users (admin and car-user), but you also want to have different relationships between the User object and other tables depending on the roles, is that correct?
Regards,
Mark
yeah correct .
But , user objects refers to ROWS of Users table .
and i want two Users tables because both actor (Admin and car-user) have different properties except name , email , password.
Understood. At the present moment it is not possible to have multiple tables containing Users. This is done for the reason that all information required for user authentication (regardless of the role they are in) is contained in the same Users table. However, it is possible for you to restrict access to specific related tables based on the role a user is in. In order to make this happen, you would need to add a custom server-side event handler for the “afterLogin” event. The event is triggered every time a user logs in. In the handler code, you can check what role the user belongs to and then depending on the role, remove properties which the user should not have access to.
Regards,
Mark
Understood.
But according to this logic i must need to add “beforeRegistration” server-side event handler that removes the properties that are ‘not null’ and also not related to the user who is signing-up based on the role a user is in . And the event triggered every time when any new user registers in app .
There’s another problem for me is that i’m new to this and i don’t know how to add custom server-side event handler although i understood the logic .
i’ll be very thankful if you provide me any exemplary code or related material for this.
Hi,
you can start from this page:
https://backendless.com/documentation/business-logic/java/bl_eventhandlers_getting_started_java.htm
Thanks Mark Piller and Stanislaw Grin .