You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

navbar.controller.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. angular.module('app')
  5. .controller('NavBarController', ['$scope', 'luticateAuthCache', 'luticateAuthUsers', '$state',
  6. function($scope, luticateAuthCache, luticateAuthUsers, $state) {
  7. $scope.logout = function()
  8. {
  9. var promiseLogout = {
  10. id: "promiseLogout",
  11. loaderGroups: ["body"]
  12. };
  13. luticateAuthUsers.logout(promiseLogout).finally(function()
  14. {
  15. $state.go('login');
  16. });
  17. };
  18. $scope.isLogged = function()
  19. {
  20. var user = luticateAuthCache.getUser();
  21. return user != null && user.Id != 0;
  22. };
  23. $scope.getUsername = function()
  24. {
  25. var user = luticateAuthCache.getUser();
  26. if (user != null) {
  27. return user.Username;
  28. }
  29. return "";
  30. };
  31. $scope.canSeeAdmin = function()
  32. {
  33. return luticateAuthCache.hasOneEffectivePermission([
  34. "LU_USER_GET",
  35. "LU_GROUP_GET",
  36. "LU_PERM_GET",
  37. "ADMIN_PERMISSION"
  38. ]);
  39. };
  40. }]);