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.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. angular.module('camotionAdmin')
  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.canSeeLuticate = function()
  32. {
  33. return luticateAuthCache.hasOneEffectivePermission(["LU_USER_GET","LU_GROUP_GET", "LU_PERM_GET"]);
  34. };
  35. }]);