Make the UI capability based

This commit is contained in:
Girish Ramakrishnan
2018-06-17 18:21:12 -07:00
parent cec1cc7086
commit 4db703aeb1
9 changed files with 32 additions and 30 deletions

View File

@@ -430,7 +430,7 @@
<!-- Workaround for select-all issue, see commit message -->
<div style="font-size: 1px;">&nbsp;</div>
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && user.admin">
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && user.caps.apps">
<div class="col-md-12" style="text-align: center;">
<br/><br/><br/><br/>
<h1><i class="fa fa-cloud-download fa-fw"></i> No apps installed yet!</h1>
@@ -439,7 +439,7 @@
</div>
</div>
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && !user.admin">
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && !user.caps.apps">
<div class="col-md-12" style="text-align: center;">
<br/><br/><br/><br/>
<h1>You don't have access to any apps on this Cloudron yet!</h1>
@@ -480,7 +480,7 @@
</div>
</div>
</div>
<div class="grid-item-bottom-mobile" ng-show="user.admin">
<div class="grid-item-bottom-mobile" ng-show="user.caps.apps">
<div class="row">
<div class="col-xs-4 text-left">
<a href="" ng-click="appRestore.show(app)" ng-show="backupConfig.provider !== 'noop'">
@@ -500,7 +500,7 @@
</div>
</div>
</div>
<div class="grid-item-bottom" ng-show="user.admin">
<div class="grid-item-bottom" ng-show="user.caps.apps">
<div>
<a href="" ng-click="showUninstall(app)" uib-tooltip="Uninstall" tooltip-placement="right" tooltip-class="app-tooltip"><i class="fa fa-remove scale"></i></a>
</div>

View File

@@ -586,7 +586,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
Client.refreshInstalledApps(function (error) {
if (error) return console.error(error);
if ($scope.user.admin) {
if ($scope.user.caps.apps) {
fetchUsers();
fetchGroups();
getDomains();

View File

@@ -153,10 +153,10 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" ng-show="config.provider === 'caas' && user.admin && appInstall.state === 'resourceConstraint'" ng-click="showView('/settings')">Upgrade Cloudron</button>
<button type="button" class="btn btn-danger" ng-show="config.provider !== 'caas' && user.admin && appInstall.state === 'resourceConstraint'" ng-click="appInstall.showForm(true)">Install anyway</button>
<button type="button" class="btn btn-success" ng-show="appInstall.state === 'appInfo' && user.admin" ng-click="appInstall.showForm()">Install</button>
<button type="button" class="btn btn-success" ng-show="appInstall.state === 'installForm' && user.admin" ng-click="appInstall.submit()" ng-disabled="appInstallForm.$invalid || appInstall.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="appInstall.busy"></i> Install</button>
<button type="button" class="btn btn-success" ng-show="config.provider === 'caas' && user.caps.appstore && appInstall.state === 'resourceConstraint'" ng-click="showView('/settings')">Upgrade Cloudron</button>
<button type="button" class="btn btn-danger" ng-show="config.provider !== 'caas' && user.caps.apps && appInstall.state === 'resourceConstraint'" ng-click="appInstall.showForm(true)">Install anyway</button>
<button type="button" class="btn btn-success" ng-show="appInstall.state === 'appInfo' && user.caps.apps" ng-click="appInstall.showForm()">Install</button>
<button type="button" class="btn btn-success" ng-show="appInstall.state === 'installForm' && user.caps.apps" ng-click="appInstall.submit()" ng-disabled="appInstallForm.$invalid || appInstall.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="appInstall.busy"></i> Install</button>
<a class="btn btn-success" ng-show="appInstall.state === 'appLimitReached'" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.emailEncoded + '&cloudronId=' + appstoreConfig.cloudronId }}" target="_blank">Setup Subscription</a>
</div>
</div>

View File

@@ -258,7 +258,7 @@
<tbody>
<tr ng-repeat="user in users">
<td>
<i class="fa fa-briefcase arrow" ng-show="user.admin" uib-tooltip="This user is an admin and can manage apps, groups and other users"></i>
<i class="fa fa-briefcase arrow" ng-show="user.caps.users || user.caps.apps" uib-tooltip="This user can manage apps, groups and other users"></i>
</td>
<td class="hand elide-table-cell" ng-click="useredit.show(user)" ng-show="user.username">
{{ user.username }} &nbsp; <span class="text-muted">{{ user.email }}</span>

View File

@@ -325,10 +325,6 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
return user.username === Client.getUserInfo().username;
};
$scope.isAdmin = function (user) {
return !!user.admin;
};
$scope.sendInvite = function (user) {
$scope.inviteSent.email = user.fallbackEmail;
$scope.inviteSent.setupLink = '';