1
0
mirror of https://github.com/Foltik/Shimapan synced 2025-02-12 20:27:33 -05:00
shimapan/public/js/shimapan-panel/controllers/NavCtrl.js
2017-10-14 15:16:58 -04:00

17 lines
620 B
JavaScript

angular.module('NavCtrl', ['AuthSvc']).controller('NavController', ['$scope', '$window', 'AuthService', function($scope, $window, AuthService) {
$scope.isLoggedIn = AuthService.isLoggedIn();
$scope.currentUser = AuthService.currentUser();
$scope.currentScope = AuthService.currentScope();
$scope.logout = AuthService.logout;
$scope.goLogout = function() {
$scope.logout();
$window.location.href = '/';
};
$scope.hasPermission = function(permission) {
if (!$scope.currentScope) return false;
return $scope.currentScope.indexOf(permission) !== -1;
};
}]);