1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-12-04 19:32:20 -05:00
shimapan/app/public/panel/controllers/NavCtrl.js

15 lines
485 B
JavaScript
Raw Permalink 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 = {};
2018-08-14 05:14:26 -04:00
AuthService.whoami(data => {
$scope.user = data;
2017-10-18 13:31:08 -04:00
});
2017-10-14 15:16:58 -04:00
$scope.logout = AuthService.logout;
$scope.hasPermission = function(permission) {
2018-01-15 18:13:59 -05:00
return ($scope.user && $scope.user.scope &&
$scope.user.scope.indexOf(permission) !== -1);
2017-10-14 15:16:58 -04:00
};
}]);