0
I’m working on an app project for a company and I ended up getting into a problem I didn’t find how to review it.
I would like to limit access to certain parts of the app to different users.
Ex.: would like the company administrators with their logins to see things in the app that employees, with their logins, could not see.
- Allow exclusive pages to administrators only, making other users unable to access.
I’m using Firebase and Android Studio, would like to know if there is a class or API for this.
You can use the logic of our friend Edson Reis, I have no knowledge of Android development, but usually for permissions is made in the way he quoted. Another cool way is to create a class that will carry out the control of the pages by user level, inside you can put a
switch case
Czech will return aarray
or other amounts authorizing or not access. You could return aboolean
and play all admin pages within an array for example. Then just check the switch case to see if administrators have access to a particular page.– Tiago Boeing
I decided not to answer your question with an example, because by not understand Android programming may not be what you expect.
– Tiago Boeing
In short, make a method:
private Boolean checaAcessoPagina(String nivelPermissao){}
- within the method use aswitch case(nivelPermissao)
to differentiate levels, can be "admin, user, Visitor, etc". So now it’s up to you, just a more practical suggestion.– Tiago Boeing
Check out this discussion (I don’t know if I can post external links here): http://respostas.guj.com.br/1529-controle-de-acesso-com-android
– Tiago Boeing