1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-14 00:46:38 -05:00
shimapan/app/public/panel/controllers/NavCtrl.js

16 lines
494 B
JavaScript
Raw Normal View History

var angular = require('angular');
2017-10-14 15:16:58 -04:00
angular.module('NavCtrl', ['AuthSvc']).controller('NavController', ['$scope', '$window', 'AuthService', function($scope, $window, AuthService) {
2017-10-18 13:31:08 -04:00
$scope.user = {};
AuthService.currentUser(function(user) {
$scope.user = user;
});
2017-10-14 15:16:58 -04:00
$scope.logout = AuthService.logout;
$scope.hasPermission = function(permission) {
2017-10-18 13:31:08 -04:00
if (!$scope.user.scope) return false;
return $scope.user.scope.indexOf(permission) !== -1;
2017-10-14 15:16:58 -04:00
};
}]);