Bug fixes for standard users getting logged out.

This commit is contained in:
kiswa 2014-10-17 13:49:25 -04:00
parent 85f22dc8af
commit ff54b36092
4 changed files with 12 additions and 9 deletions

View File

@ -93,7 +93,7 @@ $app->post('/autoactions', function() use($app, $jsonResponse) {
});
$app->get('/autoactions', function() use($app, $jsonResponse) {
if (validateToken(true)) {
if (validateToken()) {
$actions = R::findAll('autoaction');
$jsonResponse->addBeans($actions);
}

View File

@ -63,6 +63,9 @@ function ($scope, UserService, AlertService) {
$scope.actions = [];
$scope.actionsLoading = true;
$scope.updateActions = function() {
if ('1' !== $scope.currentUser.isAdmin) {
return;
}
UserService.actions()
.success(function(data) {
$scope.actions = data.data;

View File

@ -121,7 +121,7 @@ function ($scope, $interval, BoardService) {
return text;
};
$scope.updateActions = function(actions) {
$scope.updateAutoActions = function(actions) {
if (!actions) {
return;
}
@ -142,7 +142,7 @@ function ($scope, $interval, BoardService) {
$scope.loadActions = function() {
BoardService.getAutoActions()
.success(function(data) {
$scope.updateActions(data.data);
$scope.updateAutoActions(data.data);
$scope.loadingActions = false;
});
};
@ -168,7 +168,7 @@ function ($scope, $interval, BoardService) {
$scope.actionData.isSaving = false;
$scope.alerts.showAlerts(data.alerts);
if (data.alerts[0].type == 'success') {
$scope.updateActions(data.data);
$scope.updateAutoActions(data.data);
}
});
};
@ -179,7 +179,7 @@ function ($scope, $interval, BoardService) {
BoardService.removeAutoAction(actionId)
.success(function(data) {
$scope.alerts.showAlerts(data.alerts);
$scope.updateActions(data.data);
$scope.updateAutoActions(data.data);
});
};

View File

@ -14,13 +14,13 @@
</td>
</tr>
<tr data-ng-if="!loadingActions && !actions.length">
<td data-ng-if="!currentUser.isAdmin" colspan="4" align="center">
<td data-ng-if="currentUser.isAdmin == '0'" colspan="4" align="center">
There are no automatic actions. Contact an admin user to create one.
</td>
<td data-ng-if="currentUser.isAdmin && boards.length" colspan="4" align="center">
<td data-ng-if="currentUser.isAdmin == '1' && boards.length" colspan="4" align="center">
There are no current automatic actions. Use the <strong>Add Action</strong> form below to add one.
</td>
<td data-ng-if="currentUser.isAdmin && !boards.length" colspan="4" align="center">
<td data-ng-if="currentUser.isAdmin == '1' && !boards.length" colspan="4" align="center">
There are no current boards. Use the <strong>Add Board</strong> button above to add one.
</td>
</tr>
@ -38,7 +38,7 @@
</tbody>
</table>
</div>
<div data-ng-if="currentUser.isAdmin && boards.length">
<div data-ng-if="currentUser.isAdmin == '1' && boards.length">
<h4>Add Action</h4>
<fieldset data-ng-disabled="actionData.isSaving || loadingActions || currentBoard.loading">
<div class="form-group col-md-4">