GUAC-1120: Move logout panel to common user menu.

This commit is contained in:
Michael Jumper
2015-03-11 17:58:31 -07:00
parent 2c60282f31
commit 9a8aa14674
20 changed files with 487 additions and 303 deletions

View File

@@ -128,6 +128,14 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
*/
$scope.canCloneConnection = null;
/**
* All permissions associated with the current user, or null if the user's
* permissions have not yet been loaded.
*
* @type PermissionSet
*/
$scope.permissions = null;
/**
* Returns whether critical data has completed being loaded.
*
@@ -142,6 +150,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
&& $scope.connection !== null
&& $scope.parameters !== null
&& $scope.historyEntryWrappers !== null
&& $scope.permissions !== null
&& $scope.canSaveConnection !== null
&& $scope.canDeleteConnection !== null
&& $scope.canCloneConnection !== null;
@@ -159,21 +168,23 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
permissionService.getPermissions(authenticationService.getCurrentUserID())
.success(function permissionsReceived(permissions) {
// Check if the connection is new or if the user has UPDATE permission
$scope.canSaveConnection =
$scope.permissions = permissions;
// Check if the connection is new or if the user has UPDATE permission
$scope.canSaveConnection =
!identifier
|| PermissionSet.hasSystemPermission(permissions, PermissionSet.SystemPermissionType.ADMINISTER)
|| PermissionSet.hasConnectionPermission(permissions, PermissionSet.ObjectPermissionType.UPDATE, identifier);
// Check if connection is not new and the user has DELETE permission
$scope.canDeleteConnection =
// Check if connection is not new and the user has DELETE permission
$scope.canDeleteConnection =
!!identifier && (
PermissionSet.hasSystemPermission(permissions, PermissionSet.SystemPermissionType.ADMINISTER)
|| PermissionSet.hasConnectionPermission(permissions, PermissionSet.ObjectPermissionType.DELETE, identifier)
);
// Check if the connection is not new and the user has UPDATE and CREATE_CONNECTION permissions
$scope.canCloneConnection =
// Check if the connection is not new and the user has UPDATE and CREATE_CONNECTION permissions
$scope.canCloneConnection =
!!identifier && (
PermissionSet.hasSystemPermission(permissions, PermissionSet.SystemPermissionType.ADMINISTER) || (
PermissionSet.hasConnectionPermission(permissions, PermissionSet.ObjectPermissionType.UPDATE, identifier)

View File

@@ -85,6 +85,14 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
*/
$scope.hasDeletePermission = null;
/**
* All permissions associated with the current user, or null if the user's
* permissions have not yet been loaded.
*
* @type PermissionSet
*/
$scope.permissions = null;
/**
* Returns whether critical data has completed being loaded.
*
@@ -96,6 +104,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
return $scope.rootGroup !== null
&& $scope.connectionGroup !== null
&& $scope.permissions !== null
&& $scope.canSaveConnectionGroup !== null
&& $scope.canDeleteConnectionGroup !== null;
@@ -105,6 +114,8 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
permissionService.getPermissions(authenticationService.getCurrentUserID())
.success(function permissionsReceived(permissions) {
$scope.permissions = permissions;
// Check if the connection group is new or if the user has UPDATE permission
$scope.canSaveConnectionGroup =
!identifier

View File

@@ -115,6 +115,14 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
*/
$scope.newUsername = "";
/**
* All permissions associated with the current user, or null if the user's
* permissions have not yet been loaded.
*
* @type PermissionSet
*/
$scope.permissions = null;
/**
* Returns whether critical data has completed being loaded.
*
@@ -126,6 +134,7 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
return $scope.users !== null
&& $scope.rootGroup !== null
&& $scope.permissions !== null
&& $scope.canManageUsers !== null
&& $scope.canManageConnections !== null
&& $scope.canCreateUsers !== null
@@ -138,6 +147,8 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
permissionService.getPermissions(currentUserID)
.success(function permissionsRetrieved(permissions) {
$scope.permissions = permissions;
// Ignore permission to update root group
PermissionSet.removeConnectionGroupPermission(permissions, PermissionSet.ObjectPermissionType.UPDATE, ConnectionGroup.ROOT_IDENTIFIER);

View File

@@ -93,6 +93,14 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
*/
$scope.hasDeletePermission = null;
/**
* All permissions associated with the current user, or null if the user's
* permissions have not yet been loaded.
*
* @type PermissionSet
*/
$scope.permissions = null;
/**
* Returns whether critical data has completed being loaded.
*
@@ -105,6 +113,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
return $scope.user !== null
&& $scope.permissionFlags !== null
&& $scope.rootGroup !== null
&& $scope.permissions !== null
&& $scope.canSaveUser !== null
&& $scope.canDeleteUser !== null;
@@ -129,7 +138,9 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
// Query the user's permissions for the current connection
permissionService.getPermissions(authenticationService.getCurrentUserID())
.success(function permissionsReceived(permissions) {
$scope.permissions = permissions;
// Check if the user is new or if the user has UPDATE permission
$scope.canSaveUser =
!username

View File

@@ -23,5 +23,5 @@
/**
* The module for the administration functionality.
*/
angular.module('manage', ['groupList', 'locale', 'pager', 'rest']);
angular.module('manage', ['groupList', 'locale', 'pager', 'rest', 'userMenu']);

