Skip to content

Sort Graph permissions with users ahead of groups #8465

@chscott

Description

@chscott

The associated forum post URL from https://forum.rclone.org

Discussed in email.

What is your current rclone version (output from rclone version)?

v1.69.1

What problem are you are trying to solve?

Graph has a quirk that manifests when all of these conditions apply:

  1. You are adding permissions for both a group and a user.
  2. The user is a member of the group.
  3. The permissions for the group and user are the same.
  4. You are adding the group permission before the user permission.

When all of the above are true, Graph indicates it has added the user permission, but it immediately drops it. For example:

2025/03/21 15:08:01 DEBUG : HTTP REQUEST (req 0xc0005bf040)
2025/03/21 15:08:01 DEBUG : POST /v1.0/drives/b!ssbqQHJ0v0Ki4mBGkrRBXWvDWPc3piNIl8WI29g4XaD8jOMrJ7J6RKVhFAqRVq5-/items/01N4X3HM6FM5BTRUMZGVDKZS7JNQWOAEX3/invite HTTP/1.1
{"recipients":[{"email":"reviewers@cdsconsulting.org"}],"requireSignIn":true,"roles":["write"]}
2025/03/21 15:08:01 DEBUG : HTTP RESPONSE (req 0xc0005bf040)
2025/03/21 15:08:01 DEBUG : HTTP/2.0 200 OK
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.permission)",
    "value": [{
            "id": "Yzowby5jfGZlZGVyYXRlZGRpcmVjdG9yeWNsYWltcHJvdmlkZXJ8ZmVjMjNjZGYtYTZkZS00OTU1LWFkZWItMDE3OTM2NWU2Yjdi",
            "roles": ["write"],
            "grantedTo": {
                "user": {
                    "email": "reviewers@cdsconsultingllc.onmicrosoft.com",
                    "displayName": "Reviewers Members"
                }
            }
        }
    ]
}

2025/03/21 15:08:01 DEBUG : HTTP REQUEST (req 0xc000bb1400)
2025/03/21 15:08:01 DEBUG : POST /v1.0/drives/b!ssbqQHJ0v0Ki4mBGkrRBXWvDWPc3piNIl8WI29g4XaD8jOMrJ7J6RKVhFAqRVq5-/items/01N4X3HM6FM5BTRUMZGVDKZS7JNQWOAEX3/invite HTTP/1.1
{"recipients":[{"email":"angie.scott@cdsconsulting.org"}],"requireSignIn":true,"roles":["write"]}
2025/03/21 15:08:02 DEBUG : HTTP RESPONSE (req 0xc000bb1400)
2025/03/21 15:08:02 DEBUG : HTTP/2.0 200 OK
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.permission)",
    "value": [{
            "id": "aTowIy5mfG1lbWJlcnNoaXB8YW5naWUuc2NvdHRAY2RzY29uc3VsdGluZy5vcmc",
            "roles": ["write"],
            "grantedTo": {
                "user": {
                    "email": "angie@cdsconsulting.org",
                    "id": "4b9c56cb-83b3-4b1a-a66f-5e108a840bf4",
                    "displayName": "Angie Scott"
                }
            }
        }
    ]
}

2025/03/21 15:08:02 DEBUG : HTTP REQUEST (req 0xc0005bfe00)
2025/03/21 15:08:02 DEBUG : GET /v1.0/drives/b!ssbqQHJ0v0Ki4mBGkrRBXWvDWPc3piNIl8WI29g4XaD8jOMrJ7J6RKVhFAqRVq5-/items/01N4X3HM6FM5BTRUMZGVDKZS7JNQWOAEX3/permissions HTTP/1.1
2025/03/21 15:08:02 DEBUG : HTTP RESPONSE (req 0xc0005bfe00)
2025/03/21 15:08:02 DEBUG : HTTP/2.0 200 OK
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('b%21ssbqQHJ0v0Ki4mBGkrRBXWvDWPc3piNIl8WI29g4XaD8jOMrJ7J6RKVhFAqRVq5-')/items('01N4X3HM6FM5BTRUMZGVDKZS7JNQWOAEX3')/permissions",
    "value": [{
            "id": "Yzowby5jfGZlZGVyYXRlZGRpcmVjdG9yeWNsYWltcHJvdmlkZXJ8ZmVjMjNjZGYtYTZkZS00OTU1LWFkZWItMDE3OTM2NWU2Yjdi",
            "roles": ["write"],
            "shareId": "Yzowby5jfGZlZGVyYXRlZGRpcmVjdG9yeWNsYWltcHJvdmlkZXJ8ZmVjMjNjZGYtYTZkZS00OTU1LWFkZWItMDE3OTM2NWU2Yjdi",
            "grantedToV2": {
                "group": {
                    "@odata.type": "#microsoft.graph.sharePointIdentity",
                    "displayName": "Reviewers Members",
                    "email": "reviewers@cdsconsultingllc.onmicrosoft.com",
                    "id": "fec23cdf-a6de-4955-adeb-0179365e6b7b"
                },
                "siteUser": {
                    "displayName": "Reviewers Members",
                    "email": "reviewers@cdsconsultingllc.onmicrosoft.com",
                    "id": "16",
                    "loginName": "c:0o.c|federateddirectoryclaimprovider|fec23cdf-a6de-4955-adeb-0179365e6b7b"
                }
            },
            "grantedTo": {
                "user": {
                    "displayName": "Reviewers Members",
                    "email": "reviewers@cdsconsultingllc.onmicrosoft.com",
                    "id": "fec23cdf-a6de-4955-adeb-0179365e6b7b"
                }
            }
        }, {
            "id": "aTowIy5mfG1lbWJlcnNoaXB8Y2hhZC5zY290dEBjZHNjb25zdWx0aW5nLm9yZw",
            "roles": ["owner"],
            "shareId": "aTowIy5mfG1lbWJlcnNoaXB8Y2hhZC5zY290dEBjZHNjb25zdWx0aW5nLm9yZw",
            "grantedToV2": {
                "user": {
                    "@odata.type": "#microsoft.graph.sharePointIdentity",
                    "displayName": "Chad Scott",
                    "email": "chad@cdsconsulting.org",
                    "id": "7ecdcdf3-e69a-4194-8ad8-e290ea289fd5"
                },
                "siteUser": {
                    "displayName": "Chad Scott",
                    "email": "chad@cdsconsulting.org",
                    "id": "3",
                    "loginName": "i:0#.f|membership|chad.scott@cdsconsulting.org"
                }
            },
            "grantedTo": {
                "user": {
                    "displayName": "Chad Scott",
                    "email": "chad@cdsconsulting.org",
                    "id": "7ecdcdf3-e69a-4194-8ad8-e290ea289fd5"
                }
            }
        }
    ]
}

How do you think rclone should be changed to solve that?

Attempt to apply user permissions before group permissions, which works around the issue. Note that you can force this to be the case today by returning a sorted permissions object from the mapper, but it's probably not obvious that this is required.

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Support ContractIssues made for customers with support contracts

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions