Commit Graph

521 Commits

Author SHA1 Message Date
jkoberg
a0e2648200 get template from request
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-03-07 13:01:51 +01:00
jkoberg
edbc82bfc1 poc: server side space defaults
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-03-07 13:01:51 +01:00
Phil Davis
bfca242f2e chore: set introductionVersion 5.0 in services/graph 2024-03-06 17:50:21 +05:45
Phil Davis
9d2be66a85 chore: add introductionVersion pre5.0 to environment variable docs 2024-03-06 17:50:20 +05:45
Jörn Friedrich Dreyer
2dce3e997d Merge pull request #8546 from owncloud/verify-service-accounts-are-set
verify all system accounts are set
2024-02-29 17:29:08 +01:00
Jörn Friedrich Dreyer
972adafd29 verify all system accounts are set
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-02-29 15:51:37 +01:00
Ralf Haferkamp
0d366a33ae docs: Add missing doc comments 2024-02-28 17:29:04 +01:00
Ralf Haferkamp
1a8b0ea846 fix: Remove unneeded code
errors.Join(errs...) ignores nil errors and returns nil if there are not errors.
2024-02-28 17:29:04 +01:00
Ralf Haferkamp
1ceba732c2 enhancement(sharing): Check driveID when unmounting share
Only accept requests against the shareJail driveID
2024-02-28 17:29:04 +01:00
Ralf Haferkamp
83f9db3152 Fix typos 2024-02-28 17:29:04 +01:00
Ralf Haferkamp
9d6ece9220 enhancement(sharing): allow unmounting a share 2024-02-28 17:29:04 +01:00
Ralf Haferkamp
9d321bf379 enhancement(sharing): Return newly created driveItem
When accepting a share via 'POST /v1beta1/drives/{driveId}/root/children'
return the newly created driveItem. This driveItem wraps the accepted
remoteItem representing the shared resource (similar to the
'sharedWithMe' response.

This also refactors some of the helpers for user lookup and CS3 share to
driveItem conversion so they can be more easily shared.
2024-02-28 17:29:04 +01:00
Ralf Haferkamp
0a24f23164 enhancement(sharing): Simplify route for accepting shares
In theory creating the driveItem to accepting a shared resource
can be done via '/v1beta1/drives/{drive-id}/item/{item-id}/children'
but there is also the simplified variant via
'/v1beta1/drives/{drive-id}/root/children' (aligned with the example
in the spec). For now we'll just implement the latter because accepting
a share will always be done via root of the sharejail drive.
2024-02-28 17:29:04 +01:00
Ralf Haferkamp
f86bd76e23 enhancement(graph): refrain from registering routes via the Router interface
After some back an forth we agreed on keeping the routes defined
in a central place for now.
2024-02-28 17:29:04 +01:00
Ralf Haferkamp
d418864f84 fix(graph): Remove duplicated routes from router 2024-02-28 17:29:04 +01:00
Florian Schade
35817f24f2 test: add more tests for the DrivesDriveItemService implementation 2024-02-28 17:29:04 +01:00
Florian Schade
0bd97c9178 test: improve graph share accept/decline test coverage 2024-02-28 17:29:04 +01:00
Florian Schade
7384297728 enhancement: add DrivesDriveItemApi DeleteDriveItem tests 2024-02-28 17:29:04 +01:00
Florian Schade
6278273d5e enhancement: add basic share unmount 2024-02-28 17:29:04 +01:00
Florian Schade
cad0d944eb enhancement: handle share mount errors 2024-02-28 17:29:04 +01:00
Florian Schade
5f705c6263 enhancement: make use of body driveItem for graph share accept 2024-02-28 17:29:04 +01:00
Florian Schade
1178491710 enhancement: add basic share accept feature, error handling and detailed implementation still missed 2024-02-28 17:29:04 +01:00
Florian Schade
91f0667f1f feature(sharing): add endpoints to accept or decline a share 2024-02-28 17:29:04 +01:00
Ralf Haferkamp
b6fea0faed [full-ci] fix(sharing-ng): align sharedWithMe driveItem IDs with PROPFIND response (#8467)
* Bump reva

Fixes: #8080

* fix(sharing-ng): align sharedWithMe driveItem IDs

The IDs of the driveItems returned by the 'sharedWithMe' endpoint
should match the ids returned by the webdav PROPFIND response on
the share jail.

Fixes: #8420
2024-02-21 13:25:49 +01:00
Ralf Haferkamp
3d3f8949f5 Bump mockery to 2.40.2
to address issues when building with go1.22:
https://github.com/vektra/mockery/pull/753
2024-02-09 11:48:45 +01:00
Roman Perekhod
fb5f29c537 fix the bug when the expiration dates can't be removed from link permissions 2024-02-09 10:38:40 +01:00
mmattel
6e721eb4f5 [docs-only] Fix envvar descriptions trailing a double dot 2024-02-06 11:52:10 +01:00
Ralf Haferkamp
07860ef8e7 Fix some fallout of recent mockery changes (#8341)
* Fix mockery setup for graph service

Add missing interfaces to .mockery.yaml. Use existing mocks from protogen
where possible. Remove remaining //go:generate call.

* Add mockery config for settings service

* Add mockery config for proxy service
2024-02-01 21:09:01 +01:00
Ralf Haferkamp
36eff3b280 graph/sharedWithMe: Fix 'createdBy' attribute for resources from project spaces
Don't return a meaningless userid anymore for shares created from files or directories
in a project space. These resources don't have a real owner.

Fixes: #8314
2024-02-01 15:38:55 +01:00
Ralf Haferkamp
857125577f graph/sharedWithMe: return shares for the same resource as a single driveItem
- multiple shares for the same resource are now returned as a single driveItem
- the id for that driveItem is for now based on the resourceId of the shared item
  {sharesstorageproviderid}${sharejailid}!{resourceid of shared item}
- each share is exposed as a separate permission on the remoteId
- the permission now has an invitation property which provides the id of the creator
  of the share
- the client.synchronize flag is now exposed on the top-level driveitem. If at
  least on share of a resource is in accepted state the client.synchronize flag
  will be set to true.
- the UI.Hidden flag is now exposed on the top-level driveitem. If at least on
  share of a resource is marked as hidden the UI.Hidden flag will be set to
  true.
- the 'shared' property is no longer available (the relevant information from that
  moved to the 'invitation' property of the individual permissions.
2024-02-01 15:38:55 +01:00
Ralf Haferkamp
8e01d58909 graph/sharedWithMe: Adjust the driveItem's ID once more
In order to be able to group shares received for the same resource in a single driveItem
the driveItem's ID needs to be unrelated to the underlying shares' ids. We decided to base
it off of the shared resource's id (currently
{sharesstorageproviderid}${sharejailid}!{resourceid of shared item})
2024-02-01 15:38:55 +01:00
Jörn Friedrich Dreyer
fad94d2038 bump mockery, add test stub for oidc_auth.go, align mock generation (#8321)
* bump mockery, add test stub for oidc_auth.go

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use .mockery.yaml for all mocks

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* drop legacy go:generate mockery

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* align mock placement

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-02-01 10:07:44 +01:00
Florian Schade
ac878e1399 fix: graph api sharing parentReference path (#8307)
* fix: graph api sharing parentReference path

* Update services/graph/pkg/service/v0/driveitems.go

Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-01-30 12:01:54 +01:00
Florian Schade
63f244bd60 enhancement: add parent name and path to shared the shared by me endpoint (#8293) 2024-01-26 12:34:20 +01:00
Jörn Friedrich Dreyer
48610091ad set size when starting an upload session via graph (#8288)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-01-25 22:00:12 +01:00
Ralf Haferkamp
da495fd306 graph/sharing: Fix role condition for space roots
When computing the allowed roles for a spaceroot use the correct conditions.
Spaceroots require '@Subject.objectId Any_of @Resource.owners'.

Note: Updating or deleting the permissions on a spaceroot via
'v1beta1/drives/{driveid}/items/{itemid}/permissions/{permissionid}' does still
not work.
2024-01-24 17:03:00 +01:00
Ralf Haferkamp
d9fc4af575 graph/sharing: Add check for role conditions
Use the condition from the unifiedrole to check if the requested role
is actually applicable to the selected resource.

Fixes: #8131
2024-01-24 17:03:00 +01:00
Ralf Haferkamp
f38f940d22 graph/sharing: Fix role conditions for Space specific sharing roles
Co-Owner and Manager are space specific roles. They need the UnifiedRoleConditionOwner.
2024-01-24 17:03:00 +01:00
Ralf Haferkamp
f3ed318d9d graph/drives: Fix status code for PATCH/DELETE on drives don't allow them
Return a 405 Status when UpdateSpace() or DeleteSpace() are not implemented
in the backend for a certain type of drive (e.g. the virtual mountpoint drives
created for shares).

Fixes: #7881
2024-01-22 14:04:38 +01:00
Ralf Haferkamp
0e1b5dd989 graph/sharedWitMe: fix response for shares from project space
Resources on project space do not have a real owner assigned. A special
of the type USER_TYPE_SPACE_OWNER is returned as the owner. This type of
user can't be looked up via a GetUser request. So we skip that call for
this usertype.

This also fixes the behavior of 'sharedWithMe' for case when the owner
or creator of a share or shared resource can't be looked up in the 'users'
service. Previously cause the complete request to fail with an error message.
So a single share with an unresolvable owner caused 'sharedWithMe' to fail.
Now we log a warning but return all shares. Those where the owner or creator
couldn't be resolved will have the 'displayName' field of the user in the
'remoteItem.shared.owner' or 'remoteItem.shared.sharedBy' property left
empty.

Fixes: #8215
Fixes: #8027
2024-01-19 09:01:33 +01:00
jkoberg
a4d71134f5 remove unused parameter
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-01-17 13:21:28 +01:00
jkoberg
386e37cbdc cleanup graph/.../driveitems.go
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-01-17 11:58:56 +01:00
Ralf Haferkamp
3cc485a0fc graph/sharewithme: add unit test for 'remoteitem.permissions' property 2024-01-16 15:09:27 +01:00
Ralf Haferkamp
2c161881ba graph/sharedWithMe: Fix 'parentReference' on 'driveItem'
The outer parentreference should refer to the drive containing the mountpoint.
In our case this is the storagespaceid of the virtual share jail.

Also 'CreatedBy' should be the same as on the wrapped remote item. Not the share creator.
2024-01-16 15:09:27 +01:00
Ralf Haferkamp
eab501f593 graph/sharedwithme: move flags from 'remoteItem' back into 'permissions' 2024-01-16 15:09:27 +01:00
Ralf Haferkamp
5bfc943a0c graph/sharedWithMe: Renable and adjust unit test for recent changes 2024-01-16 15:09:27 +01:00
Ralf Haferkamp
b5af346384 bugfix: graph/sharedWithMe fix shared.Owner property
The value of driveItem.remoteItem.shared.Owner should match the owner property
of the received share not the owner property of the resourceInfo.
2024-01-16 15:09:27 +01:00
Ralf Haferkamp
03e704c291 graph/sharedWithMe: Set the permission property only on the wrapped remoteItem
Sematically the outer driveItem shouldn't carryt the permission. It's the `remoteItem`
that reflects the grantee's permissions.
2024-01-16 15:09:27 +01:00
Ralf Haferkamp
dd61270e7d graph/sharedWithMe: separate method for converting CS3 share to libregraph
For readability and reduced complexity of the sharedWithMe method. It was getting
too large already.
2024-01-16 15:09:27 +01:00
Florian Schade
cfba9f29cc enhancement: make use uo remote item ui hidden and client synchronized 2024-01-16 15:09:27 +01:00