GUACAMOLE-926: Merge fixes for batch import permission checkbox and decorating extensions.

This commit is contained in:
Virtually Nick
2023-04-22 08:31:25 -04:00
committed by GitHub
2 changed files with 18 additions and 7 deletions

View File

@@ -51,7 +51,7 @@
<li> <li>
<input type="checkbox" <input type="checkbox"
id="existing-permission-mode" ng-model="importConfig.existingPermissionMode" id="existing-permission-mode" ng-model="importConfig.existingPermissionMode"
ng-disabled="importConfig.replaceConnectionMode === 'REJECT'" ng-disabled="importConfig.existingConnectionMode === 'REJECT'"
ng-true-value="'REPLACE'" ng-false-value="'PRESERVE'" /> ng-true-value="'REPLACE'" ng-false-value="'PRESERVE'" />
<label for="existing-permission-mode"> <label for="existing-permission-mode">
{{'IMPORT.FIELD_HEADER_EXISTING_PERMISSION_MODE' | translate}} {{'IMPORT.FIELD_HEADER_EXISTING_PERMISSION_MODE' | translate}}

View File

@@ -430,6 +430,10 @@ public abstract class DirectoryResource<InternalType extends Identifiable, Exter
* @param identifier * @param identifier
* The identifier of the object to retrieve from the directory. * The identifier of the object to retrieve from the directory.
* *
* @param directory
* The directory to fetch the object from. If null, the directory
* associated with this DirectoryResource instance will be used.
*
* @return * @return
* The object from the directory with the provided identifier. * The object from the directory with the provided identifier.
* *
@@ -439,9 +443,15 @@ public abstract class DirectoryResource<InternalType extends Identifiable, Exter
* the object. * the object.
*/ */
@Nonnull @Nonnull
private InternalType getObjectByIdentifier(String identifier) private InternalType getObjectByIdentifier(
String identifier, @Nullable Directory<InternalType> directory)
throws GuacamoleException { throws GuacamoleException {
// Use the directory associated with this instance if not otherwise
// specified
if (directory == null)
directory = this.directory;
// Retrieve the object having the given identifier // Retrieve the object having the given identifier
InternalType object; InternalType object;
try { try {
@@ -639,10 +649,11 @@ public abstract class DirectoryResource<InternalType extends Identifiable, Exter
try { try {
// Fetch the object to be updated. If no object is // Fetch the object to be updated from the atomic
// found, a directory GET failure event will be // directory instance. If no object is found, a
// logged, and the update attempt will be aborted. // directory GET failure event will be logged, and
original = getObjectByIdentifier(identifier); // the update attempt will be aborted.
original = getObjectByIdentifier(identifier, directory);
// Apply the changes to the original object // Apply the changes to the original object
translator.applyExternalChanges( translator.applyExternalChanges(
@@ -849,7 +860,7 @@ public abstract class DirectoryResource<InternalType extends Identifiable, Exter
// Fetch the object to be updated. If no object is found, a directory // Fetch the object to be updated. If no object is found, a directory
// GET failure event will be logged. If no exception is thrown, the // GET failure event will be logged. If no exception is thrown, the
// object is guaranteed to exist // object is guaranteed to exist
InternalType object = getObjectByIdentifier(identifier); InternalType object = getObjectByIdentifier(identifier, null);
// Return a resource which provides access to the retrieved object // Return a resource which provides access to the retrieved object
DirectoryObjectResource<InternalType, ExternalType> resource = resourceFactory.create(authenticatedUser, userContext, directory, object); DirectoryObjectResource<InternalType, ExternalType> resource = resourceFactory.create(authenticatedUser, userContext, directory, object);