Stefan Zier
Posts: 0
Joined: Sun Jun 01, 2014 7:22 pm

How do I differentiate types of users on my app?

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!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How do I differentiate types of users on my app?

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.

Stefan Zier
Posts: 0
Joined: Sun Jun 01, 2014 7:22 pm

How do I differentiate types of users on my app?

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!

Stefan Zier
Posts: 0
Joined: Sun Jun 01, 2014 7:22 pm

How do I differentiate types of users on my app?

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!

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How do I differentiate types of users on my app?

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...

Stefan Zier
Posts: 0
Joined: Sun Jun 01, 2014 7:22 pm

How do I differentiate types of users on my app?

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?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How do I differentiate types of users on my app?

Stefan,

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

Stefan Zier
Posts: 0
Joined: Sun Jun 01, 2014 7:22 pm

How do I differentiate types of users on my app?

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How do I differentiate types of users on my app?

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...

Stefan Zier
Posts: 0
Joined: Sun Jun 01, 2014 7:22 pm

How do I differentiate types of users on my app?

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.

Return to “Issues”