GUACAMOLE-394: Add API support for user login/logout records.

This commit is contained in:
Michael Jumper
2017-09-09 13:43:49 -07:00
parent 26122ebc3e
commit 5340f55361
6 changed files with 82 additions and 0 deletions

View File

@@ -156,6 +156,19 @@ public interface UserContext {
ActivityRecordSet<ConnectionRecord> getConnectionHistory()
throws GuacamoleException;
/**
* Retrieves all user records visible to current user. The resulting
* set of user records can be further filtered and ordered using the
* methods defined on ActivityRecordSet.
*
* @return
* A set of all user records visible to the current user.
*
* @throws GuacamoleException
* If an error occurs while retrieving the user records.
*/
ActivityRecordSet<UserRecord> getUserHistory() throws GuacamoleException;
/**
* Retrieves a connection group which can be used to view and manipulate
* connections, but only as allowed by the permissions given to the user of

View File

@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.guacamole.net.auth;
/**
* A logging record describing when a user started and ended their Guacamole
* session.
*/
public interface UserRecord extends ActivityRecord {
/**
* Returns the authentication token associated with the user's session, if
* known. If permission is not granted to view the authentication tokens of
* other users, this may be null.
*
* @return
* The authentication token associated with the user's session, or null
* if this information is unavailable.
*/
public String getToken();
}

View File

@@ -36,6 +36,7 @@ import org.apache.guacamole.net.auth.Directory;
import org.apache.guacamole.net.auth.SharingProfile;
import org.apache.guacamole.net.auth.User;
import org.apache.guacamole.net.auth.UserContext;
import org.apache.guacamole.net.auth.UserRecord;
import org.apache.guacamole.protocol.GuacamoleConfiguration;
/**
@@ -215,6 +216,12 @@ public class SimpleUserContext implements UserContext {
return new SimpleActivityRecordSet<ConnectionRecord>();
}
@Override
public ActivityRecordSet<UserRecord> getUserHistory()
throws GuacamoleException {
return new SimpleActivityRecordSet<UserRecord>();
}
@Override
public Collection<Form> getUserAttributes() {
return Collections.<Form>emptyList();