Repository: guacamole-client Updated Branches: refs/heads/master 984ab48ce -> 33679a08d
GUACAMOLE-360: Make webapp use permission sets for active connection management. Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/bd2d051a Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/bd2d051a Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/bd2d051a Branch: refs/heads/master Commit: bd2d051a19d4cded79f33e1168e97b22ba90fcec Parents: 5e16518 Author: Nick Couchman <[email protected]> Authored: Tue Jun 12 21:50:12 2018 -0400 Committer: Nick Couchman <[email protected]> Committed: Wed Jun 13 06:17:52 2018 -0400 ---------------------------------------------------------------------- .../app/navigation/services/userPageService.js | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/bd2d051a/guacamole/src/main/webapp/app/navigation/services/userPageService.js ---------------------------------------------------------------------- diff --git a/guacamole/src/main/webapp/app/navigation/services/userPageService.js b/guacamole/src/main/webapp/app/navigation/services/userPageService.js index 27ae4d7..07736ed 100644 --- a/guacamole/src/main/webapp/app/navigation/services/userPageService.js +++ b/guacamole/src/main/webapp/app/navigation/services/userPageService.js @@ -71,10 +71,10 @@ angular.module('navigation').factory('userPageService', ['$injector', var settingsPages = generateSettingsPages(permissions); // If user has access to settings pages, return home page and skip - // evaluation for automatic connections. The Preferences and Session - // Management pages are "Settings" pages and are always visible, so - // we look for more than two to indicate access to administrative pages. - if (settingsPages.length > 2) + // evaluation for automatic connections. The Preferences page is + // a Settings page and is always visible, so we look for more than + // one to indicate access to administrative pages. + if (settingsPages.length > 1) return SYSTEM_HOME_PAGE; // Determine whether a connection or balancing group should serve as @@ -265,8 +265,25 @@ angular.module('navigation').factory('userPageService', ['$injector', canViewConnectionRecords.push(dataSource); } + // Determine whether the current user needs access to view session management + if ( + // Permission to manage active sessions. + PermissionSet.hasSystemPermission(permissions, PermissionSet.SystemPermissionType.ADMINISTER) + || PermissionSet.hasActiveConnectionPermission(permissions, PermissionSet.ObjectPermissionType.DELETE) + ) { + canManageSessions.push(dataSource); + } + }); + // If user can manage sessions, add link to sessions management page + if (canManageSessions.length) { + pages.push(new PageDefinition({ + name : 'USER_MENU.ACTION_MANAGE_SESSIONS', + url : '/settings/sessions' + })); + } + // If user can manage connections, add links for connection management pages angular.forEach(canViewConnectionRecords, function addConnectionHistoryLink(dataSource) { pages.push(new PageDefinition({ @@ -297,12 +314,6 @@ angular.module('navigation').factory('userPageService', ['$injector', })); }); - // Add link to session management (always accessible) - pages.push(new PageDefinition({ - name : 'USER_MENU.ACTION_MANAGE_SESSIONS', - url : '/settings/sessions' - })); - // Add link to user preferences (always accessible) pages.push(new PageDefinition({ name : 'USER_MENU.ACTION_MANAGE_PREFERENCES',
