Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collaborative locking #54

Merged
merged 22 commits into from
May 2, 2022
Merged

Collaborative locking #54

merged 22 commits into from
May 2, 2022

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Feb 8, 2022

Fixes #51
Fixes #57
Fixes #44

This will enable the clients to already start with their implementation of file locking.

@juliusknorr juliusknorr mentioned this pull request Feb 9, 2022
@juliusknorr juliusknorr added this to the 24 milestone Mar 11, 2022
@delete-merged-branch delete-merged-branch bot deleted the branch master March 14, 2022 17:17
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch 2 times, most recently from 1d53d77 to 1efd406 Compare March 15, 2022 19:27
@juliusknorr juliusknorr changed the base branch from enh/ocs-api to master March 15, 2022 19:27
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch from 90ab895 to ac9b3a1 Compare March 24, 2022 09:32
@juliusknorr juliusknorr marked this pull request as ready for review March 24, 2022 09:42
@juliusknorr juliusknorr added the enhancement New feature or request label Mar 24, 2022
@juliusknorr juliusknorr self-assigned this Mar 24, 2022
@juliusknorr juliusknorr mentioned this pull request Mar 24, 2022
lib/Command/Lock.php Outdated Show resolved Hide resolved
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch 2 times, most recently from 3477431 to 6973874 Compare April 19, 2022 16:14
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch from 29c2c69 to bdefda1 Compare April 21, 2022 10:10
Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive!
Just a few minor remarks.

Comment on lines +114 to +117



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for those empty lines? 😁

```
curl -X LOCK \
--url http://admin:admin@nextcloud.dev.local/remote.php/dav/files/admin/myfile.odt \
--header 'X-User-Lock: 1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should explain that this specifies the lock type. It's pretty self explanatory but still.

@@ -136,14 +136,16 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$this->getStatus($input, $output, $fileId);
$this->unlockFile($input, $output, $fileId);
} catch (SuccessException $e) {
return;
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could set the return type for this method. Or does it break the signature and then Php complains about a superclass method not being overloaded?

@@ -94,7 +96,9 @@ public function locking(string $fileId): DataResponse {
$user = $this->userSession->getUser();
$file = $this->fileService->getFileFromId($user->getUID(), (int)$fileId);

$lock = $this->lockService->lockFile($file, $user);
$lock = $this->lockService->lock(new LockContext(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to name this controller's methods "locking" and "unlocking" instead of "lock" and "unlock"?

lib/Cron/Unlock.php Outdated Show resolved Hide resolved
lib/DAV/LockPlugin.php Outdated Show resolved Hide resolved
lib/Service/LockService.php Show resolved Hide resolved
lib/Service/LockService.php Outdated Show resolved Hide resolved
Signed-off-by: Julius Härtl <jus@bitgrid.net>

WIP: working but no public api

Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch from 7b514ab to 6e3e57c Compare April 30, 2022 14:43
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
… lock change

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch from c516723 to 78e7373 Compare April 30, 2022 14:47
Signed-off-by: Julius Härtl <jus@bitgrid.net>

Add expiry test

Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch from 29172c8 to 32eb85d Compare April 30, 2022 20:15
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/DAV/LockBackend.php Outdated Show resolved Hide resolved
lib/Service/FileService.php Outdated Show resolved Hide resolved
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr force-pushed the enh/collaborative-lock branch from bac1cf4 to 4d3f9f2 Compare May 2, 2022 11:14
@juliusknorr juliusknorr merged commit bf1cff3 into master May 2, 2022
@delete-merged-branch delete-merged-branch bot deleted the enh/collaborative-lock branch May 2, 2022 11:49
@solracsf
Copy link
Member

solracsf commented May 2, 2022

Great work here! Thanks. 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Etag doesn't change Allow collaboratively work on locked file Honor LOCK and UNLOCK from WebDAV requests
5 participants