View File

@@ -22,10 +22,8 @@ THE SOFTWARE.
<div class="view" ng-class="{loading: !isLoaded()}">
<div class="logout-panel">
<a class="home button" href="#/">{{'MANAGE.ACTION_NAVIGATE_HOME' | translate}}</a>
<a class="logout button" ng-click="logout()">{{'MANAGE.ACTION_LOGOUT' | translate}}</a>
</div>
<!-- User menu -->
<guac-user-menu permissions="permissions"></guac-user-menu>
<h2>{{'MANAGE.SECTION_HEADER_ADMINISTRATION' | translate}}</h2>

View File

@@ -22,10 +22,8 @@ THE SOFTWARE.
<div class="view" ng-class="{loading: !isLoaded()}">
<div class="logout-panel">
<a class="back button" href="#/manage/">{{'MANAGE_CONNECTION.ACTION_NAVIGATE_BACK' | translate}}</a>
<a class="logout button" ng-click="logout()">{{'MANAGE_CONNECTION.ACTION_LOGOUT' | translate}}</a>
</div>
<!-- User menu -->
<guac-user-menu permissions="permissions"></guac-user-menu>
<!-- Main property editor -->
<h2>{{'MANAGE_CONNECTION.SECTION_HEADER_EDIT_CONNECTION' | translate}}</h2>

View File

@@ -22,10 +22,8 @@ THE SOFTWARE.
<div class="view" ng-class="{loading: !isLoaded()}">
<div class="logout-panel">
<a class="back button" href="#/manage/">{{'MANAGE_CONNECTION_GROUP.ACTION_NAVIGATE_BACK' | translate}}</a>
<a class="logout button" ng-click="logout()">{{'MANAGE_CONNECTION_GROUP.ACTION_LOGOUT' | translate}}</a>
</div>
<!-- User menu -->
<guac-user-menu permissions="permissions"></guac-user-menu>
<!-- Main property editor -->
<h2>{{'MANAGE_CONNECTION_GROUP.SECTION_HEADER_EDIT_CONNECTION_GROUP' | translate}}</h2>

View File

@@ -22,10 +22,8 @@ THE SOFTWARE.
<div class="view" ng-class="{loading: !isLoaded()}">
<div class="logout-panel">
<a class="back button" href="#/manage/">{{'MANAGE_USER.ACTION_NAVIGATE_BACK' | translate}}</a>
<a class="logout button" ng-click="logout()">{{'MANAGE_USER.ACTION_LOGOUT' | translate}}</a>
</div>
<!-- User menu -->
<guac-user-menu permissions="permissions"></guac-user-menu>
<!-- Main property editor -->
<h2>{{'MANAGE_USER.SECTION_HEADER_EDIT_USER' | translate}}</h2>