1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-13 00:26:55 -05:00

Improve scope checking readability

This commit is contained in:
Jack Foltz 2018-01-15 18:13:59 -05:00
parent d3bef194ff
commit c7e58c490f
Signed by: foltik
GPG Key ID: 303F88F996E95541

View File

@ -9,7 +9,7 @@ angular.module('NavCtrl', ['AuthSvc']).controller('NavController', ['$scope', '$
$scope.logout = AuthService.logout;
$scope.hasPermission = function(permission) {
if (!$scope.user.scope) return false;
return $scope.user.scope.indexOf(permission) !== -1;
return ($scope.user && $scope.user.scope &&
$scope.user.scope.indexOf(permission) !== -1);
};
}]);