Hide admin only menu in settings tab

This commit is contained in:
jendib 2013-08-12 21:20:34 +02:00
parent 10a7be01f5
commit c37fb1d4ae
2 changed files with 7 additions and 3 deletions

View File

@ -4,4 +4,8 @@
* Settings controller. * Settings controller.
*/ */
App.controller('Settings', function($scope, Restangular) { App.controller('Settings', function($scope, Restangular) {
// Flag if the user is admin
$scope.userInfo.then(function (data) {
$scope.isAdmin = data.base_functions.indexOf('ADMIN') != -1;
});
}); });

View File

@ -6,9 +6,9 @@
<li ng-class="{active: $uiRoute}" ui-route="/settings/account"><a href="#/settings/account">User account</a></li> <li ng-class="{active: $uiRoute}" ui-route="/settings/account"><a href="#/settings/account">User account</a></li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/session"><a href="#/settings/session">Opened sessions</a></li> <li ng-class="{active: $uiRoute}" ui-route="/settings/session"><a href="#/settings/session">Opened sessions</a></li>
<li class="nav-header">General settings</li> <li class="nav-header" ng-show="isAdmin">General settings</li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/user.*" ng-show="userInfo.base_functions.indexOf('ADMIN') != -1"><a href="#/settings/user">Users</a></li> <li ng-show="isAdmin" ng-class="{active: $uiRoute}" ui-route="/settings/user.*"><a href="#/settings/user">Users</a></li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/log"><a href="#/settings/log">Server logs</a></li> <li ng-show="isAdmin" ng-class="{active: $uiRoute}" ui-route="/settings/log"><a href="#/settings/log">Server logs</a></li>
</ul> </ul>
</div> </div>