angular.module('camotionAdmin')
    .controller('HomeController', ['$scope', '$state', 'luticateAuthCache',
        function($scope, $state, luticateAuthCache) {

            if (luticateAuthCache.hasEffectivePermission("CAMOTION_CAMERA_GET")) {
                $state.go('cameras');
            }
            else if (luticateAuthCache.hasEffectivePermission("CAMOTION_SENSOR_GET")) {
                $state.go('sensors');
            }
            else if (luticateAuthCache.hasEffectivePermission("CAMOTION_COMMAND_GET")) {
                $state.go('commands');
            }
            else {
                $state.go('login');
            }
    }]);