Skip to content

feat: add lockInfo to driveItem - #59

Open
dschmidt wants to merge 3 commits into
mainfrom
feat/driveitem-lock
Open

feat: add lockInfo to driveItem#59
dschmidt wants to merge 3 commits into
mainfrom
feat/driveitem-lock

Conversation

@dschmidt

@dschmidt dschmidt commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Adds lock metadata to driveItem as the top-level lockInfo property, matching the MS Graph beta lockInfo resource (published 2026-06-30): lockType (none, exclusive, shared, unknownFutureValue), createdDateTime, expirationDateTime and owners. One extension: @libre.graph.appName carries the application holding the lock (WOPI/app locks), which MS Graph does not model.

Everything is read straight off the CS3 lock: lockType from Lock.Type, createdDateTime from the locktime opaque, expirationDateTime from Lock.Expiration, owners from Lock.User plus the lockownername opaque, @libre.graph.appName from Lock.AppName. WebDAV exposes the same state only in mangled form (app name folded into the d:owner string, expiration as a relative d:timeout).

The beta POST .../lock and releaseLock endpoints are not part of this PR; WebDAV LOCK/UNLOCK stays the write path for now. They can follow as their own PR (including whether to relax the 30 minute cap via config).

@butonic

butonic commented Sep 1, 2026

Copy link
Copy Markdown
Member

The MS Graph Beta endpoint has driveItem.lock: https://learn.microsoft.com/en-us/graph/api/driveitem-lock?view=graph-rest-beta&tabs=http

We can use it as is AFAICT. The driveItem.lockInfo has createdDateTime, expirationDateTime, createdDateTime (which is always exclusive) and an owner property, which is a Collection(userIdentity).

It has no appName, bet we can add it as a @libre.graph.appName property on the lockInfo.

Related:
https://learn.microsoft.com/en-us/graph/api/driveitem-releaselock?view=graph-rest-beta&tabs=http

Remarks:

  • In MS Graph Lock duration is capped at 30 minutes per request. I'm happy to allow higher values ... armaybe an ENV configurable amount.
  • Only exclusive locks are currently supported. The lockType in the response is always exclusive.
  • The createdDateTime and expirationDateTime are returned in UTC.
  • After release, the file's lock state is cleared: a subsequent call to GET /drives/{drive-id}/items/{item-id}?$select=lockInfo returns the lockInfo facet with lockType none and an empty owners array.

@dschmidt dschmidt changed the title feat: add @libre.graph.lock facet to driveItem feat: add file.lockInfo to driveItem Sep 1, 2026
@dschmidt

dschmidt commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Tremendous find, that landed in the beta docs on 2026-06-30, a few weeks before this PR was drafted.

Reworked to lockInfo as is plus @libre.graph.appName for the app lock, as a top-level driveItem property per the driveItem resource doc (the lockinfo page claims it sits on the file facet, but the driveItem property table and JSON representation say otherwise).

The lock/releaseLock endpoints are left for their own PR, WebDAV LOCK stays the write path for now.

@dschmidt
dschmidt force-pushed the feat/driveitem-lock branch from 7fa1057 to 8d41b1f Compare September 1, 2026 06:37
@dschmidt dschmidt changed the title feat: add file.lockInfo to driveItem feat: add lockInfo to driveItem Sep 1, 2026
@dschmidt
dschmidt force-pushed the feat/driveitem-lock branch from 8d41b1f to 63b11ce Compare September 1, 2026 06:41
Comment thread api/openapi-spec/v1.0.yaml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants