Skip to content

[FEATURE REQUEST] Sharing NG: create share with user/group #4875

@jesmrec

Description

@jesmrec

In case of an oCIS server, using the Graph API to share with users and groups. The "invite to space" view is the guide to the UI design.

Permissions

To check if a user has share permission over an item, check the <oc:permissions> property in the propfind response.

The R permission is the one to check if user is allowed to share.

Reference: https://doc.owncloud.com/desktop/5.3/appendices/architecture.html#server-side-permissions

The "Share" option should be displayed anyway, to give users the access to the permalink. Just hiding the option to add new shares

Search user-group

Requests to fetch from server:

Users: GET /graph/v1.0/users?$search="username"&$orderby=displayName
Groups: GET /graph/v1.0/groups?$search="username"&$orderby=displayName

which response is like:

Users:

{
    "value": [
        {
            "accountEnabled": true,
            "attributes": [],
            "displayName": "John Smith",
            "id": "af39b07f-9985-4d1d-a676-ff8b6c153c2a",
            "mail": "a@a.com",
            "onPremisesSamAccountName": "user1",
            "signInActivity": {
                "lastSuccessfulSignInDateTime": "2026-05-28T10:51:39Z"
            },
            "surname": "user1",
            "userType": "Member"
        },
        {
            "accountEnabled": true,
            "attributes": [],
            "displayName": "user2",
            "id": "54e131de-1c06-412a-9a85-0f5392c1ebba",
            "mail": "a@a.com",
            "onPremisesSamAccountName": "user2",
            "surname": "user2",
            "userType": "Member"
        },
        {
            "accountEnabled": true,
            "attributes": [],
            "displayName": "user3",
            "id": "676a64c8-f715-4a47-8399-d91725682e06",
            "mail": "a@a.com",
            "onPremisesSamAccountName": "user3",
            "surname": "user3",
            "userType": "Member"
        }
    ]
}

Groups:

{
    "value": [
        {
            "displayName": "test",
            "groupTypes": [],
            "id": "c281ae4f-fa90-455f-a01c-e298d1b73e68"
        }
    ]
}

Here, it's important to mind the capability search_min_length. Request should be sent only when there are at least the given number of characters.

Every typed character, the result list should be updated.

Every result should be clickable to choose the sharee

Share setup

After choosing the sharee, we have to give it:

  • Permission (mandatory)
  • Expiration date (not mandatory)

Submitting is only allowed to submit when permission is set

Where to get the available sharing permissions for a given item:

GET https://<url>/graph/v1beta1/drives/<drive-id>/items/<item-id>/permissions

Response like:

    "@libre.graph.permissions.roles.allowedValues": [
        {
            "@libre.graph.weight": 1,
            "description": "View and download.",
            "displayName": "Can view",
            "id": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
        },
        {
            "@libre.graph.weight": 2,
            "description": "View, download, upload, edit and add.",
            "displayName": "Can edit",
            "id": "1c996275-f1c9-4e71-abdf-a42f6495e960"
        },
        {
            "@libre.graph.weight": 3,
            "description": "View, download, upload, edit, add and delete.",
            "displayName": "Can edit with trashbin",
            "id": "fb6c3e19-e378-47e5-b277-9732f9de6e21"
        }
    ]

where libre.graph.permissions.roles.allowedValues contains the information to display and work. The default will be two permissions for files and three for folders

Regular handling for expiration date.

Submission

POST https://<url>/graph/v1beta1/drives/<drive-id>/items/<item-id>/invite

with the following body:

{
    "recipients": [
        {
            "@libre.graph.recipient.type": "user/group",
            "objectId": "<user/group-id>"
        }
    ],
    "roles": [
        "<role-id>"
    ],
    "expirationDateTime": "2026-10-04T10:54:51.337Z"
}

TASKS

  • Research (if needed)
  • Create branch feature/feature_name
  • Development tasks
    • Implement whatever
    • ...
    • Implement unit tests (if needed)
  • Code review and apply changes requested
  • Design test plan
  • QA
  • Merge branch feature/feature_name into master

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions