I have a system where I log in to a user, if all right, the server returns an object and I store that object in sessionStorage
. I can retrieve this object to do some validations, eg render some components according to the user's permission.
I would like to block some routes according to the user's permission, that is, if the user has permissão = 2
he will not be able to access this route: /usuario
The route configuration is as follows:
angular.module("oraculo").config(function($routeProvider){
$routeProvider.when("/usuario", {
templateUrl: "public/views/usuario.html",
controller: "usuarioCtrl"
});
$routeProvider.otherwise({redirectTo: "/login"});
});