Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add permissions to the graph drives #3095

Merged
merged 1 commit into from
Feb 4, 2022
Merged

add permissions to the graph drives #3095

merged 1 commit into from
Feb 4, 2022

Conversation

C0rby
Copy link
Contributor

@C0rby C0rby commented Feb 2, 2022

Description

Added permissions to graph drives when listing drives.
A drive looks like this after this change:

{
    "driveType": "personal",
    "id": "058bff95-6708-4fe5-91e4-9ea3d377588b",
    "lastModifiedDateTime": "2022-02-03T11:15:11.464382312+01:00",
    "name": "Maurice Moss",
    "owner": {
        "user": {
            "id": "058bff95-6708-4fe5-91e4-9ea3d377588b"
        }
    },
    "root": {
        "id": "058bff95-6708-4fe5-91e4-9ea3d377588b",
        "permissions": [
            {
                "grantedTo": [
                    {
                        "user": {
                            "id": "058bff95-6708-4fe5-91e4-9ea3d377588b"
                        }
                    }
                ],
                "roles": [
                    "manager"
                ]
            }
        ],
        "webDavUrl": "https://localhost:9200/dav/spaces/058bff95-6708-4fe5-91e4-9ea3d377588b"
    }
}

Motivation and Context

We want to see who has access to a space.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Code changes

@update-docs
Copy link

update-docs bot commented Feb 2, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

go.mod Outdated Show resolved Hide resolved
@ownclouders
Copy link
Contributor

ownclouders commented Feb 4, 2022

💥 Acceptance test Core-API-Tests-ocis-storage-10 failed. Further test are cancelled...

@C0rby C0rby force-pushed the drive-permissions branch 5 times, most recently from b8b240e to 20204cb Compare February 4, 2022 13:08
@C0rby C0rby marked this pull request as ready for review February 4, 2022 13:50
@C0rby C0rby requested review from micbar and kobergj February 4, 2022 13:52
@sonarcloud
Copy link

sonarcloud bot commented Feb 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

12.8% 12.8% Coverage
0.0% 0.0% Duplication

for id, perm := range m {
// This temporary variable is necessary since we need to pass a pointer to the
// libregraph.Identity and if we pass the pointer from the loop every identity
// will have the same id.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice workaround

tmp := id
identity := libregraph.IdentitySet{User: &libregraph.Identity{Id: &tmp}}
switch {
case perm.AddGrant:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so AddGrant is our reverse engineering criterium for the manager role.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. That's currently the only way.

Copy link
Contributor

@micbar micbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let us add an odata query later

Copy link
Collaborator

@kobergj kobergj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just wondering why the changes to expected-failures and go.mod still appear. They are already in master 😄

@C0rby C0rby merged commit cc1c448 into master Feb 4, 2022
@delete-merged-branch delete-merged-branch bot deleted the drive-permissions branch February 4, 2022 14:42
ownclouders pushed a commit that referenced this pull request Feb 4, 2022
Merge: b0ef0b9 5668a43
Author: David Christofas <dchristofas@owncloud.com>
Date:   Fri Feb 4 15:42:50 2022 +0100

    Merge pull request #3095 from owncloud/drive-permissions

    add permissions to the graph drives
@micbar micbar mentioned this pull request Feb 16, 2022
22 tasks
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.

4 participants