Page 1 of 2

How do I differentiate types of users on my app?

Posted: Tue Jun 03, 2014 6:14 am
by Stefan Zier

Hello! Yet another question!

I have tried to figure this out for awhile but have gotten absolutely nowhere. Here's what I want to have:

  • Two types of users: "Providers" and "Clients"

  • This differentiation will occur in the sign up process where the user will get to choose what type of user they want to be (currently I have been trying to figure this out by supplying two checkmark boxes to choose from)

  • The Providers will be able to upload their picture, a short bio, etc.

  • The Clients will only be permitted to choose their age, sex, picture, and location.

    So.. How does one go about the process to achieve this? I'd appreciate any help that can be provided. Thank you!


How do I differentiate types of users on my app?

Posted: Tue Jun 03, 2014 7:28 am
by Evgene Karachevtsev

Hello Stefan,

You should add field "role" to user collection. There you will store user role (provider or client). When user is signed check user role and adjust UI to current permission.


How do I differentiate types of users on my app?

Posted: Wed Jun 04, 2014 3:49 am
by Stefan Zier

Thank you so much for the info, Evgene! How might I do this? I have attempted but am unsure of where to do this.

If you could please provide me with steps necessary to a) change the role and b)change the user's UI that corresponds with the role that would be amazing!

I apologize as I am still very new to Appery and will hopefully get the hang of it soon. Thanks again!


How do I differentiate types of users on my app?

Posted: Wed Jun 04, 2014 6:41 pm
by Stefan Zier

Hi Evgene,

I have added a new column to the "Users" tab in my Database and named it "role."

Is this the right step to take first? I'd appreciate it if you can provide me with feedback on this and further steps I need to take to solve my problem.

Thank you!


How do I differentiate types of users on my app?

Posted: Wed Jun 04, 2014 8:04 pm
by Alena Prykhodko

Correct. Now add there value for each user. You wiil be able to read them as shown in the doc: http://devcenter.appery.io/documentat...


How do I differentiate types of users on my app?

Posted: Wed Jun 04, 2014 11:27 pm
by Stefan Zier

Thank you! I have tried this but I would like the user to be able to assign himself/herself the role in the sign up process. I created checkboxes to do so, but cannot seem to find a way that links this up to the DB to display the "Role" value.
Image SignUp View

Any ideas?


How do I differentiate types of users on my app?

Posted: Thu Jun 05, 2014 10:47 am
by Evgene Karachevtsev

Stefan,

In your signup service please add request parameter "role" and fill it needing values: Image


How do I differentiate types of users on my app?

Posted: Fri Jun 06, 2014 5:22 am
by Stefan Zier

Hello! Thank you for the help. I have already added that but am confused as to how I take the checkbox mark in the sign up view and connect that to the "role" parameter.

Thanks again and I appreciate all the help you are providing me because I am learning


How do I differentiate types of users on my app?

Posted: Fri Jun 06, 2014 12:59 pm
by Kateryna Grynko

Hi Stefan,

If the roles of "providers" and "client" are mutually exclusive you better use component radiobutton. You can get a selected value as in the documentation:
http://devcenter.appery.io/documentat...

Run this JavaScript to get this value right in service mapping: http://devcenter.appery.io/documentat...


How do I differentiate types of users on my app?

Posted: Sat Jun 07, 2014 1:58 am
by Stefan Zier

Thank you so much Katya!

So after adding in your input I could only get the DB to display "true" under the "Role" column because the second piece of code added to the "Role" parameter wouldn't let the user signup. Here are the pictures of what's going on.

This is the code added in:
Image

After the user creates a username, password, and clicks "client" or "provider," the "Done" button does not work and the user cannot signup. However if the code from the "Role" parameter is removed the signup works but the "Role" column in the DB only displays "true"
Image

Thanks again. Any ideas? I will keep working at it and update you if I am able to fix it.