Skip to content

Commit 0faee22

Browse files
committed
[bugfix] Locks do not need to be acquired for the transaction life-time for permission changes
1 parent 7419781 commit 0faee22

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/org/exist/security/PermissionFactory.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.exist.storage.txn.TransactionManager;
3535
import org.exist.storage.txn.Txn;
3636
import com.evolvedbinary.j8fu.function.ConsumerE;
37-
import org.exist.util.LockException;
3837
import org.exist.xmldb.XmldbURI;
3938
import org.exist.xquery.XPathException;
4039

@@ -125,8 +124,8 @@ public static void updatePermissions(final DBBroker broker, final XmldbURI pathU
125124
throw new XPathException("Resource or collection '" + pathUri.toString() + "' does not exist.");
126125
}
127126

128-
// keep a write lock in the transaction
129-
transaction.acquireLock(doc.getUpdateLock(), LockMode.WRITE_LOCK);
127+
// // keep a write lock in the transaction
128+
// transaction.acquireLock(doc.getUpdateLock(), LockMode.WRITE_LOCK);
130129

131130
final Permission permissions = doc.getPermissions();
132131
permissionModifier.accept(permissions);
@@ -140,8 +139,8 @@ public static void updatePermissions(final DBBroker broker, final XmldbURI pathU
140139
transact.commit(transaction);
141140
broker.flush();
142141
} else {
143-
// keep a write lock in the transaction
144-
transaction.acquireLock(collection.getLock(), LockMode.WRITE_LOCK);
142+
// // keep a write lock in the transaction
143+
// transaction.acquireLock(collection.getLock(), LockMode.WRITE_LOCK);
145144

146145
final Permission permissions = collection.getPermissionsNoLock();
147146
permissionModifier.accept(permissions);
@@ -155,7 +154,7 @@ public static void updatePermissions(final DBBroker broker, final XmldbURI pathU
155154
collection.release(LockMode.WRITE_LOCK);
156155
}
157156
}
158-
} catch(final XPathException | PermissionDeniedException | IOException | TriggerException | TransactionException | LockException e) {
157+
} catch(final XPathException | PermissionDeniedException | IOException | TriggerException | TransactionException e) {
159158
throw new PermissionDeniedException("Permission to modify permissions is denied for user '" + broker.getCurrentSubject().getName() + "' on '" + pathUri.toString() + "': " + e.getMessage(), e);
160159
}
161160
}

0 commit comments

Comments
 (0)