Skip to content

[FEATURE REQUEST] Add a member to a space: Set permissions and expiration date #4740

@jesmrec

Description

@jesmrec

After #4613, where the search of member is completed, one of the users in the list is chosen to be added as member. After clicking in the user name, the view would be like:

Image

When the user chooses one user or group to share, the name it's shown as share with and the available list of permissions is shown underneath

After choosing the permission level, the optional "Expiration Date" file picker is displayed, in case the share is removed after such date, and the Invite button is enabled. Share can not be created without a permission level. The expiration date could be handled in the same way as the existing links, with a switch.

The list of roles is retrieved from

https://...:9200/graph/v1beta1/drives/<drive-id>/root/permissions

it returns:

{
    "@libre.graph.permissions.actions.allowedValues": [
        "libre.graph/driveItem/permissions/create",
        "libre.graph/driveItem/children/create",
        "libre.graph/driveItem/standard/delete",
        "libre.graph/driveItem/path/read",
        "libre.graph/driveItem/quota/read",
        "libre.graph/driveItem/content/read",
        "libre.graph/driveItem/upload/create",
        "libre.graph/driveItem/permissions/read",
        "libre.graph/driveItem/children/read",
        "libre.graph/driveItem/versions/read",
        "libre.graph/driveItem/deleted/read",
        "libre.graph/driveItem/path/update",
        "libre.graph/driveItem/permissions/delete",
        "libre.graph/driveItem/deleted/delete",
        "libre.graph/driveItem/versions/update",
        "libre.graph/driveItem/deleted/update",
        "libre.graph/driveItem/basic/read",
        "libre.graph/driveItem/permissions/update",
        "libre.graph/driveItem/permissions/deny"
    ],
    "@libre.graph.permissions.roles.allowedValues": [
        {
            "@libre.graph.weight": 1,
            "description": "View and download.",
            "displayName": "Can view",
            "id": "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
        },
        {
            "@libre.graph.weight": 2,
            "description": "View, download, upload, edit, add, delete including the history.",
            "displayName": "Can edit",
            "id": "58c63c02-1d89-4572-916a-870abc5a1b7d"
        },
        {
            "@libre.graph.weight": 3,
            "description": "View, download, upload, edit, add, delete and manage members.",
            "displayName": "Can manage",
            "id": "312c0871-5ef7-4b3a-85b6-0e4074c64049"
        }
    ],
    "value": [
        {
            "grantedToV2": {
                "user": {
                    "@libre.graph.userType": "Member",
                    "displayName": "Joeh Smith",
                    "id": "52037314-d64f-49cb-a0be-1db422d172e9"
                }
            },
            "id": "u:52037314-d64f-49cb-a0be-1db422d172e9",
            "roles": [
                "312c0871-5ef7-4b3a-85b6-0e4074c64049"
            ]
        },
        {
            "expirationDateTime": "2025-07-03T12:09:43.364Z",
            "grantedToV2": {
                "user": {
                    "@libre.graph.userType": "Member",
                    "displayName": "user3",
                    "id": "ccd863bf-2c7c-4a93-a393-84f26f3b67a1"
                }
            },
            "id": "u:ccd863bf-2c7c-4a93-a393-84f26f3b67a1",
            "roles": [
                "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
            ]
        }
    ]
}

three arrays inside:

@libre.graph.permissions.actions.allowedValues: -
@libre.graph.permissions.roles.allowedValue: list of permissions to grant
value: current list of sharees

Expiration date is not mandatory. The Invite button will be only available to click when a role has been selected for the member.

To invite:

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

where drive-id is the space id, and item-id , user or group id to add

Body request:

{
    "expirationDateTime": "2025-07-03T12:09:43.364Z",
    "recipients": [
        {
            "@libre.graph.recipient.type": "user",
            "objectId": "ccd863bf-2c7c-4a93-a393-84f26f3b67a1"
        }
    ],
    "roles": [
        "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
    ]
}

Additionally, after clicking Invite, navigation to Members view with the new member included in the list.

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions