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

enable users to list all spaces #2692

Merged
merged 1 commit into from
Oct 28, 2021
Merged

enable users to list all spaces #2692

merged 1 commit into from
Oct 28, 2021

Conversation

C0rby
Copy link
Contributor

@C0rby C0rby commented Oct 27, 2021

Description

Added a new permission list-all-spaces and a new endpoint to list all spaces.

Motivation and Context

Some users should be able to list all spaces so they can maintain them. (Update quota, etc.)

How Has This Been Tested?

  • locally via the graph explorer

Types of changes

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

Checklist:

  • Code changes

@C0rby C0rby added the Status:Needs-Review Needs review from a maintainer label Oct 27, 2021
@C0rby C0rby self-assigned this Oct 27, 2021
@ownclouders
Copy link
Contributor

💥 Acceptance tests Core-API-Tests-ocis-storage-3 failed. The build is cancelled...

@sonarcloud
Copy link

sonarcloud bot commented Oct 27, 2021

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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

}
value, err := json.Marshal(permissions)
if err != nil {
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

this will be a good spot to add a trace and set the state to error. There should be one in the context if tracing is enabled, and use the default traceprovider (which writes to nil) if none is configured, it's safe code, and we will benefit from the trace :D we should get in the habit of doing so I guess

@refs
Copy link
Member

refs commented Oct 28, 2021

should we merge this as it is? doesn't it need a Reva counterpart that reads the opaque?

@wkloucek
Copy link
Contributor

should we merge this as it is? doesn't it need a Reva counterpart that reads the opaque?

should be this: cs3org/reva#2207

if err == nil {
permissions[settingsSvc.ListAllSpacesPermissionName] = struct{}{}
}
value, err := json.Marshal(permissions)
Copy link
Member

Choose a reason for hiding this comment

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

Also, why not using a plain text encoder? Since you're setting the map to be of capacity 1, I imagine for the purposes of this only and not with scaling in mind. IIRC we discussed it was a hack and could easily use a plain text encoder and save some bytes 🤷 . The encoded json stikl takes up 22 bytes (with an example title). See this playground

@refs
Copy link
Member

refs commented Oct 28, 2021

should we merge this as it is? doesn't it need a Reva counterpart that reads the opaque?

should be this: cs3org/reva#2207

Nice! missed it, didn't search merged ones. Thanks, then my last review comment is invalid since it is already merged on reva!

@C0rby C0rby merged commit 8f6a32d into master Oct 28, 2021
@delete-merged-branch delete-merged-branch bot deleted the list-all-spaces branch October 28, 2021 07:53
@C0rby
Copy link
Contributor Author

C0rby commented Oct 28, 2021

Ah damn. sorry merged too early. I should've read your comments first... 🙈

ownclouders pushed a commit that referenced this pull request Oct 28, 2021
Merge: 55adc87 2986265
Author: David Christofas <dchristofas@owncloud.com>
Date:   Thu Oct 28 09:53:11 2021 +0200

    Merge pull request #2692 from owncloud/list-all-spaces

    enable users to list all spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status:Needs-Review Needs review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants