mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 11:23:48 +01:00
Closes #216: redirect to login if not connected
This commit is contained in:
parent
5d9b87dace
commit
785ad7f3a1
@ -203,7 +203,6 @@ public class DocumentDao {
|
||||
Map<String, Object> parameterMap = new HashMap<>();
|
||||
List<String> criteriaList = new ArrayList<>();
|
||||
|
||||
// TODO Simplify SELECT clause for count(*)
|
||||
StringBuilder sb = new StringBuilder("select distinct d.DOC_ID_C c0, d.DOC_TITLE_C c1, d.DOC_DESCRIPTION_C c2, d.DOC_CREATEDATE_D c3, d.DOC_LANGUAGE_C c4, ");
|
||||
sb.append(" s.count c5, ");
|
||||
sb.append(" f.count c6, ");
|
||||
|
@ -23,8 +23,7 @@ angular.module('docs',
|
||||
url: '',
|
||||
views: {
|
||||
'page': {
|
||||
templateUrl: 'partial/docs/main.html',
|
||||
controller: 'Main'
|
||||
templateUrl: 'partial/docs/main.html'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1,18 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Main controller.
|
||||
*/
|
||||
angular.module('docs').controller('Main', function($scope, $rootScope, $state, User) {
|
||||
User.userInfo().then(function(data) {
|
||||
if (data.anonymous) {
|
||||
$state.go('login', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
} else {
|
||||
$state.go('document.default', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@ -6,6 +6,15 @@
|
||||
angular.module('docs').controller('Navigation', function($scope, $state, $rootScope, User) {
|
||||
User.userInfo().then(function(data) {
|
||||
$rootScope.userInfo = data;
|
||||
if (data.anonymous) {
|
||||
$state.go('login', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
} else {
|
||||
$state.go('document.default', {}, {
|
||||
location: 'replace'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,6 @@
|
||||
angular.module('docs').controller('Settings', function($scope, User) {
|
||||
// Flag if the user is admin
|
||||
User.userInfo().then(function(data) {
|
||||
$scope.isAdmin = data.base_functions.indexOf('ADMIN') != -1;
|
||||
$scope.isAdmin = data.base_functions.indexOf('ADMIN') !== -1;
|
||||
})
|
||||
});
|
@ -48,7 +48,6 @@
|
||||
<script src="lib/angular.qrcode.js" type="text/javascript"></script>
|
||||
<script src="lib/angular.timeago.js" type="text/javascript"></script>
|
||||
<script src="app/docs/app.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Main.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/Login.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/ModalPasswordLost.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/ModalFeedback.js" type="text/javascript"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user