**In order to control which user have permission to access a page in the application like in web application we can control that by user roles
in the controller or in pege.cs file in razor pages we do it like
[Authorize(Roles = "Manager,Administrator")]
public class DocumentsController : Controller
{
//Action methods
}
, how to do this authorization in xamarin forms**
Try to verify the role before navigating like:
if (role == "Administrator" && role == "Manager") { //Navigation.PushAsync(); } else { //DisplayAlert(); }
As I posted here:
https://forums.xamarin.com/discussion/184183/control-access-of-the-user
Answers
Try to verify the role before navigating like:
As I posted here:
https://forums.xamarin.com/discussion/184183/control-access-of-the-user
Thank you @LandLu
In case if we have multilevel pages and controls than how to manage that for example
admin user have the full access to the all pages
1) Main page
1.1) Save Idea page
1.1.1) Edit Idea
1.1.2) Delete Idea
1.2 Report Page
new if I want a user to access only to delete Ideas than I have to check the user role in every level (1 Main page and 1.1.2 delete idea page) ???
Or
If a user have only access to the report page than
Yes. Each time you want to navigate to a role page, you need to check the verification first before the navigation.