GUACAMOLE-360: Make session management page always available.

Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/ef7e28d1
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/ef7e28d1
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/ef7e28d1

Branch: refs/heads/master
Commit: ef7e28d168d6e1dc68d71d50421e20c558cd4daa
Parents: 6a1b55a
Author: Nick Couchman <[email protected]>
Authored: Mon Jun 18 21:12:20 2018 -0400
Committer: Nick Couchman <[email protected]>
Committed: Mon Jun 18 21:12:20 2018 -0400

----------------------------------------------------------------------
 .../app/navigation/services/userPageService.js  | 31 +++++++-------------
 1 file changed, 11 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ef7e28d1/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 07736ed..7bdf654 100644
--- a/guacamole/src/main/webapp/app/navigation/services/userPageService.js
+++ b/guacamole/src/main/webapp/app/navigation/services/userPageService.js
@@ -72,9 +72,11 @@ angular.module('navigation').factory('userPageService', 
['$injector',
 
         // If user has access to settings pages, return home page and skip
         // 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)
+        // a Settings page and is always visible, and the Session management
+        // page is also available to all users so that they can kill their
+        // own session.  We look for more than those two pages to determine
+        // if we should go to the home page.
+        if (settingsPages.length > 2)
             return SYSTEM_HOME_PAGE;
 
         // Determine whether a connection or balancing group should serve as
@@ -265,25 +267,8 @@ 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({
@@ -320,6 +305,12 @@ angular.module('navigation').factory('userPageService', 
['$injector',
             url  : '/settings/preferences'
         }));
 
+        // Add link to Session management (always accessible)
+        pages.push(new PageDefinition({
+            name : 'USER_MENU.ACTION_MANAGE_SESSIONS',
+            url  : '/settings/sessions'
+        }));
+
         return pages;
     };
 

Reply via email to