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) { $app->get('/autoactions', function() use($app, $jsonResponse) {
if (validateToken(true)) { if (validateToken()) {
$actions = R::findAll('autoaction'); $actions = R::findAll('autoaction');
$jsonResponse->addBeans($actions); $jsonResponse->addBeans($actions);
} }

View File

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

View File

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

View File

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