Use the scope to determine what the user has access to

This commit is contained in:
Girish Ramakrishnan
2018-05-01 11:44:47 -07:00
parent d9ec1be9b6
commit 72bbb4ec68
10 changed files with 23 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
'use strict';
angular.module('Application').controller('ActivityController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
Client.onReady(function () { if (!Client.hasScope('cloudron')) $location.path('/'); });
$scope.config = Client.getConfig();
$scope.busy = false;

View File

@@ -1,7 +1,7 @@
'use strict';
angular.module('Application').controller('AppStoreController', ['$scope', '$location', '$timeout', '$routeParams', 'Client', 'AppStore', function ($scope, $location, $timeout, $routeParams, Client, AppStore) {
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
Client.onReady(function () { if (!Client.hasScope('apps')) $location.path('/'); });
$scope.HOST_PORT_MIN = 1024;
$scope.HOST_PORT_MAX = 65535;

View File

@@ -1,7 +1,7 @@
'use strict';
angular.module('Application').controller('DomainsController', ['$scope', '$location', 'Client', 'ngTld', function ($scope, $location, Client, ngTld) {
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
Client.onReady(function () { if (!Client.hasScope('domains')) $location.path('/'); });
$scope.config = Client.getConfig();
$scope.dnsConfig = null;

View File

@@ -3,7 +3,7 @@
/* global asyncForEach:false */
angular.module('Application').controller('EmailController', ['$scope', '$location', '$timeout', '$rootScope', 'Client', 'AppStore', function ($scope, $location, $timeout, $rootScope, Client, AppStore) {
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
Client.onReady(function () { if (!Client.hasScope('mail')) $location.path('/'); });
$scope.ready = false;
$scope.refreshBusy = true;

View File

@@ -4,7 +4,7 @@
'use strict';
angular.module('Application').controller('GraphsController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
Client.onReady(function () { if (!Client.hasScope('cloudron')) $location.path('/'); });
$scope.diskUsage = {};
$scope.memoryUsageSystem = [];

View File

@@ -1,7 +1,7 @@
'use strict';
angular.module('Application').controller('SettingsController', ['$scope', '$location', '$rootScope', '$timeout', 'Client', 'AppStore', function ($scope, $location, $rootScope, $timeout, Client, AppStore) {
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
Client.onReady(function () { if (!Client.hasScope('settings')) $location.path('/'); });
$scope.client = Client;
$scope.user = Client.getUserInfo();

View File

@@ -1,6 +1,8 @@
'use strict';
angular.module('Application').controller('SupportController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
Client.onReady(function () { if (!Client.hasScope('settings')) $location.path('/'); });
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.apps = Client.getInstalledApps();

View File

@@ -1,6 +1,8 @@
'use strict';
angular.module('Application').controller('TokensController', ['$scope', 'Client', function ($scope, Client) {
Client.onReady(function () { if (!Client.hasScope('clients')) $location.path('/'); });
$scope.user = Client.getUserInfo();
$scope.config = Client.getConfig();

View File

@@ -4,7 +4,7 @@
/* global asyncForEach:false */
angular.module('Application').controller('UsersController', ['$scope', '$location', '$timeout', 'Client', function ($scope, $location, $timeout, Client) {
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
Client.onReady(function () { if (!Client.hasScope('users')) $location.path('/'); });
$scope.ready = false;
$scope.users = [];