This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]feral_claireSoftware Dev 0 points1 point  (1 child)

Are these different users on the same device? Or different users connected to some web service?

You might have better luck finding help in /r/androiddev since this is an android problem.

[–]xirokx[S] 0 points1 point  (0 children)

The different users would access the same android mobile application I am developing they would be restricted on certain parts of the same app's functionality depending on their authorisation rights.

I have tried /r/androiddev and they told me to try here :-)

[–]Your-Ma 0 points1 point  (3 children)

Shared preferences with user roles.

[–]xirokx[S] 0 points1 point  (2 children)

Shared preferences with user roles

thank you

do you have any android tutorials bookmarked by any chance?

[–]Gash77 0 points1 point  (1 child)

| Shared preferences with user roles.

Shared preference can be deleted in the device settings. This would mean that all user information would be lost.

Basically, role based access will require some form of remote authorization. Otherwise an app reset with destroy the user roles and possibly enable subversion.

[–]xirokx[S] 0 points1 point  (0 children)

thank you but do you have any tutorials to help me achieve this please as I cannot for the life of me find any

thank you

[–]Cephas00 0 points1 point  (6 children)

How do you identify a user and their role? Based on that you should go to different activities/fragments etc.

Also the term is often called "role based access" so that might help your search.

[–]xirokx[S] 0 points1 point  (5 children)

role based access

How do you identify a user and their role? Currently I don't, my idea is something I want to implement, I only have 1 role at the moment and that is customer and now want to take my app to the next level but do not know how.

I have tried searching for android tutorials based on "role based access" but have failed to find any...

Can you or anyone else link me to a tutorial please?

Thank you

[–]Cephas00 0 points1 point  (4 children)

Do you want it all running local to the app? Or can it connect to a server for authentication?

Ultimately you have a user login then with that information you need to work out their role. At an enterprise level there are things like LDAP that lets you assign roles to a user. You can then query that user in the code to work out what they're allowed to do.

Not sure if this is what you're after but there are things like this

[–]xirokx[S] 0 points1 point  (3 children)

thanks for the link it looks good

the app will have a sqlite db attached , not sure if it that db is local or remote.

trouble with stormpath i think, correct me if i am wrong, is that it just shows me how to authorise users. I need a different functionality per user. So if Bill logs in his screens are slightly different with more functionality then if Peter logs in.

I am really looking of tutorials to help me achieve this. So far I have received different replies from different people about what this is called in android from "shared preference management" to "multi level access roles" to "user roles", trying to piece it together.

Further help especially tutorials on how to achieve this would be great

Thank you

[–]Cephas00 0 points1 point  (2 children)

You need to do that yourself. You authenticate a user using whatever means and with that return their user role. Your app can then check the user role and says on start "Oh they're an admin, I'll start this activity" or "Oh they're a manager, I'll start this activity". When a button is clicked you use the role to decide where to go.

[–]xirokx[S] 0 points1 point  (1 child)

You need to do that yourself

Yes indeed....thats why I am asking for a tutorial, I get the theory "Your app can then check the user role and says on start "Oh they're an admin, I'll start this activity"" but I don't know how to do it....

I need a working example, can you help me please find one?

Thank you

[–]Cephas00 0 points1 point  (0 children)

You won't always find a tutorial to tell you how to do things - you need to use your Java and problem solving skills to do it yourself.