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

Space properties opaque #3141

Merged
merged 7 commits into from
Feb 11, 2022
Merged

Space properties opaque #3141

merged 7 commits into from
Feb 11, 2022

Conversation

micbar
Copy link
Contributor

@micbar micbar commented Feb 9, 2022

Description

Change space properties implementation to use extended attributes instead of a spaces.yaml file

needs cs3org/reva#2527 and cs3org/reva#2512

Description

Properties should be stored by the storage driver and not the graph service.

We can now set and modify short description, space image and space readme. Only managers can set the short description. Editors can change the space image and readme id.

List spaces

curl -L -X GET 'https://localhost:9200/graph/v1.0/me/drives/' \
-H 'Authorization: Basic YWRtaW46YWRtaW4='

Response

{
    "value": [
        {
            "driveType": "public",
            "id": "7993447f-687f-490d-875c-ac95e89a62a4",
            "lastModifiedDateTime": "1970-01-01T01:00:00+01:00",
            "name": "Public shares",
            "root": {
                "id": "7993447f-687f-490d-875c-ac95e89a62a4",
                "webDavUrl": "https://localhost:9200/dav/spaces/7993447f-687f-490d-875c-ac95e89a62a4"
            }
        },
        {
            "description": "Admins Space",
            "driveType": "personal",
            "id": "ddc2004c-0977-11eb-9d3f-a793888cd0f8",
            "lastModifiedDateTime": "2022-02-10T13:50:32.203617+01:00",
            "name": "Test6",
            "owner": {
                "user": {
                    "id": "ddc2004c-0977-11eb-9d3f-a793888cd0f8"
                }
            },
            "quota": {
                "remaining": 70769467392,
                "state": "normal",
                "total": 70771960968,
                "used": 2493576
            },
            "root": {
                "id": "ddc2004c-0977-11eb-9d3f-a793888cd0f8",
                "permissions": [
                    {
                        "grantedTo": [
                            {
                                "user": {
                                    "id": "ddc2004c-0977-11eb-9d3f-a793888cd0f8"
                                }
                            }
                        ],
                        "roles": [
                            "manager"
                        ]
                    }
                ],
                "webDavUrl": "https://localhost:9200/dav/spaces/ddc2004c-0977-11eb-9d3f-a793888cd0f8"
            },
            "special": [
                {
                    "eTag": "\"ce0e9fa86a616a04e3426b425b7f7ecd\"",
                    "file": {
                        "mimeType": "text/markdown"
                    },
                    "id": "b1278e81-fc7f-40f9-ae21-0c823a9edc76",
                    "lastModifiedDateTime": "2022-02-04T20:36:52.000000738+01:00",
                    "name": "README.md",
                    "size": 6783,
                    "specialFolder": {
                        "name": "readme"
                    },
                    "webDavUrl": "https://localhost:9200/dav/spaces/ddc2004c-0977-11eb-9d3f-a793888cd0f8/README.md"
                },
                {
                    "eTag": "\"1b414efd23ee31ea29ce1d2d208a9991\"",
                    "file": {
                        "mimeType": "image/png"
                    },
                    "id": "c778e53f-1ed0-4962-af55-98f9f1162f99",
                    "lastModifiedDateTime": "2021-12-02T11:47:15.000000603+01:00",
                    "name": "1638442035562.png",
                    "size": 465337,
                    "specialFolder": {
                        "name": "image"
                    },
                    "webDavUrl": "https://localhost:9200/dav/spaces/ddc2004c-0977-11eb-9d3f-a793888cd0f8/1638442035562.png"
                }
            ]
        },
        {
            "driveType": "virtual",
            "id": "a0ca6a90-a365-4782-871e-d44447bbc668",
            "name": "Shares Jail",
            "quota": {
                "remaining": 0,
                "state": "exceeded",
                "total": 0,
                "used": 0
            },
            "root": {
                "id": "a0ca6a90-a365-4782-871e-d44447bbc668",
                "webDavUrl": "https://localhost:9200/dav/spaces/a0ca6a90-a365-4782-871e-d44447bbc668"
            }
        }
    ]
}

Update a Space

curl -L -X PATCH 'https://localhost:9200/graph/v1.0/drives/ddc2004c-0977-11eb-9d3f-a793888cd0f8' \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Content-Type: application/json' \
--data-raw '{
  "Name": "Test6",
  "Description": "foo",
  "special":[
      {
          "specialFolder": {
              "name": "image"
          },
          "id": "ffc2004c-0977-11eb-9d3f-a793888cd0f8"
      },
      {
          "specialFolder": {
              "name": "readme"
          },
          "id": "fd42004c-0977-11eb-9d3f-a793888cd0f8"
      }
  ]
}'

How Has This Been Tested?

  • manually

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@update-docs
Copy link

update-docs bot commented Feb 9, 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.

@micbar micbar force-pushed the space-properties-opaque branch 5 times, most recently from d6cd6e5 to 400858f Compare February 10, 2022 13:33
@micbar micbar requested a review from butonic February 10, 2022 13:46
@micbar micbar marked this pull request as ready for review February 10, 2022 13:49
Copy link
Member

@butonic butonic left a comment

Choose a reason for hiding this comment

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

burn yaml with fire

@micbar micbar marked this pull request as draft February 10, 2022 13:54
@ownclouders
Copy link
Contributor

ownclouders commented Feb 10, 2022

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

graph/pkg/service/v0/driveitems.go Outdated Show resolved Hide resolved
graph/pkg/service/v0/drives.go Outdated Show resolved Hide resolved
graph/pkg/service/v0/drives.go Outdated Show resolved Hide resolved
graph/pkg/service/v0/drives.go Outdated Show resolved Hide resolved
@micbar
Copy link
Contributor Author

micbar commented Feb 10, 2022

thanks @C0rby
I want to refactor tomorrow, the cyclomatic complexity is far to high IMO

@micbar micbar force-pushed the space-properties-opaque branch 2 times, most recently from e50c705 to a04075e Compare February 11, 2022 13:29
@micbar micbar requested a review from C0rby February 11, 2022 13:30
@micbar micbar marked this pull request as ready for review February 11, 2022 13:31
Copy link
Contributor

@C0rby C0rby left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarcloud
Copy link

sonarcloud bot commented Feb 11, 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 0 Code Smells

11.0% 11.0% Coverage
0.0% 0.0% Duplication

@micbar micbar merged commit 38a971e into master Feb 11, 2022
@delete-merged-branch delete-merged-branch bot deleted the space-properties-opaque branch February 11, 2022 14:37
ownclouders pushed a commit that referenced this pull request Feb 11, 2022
Merge: 5740691 b5af4d4
Author: Michael Barz <mbarz@owncloud.com>
Date:   Fri Feb 11 15:37:49 2022 +0100

    Merge pull request #3141 from owncloud/space-properties-opaque

    Space properties opaque
@AlexAndBear
Copy link
Contributor

nice 👍

ownclouders pushed a commit that referenced this pull request Feb 11, 2022
Merge: 5740691 b5af4d4
Author: Michael Barz <mbarz@owncloud.com>
Date:   Fri Feb 11 15:37:49 2022 +0100

    Merge pull request #3141 from owncloud/space-properties-opaque

    Space properties opaque
@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.

5 participants