mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-5: Provide UserContext to DirectoryObjectResourceFactory, in case needed by a particular resource (such as for additional permission checks).
This commit is contained in:
@@ -21,6 +21,7 @@ package org.apache.guacamole.rest.directory;
|
|||||||
|
|
||||||
import org.apache.guacamole.net.auth.Directory;
|
import org.apache.guacamole.net.auth.Directory;
|
||||||
import org.apache.guacamole.net.auth.Identifiable;
|
import org.apache.guacamole.net.auth.Identifiable;
|
||||||
|
import org.apache.guacamole.net.auth.UserContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory which creates DirectoryObjectResource instances exposing objects of
|
* Factory which creates DirectoryObjectResource instances exposing objects of
|
||||||
@@ -40,6 +41,9 @@ public interface DirectoryObjectResourceFactory<InternalType extends Identifiabl
|
|||||||
/**
|
/**
|
||||||
* Creates a new DirectoryObjectResource which exposes the given object.
|
* Creates a new DirectoryObjectResource which exposes the given object.
|
||||||
*
|
*
|
||||||
|
* @param userContext
|
||||||
|
* The UserContext which contains the given Directory.
|
||||||
|
*
|
||||||
* @param directory
|
* @param directory
|
||||||
* The Directory which contains the object being exposed.
|
* The Directory which contains the object being exposed.
|
||||||
*
|
*
|
||||||
@@ -51,6 +55,7 @@ public interface DirectoryObjectResourceFactory<InternalType extends Identifiabl
|
|||||||
* A new DirectoryObjectResource which exposes the given object.
|
* A new DirectoryObjectResource which exposes the given object.
|
||||||
*/
|
*/
|
||||||
DirectoryObjectResource<InternalType, ExternalType>
|
DirectoryObjectResource<InternalType, ExternalType>
|
||||||
create(Directory<InternalType> directory, InternalType object);
|
create(UserContext userContext, Directory<InternalType> directory,
|
||||||
|
InternalType object);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -258,7 +258,7 @@ public class DirectoryResource<InternalType extends Identifiable, ExternalType>
|
|||||||
throw new GuacamoleResourceNotFoundException("Not found: \"" + identifier + "\"");
|
throw new GuacamoleResourceNotFoundException("Not found: \"" + identifier + "\"");
|
||||||
|
|
||||||
// Return a resource which provides access to the retrieved object
|
// Return a resource which provides access to the retrieved object
|
||||||
return resourceFactory.create(directory, object);
|
return resourceFactory.create(userContext, directory, object);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user