mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-220: Add base API support for user groups. Refactor as minimally necessary.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
|
||||
package org.apache.guacamole.auth.jdbc.sharing.user;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import org.apache.guacamole.auth.jdbc.user.RemoteAuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
@@ -100,4 +102,9 @@ public class SharedAuthenticatedUser extends RemoteAuthenticatedUser {
|
||||
throw new UnsupportedOperationException("Users authenticated via share keys are immutable.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getEffectiveUserGroups() {
|
||||
return Collections.<String>emptySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -30,10 +30,13 @@ import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.net.auth.ConnectionGroup;
|
||||
import org.apache.guacamole.net.auth.Directory;
|
||||
import org.apache.guacamole.net.auth.Permissions;
|
||||
import org.apache.guacamole.net.auth.RelatedObjectSet;
|
||||
import org.apache.guacamole.net.auth.User;
|
||||
import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
|
||||
import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleObjectPermissionSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleRelatedObjectSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleSystemPermissionSet;
|
||||
|
||||
/**
|
||||
@@ -140,6 +143,11 @@ public class SharedUser implements User {
|
||||
return new SharedObjectPermissionSet(userDirectory.getIdentifiers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectPermissionSet getUserGroupPermissions() throws GuacamoleException {
|
||||
return new SimpleObjectPermissionSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectPermissionSet getSharingProfilePermissions() throws GuacamoleException {
|
||||
return new SimpleObjectPermissionSet();
|
||||
@@ -150,4 +158,14 @@ public class SharedUser implements User {
|
||||
return new SimpleObjectPermissionSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelatedObjectSet getUserGroups() throws GuacamoleException {
|
||||
return new SimpleRelatedObjectSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permissions getEffectivePermissions() throws GuacamoleException {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -169,4 +169,9 @@ public class ModeledAuthenticatedUser extends RemoteAuthenticatedUser {
|
||||
user.setIdentifier(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getEffectiveUserGroups() {
|
||||
return Collections.<String>emptySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -52,10 +52,14 @@ import org.apache.guacamole.form.TextField;
|
||||
import org.apache.guacamole.form.TimeField;
|
||||
import org.apache.guacamole.form.TimeZoneField;
|
||||
import org.apache.guacamole.net.auth.ActivityRecord;
|
||||
import org.apache.guacamole.net.auth.Permissions;
|
||||
import org.apache.guacamole.net.auth.RelatedObjectSet;
|
||||
import org.apache.guacamole.net.auth.User;
|
||||
import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
|
||||
import org.apache.guacamole.net.auth.permission.SystemPermission;
|
||||
import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleObjectPermissionSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleRelatedObjectSet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -379,6 +383,11 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
|
||||
return userPermissionService.getPermissionSet(getCurrentUser(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectPermissionSet getUserGroupPermissions() throws GuacamoleException {
|
||||
return new SimpleObjectPermissionSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores all restricted (privileged) attributes within the given Map,
|
||||
* pulling the values of those attributes from the underlying user model.
|
||||
@@ -839,4 +848,14 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
|
||||
return userService.retrieveHistory(getCurrentUser(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelatedObjectSet getUserGroups() throws GuacamoleException {
|
||||
return new SimpleRelatedObjectSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permissions getEffectivePermissions() throws GuacamoleException {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import org.apache.guacamole.auth.jdbc.connection.ConnectionDirectory;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
|
||||
@@ -46,6 +47,8 @@ import org.apache.guacamole.net.auth.ConnectionGroup;
|
||||
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.UserGroup;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleDirectory;
|
||||
|
||||
/**
|
||||
* UserContext implementation which is driven by an arbitrary, underlying
|
||||
@@ -161,6 +164,11 @@ public class ModeledUserContext extends RestrictedObject
|
||||
return userDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<UserGroup> getUserGroupDirectory() throws GuacamoleException {
|
||||
return new SimpleDirectory<UserGroup>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<Connection> getConnectionDirectory() throws GuacamoleException {
|
||||
return connectionDirectory;
|
||||
@@ -214,6 +222,11 @@ public class ModeledUserContext extends RestrictedObject
|
||||
return ModeledUser.ATTRIBUTES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getUserGroupAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getConnectionAttributes() {
|
||||
return ModeledConnection.ATTRIBUTES;
|
||||
|
Reference in New Issue
Block a user