mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-360: Allow user to kill their own active sessions.
This commit is contained in:
committed by
Nick Couchman
parent
3eda313519
commit
85c7b511e1
@@ -110,14 +110,12 @@ public class ActiveConnectionService
|
|||||||
@Override
|
@Override
|
||||||
public void deleteObject(ModeledAuthenticatedUser user, String identifier)
|
public void deleteObject(ModeledAuthenticatedUser user, String identifier)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
// Only administrators may delete active connections
|
|
||||||
if (!user.getUser().isAdministrator())
|
|
||||||
throw new GuacamoleSecurityException("Permission denied.");
|
|
||||||
|
|
||||||
// Close connection, if it exists (and we have permission)
|
// Close connection, if it exists (and we have permission)
|
||||||
ActiveConnection activeConnection = retrieveObject(user, identifier);
|
ActiveConnection activeConnection = retrieveObject(user, identifier);
|
||||||
if (activeConnection != null) {
|
if (activeConnection != null &&
|
||||||
|
(user.getUser().isAdministrator()
|
||||||
|
|| user.getIdentifier().equals(activeConnection.getUsername()))) {
|
||||||
|
|
||||||
// Close connection if not already closed
|
// Close connection if not already closed
|
||||||
GuacamoleTunnel tunnel = activeConnection.getTunnel();
|
GuacamoleTunnel tunnel = activeConnection.getTunnel();
|
||||||
@@ -125,6 +123,8 @@ public class ActiveConnectionService
|
|||||||
tunnel.close();
|
tunnel.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
throw new GuacamoleSecurityException("Permission denied.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -189,12 +189,14 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
var connection = allConnections[dataSource][activeConnection.connectionIdentifier];
|
var connection = allConnections[dataSource][activeConnection.connectionIdentifier];
|
||||||
|
|
||||||
// Add wrapper
|
// Add wrapper
|
||||||
$scope.wrappers.push(new ActiveConnectionWrapper({
|
if (activeConnection.username !== null) {
|
||||||
dataSource : dataSource,
|
$scope.wrappers.push(new ActiveConnectionWrapper({
|
||||||
name : connection.name,
|
dataSource : dataSource,
|
||||||
startDate : $filter('date')(activeConnection.startDate, sessionDateFormat),
|
name : connection.name,
|
||||||
activeConnection : activeConnection
|
startDate : $filter('date')(activeConnection.startDate, sessionDateFormat),
|
||||||
}));
|
activeConnection : activeConnection
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user