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

Hide upload button with zero quota #5036

Merged
merged 2 commits into from
Jan 29, 2021
Merged

Conversation

PVince81
Copy link
Member

Whenever a user has zero quota, for example like guest app users, don't
display the upload button.

The quota value is retrieved for the attachment folder.

Fixes #4138

@SystemKeeper
Copy link
Contributor

Shouldn’t this distinguish between upload and share? If a normal user is created without quota, he‘s not allowed to upload something, but he could still share something that was shared with him. This PR would hide both options..?

@PVince81
Copy link
Member Author

Shouldn’t this distinguish between upload and share? If a normal user is created without quota, he‘s not allowed to upload something, but he could still share something that was shared with him. This PR would hide both options..?

I have tested this scenario as follows:

  1. Admin shares a folder "pics" with guest user guest1 and allows everything, even reshares
  2. Admin uploads a few pics into the "pics" directory
  3. Admin starts a conversation and invites Guest1
  4. Guest1 logs in and accesses the conversation
  5. Guest1 selects "Share" from the attachment menu and pics one of the pictures out of the "pics" directory
    💥

The request fails with a 500 error that returns a page:
image

So it seems this is explicitly blocked by the backend.
If we want this as a feature, need to look into it separately and also examine potential side effects as I don't fully understand what else the backend is doing, like creating shares.

@SystemKeeper
Copy link
Contributor

I've tested this yesterday with @Ivansss and it worked just fine. He shared a folder with me, I uploaded a picture and in talk shared in our conversation. So only difference was, that I uploaded the picture, but I don't see why it should behave differently there.

@PVince81
Copy link
Member Author

I've tested this yesterday with @Ivansss and it worked just fine. He shared a folder with me, I uploaded a picture and in talk shared in our conversation. So only difference was, that I uploaded the picture, but I don't see why it should behave differently there.

@SystemKeeper were you logged in as a guest user from the "guests" app or as a regular user ?
Guest users from the "guests" app are blocked by the API.

@PVince81
Copy link
Member Author

Alright, I think I see your point. You could be a regular user (not guest app user) but have zero quota.

Then the API would allow it.

This means we need another mechanism to detect if the current user is a guest app user.
So far I haven't found any in the frontend.

@SystemKeeper
Copy link
Contributor

SystemKeeper commented Jan 28, 2021

@PVince81 I'm a guest user on cloud.nextcloud.com (at least as far as I know)

@SystemKeeper
Copy link
Contributor

Alright, I think I see your point. You could be a regular user (not guest app user) but have zero quota.

That was my main concern, yes!

@PVince81
Copy link
Member Author

I need to retest everything (including changing attachment folder as guest) because I had an incomplete local setup. I had set the guest whitelist of apps to "files,spreed" and apparently it breaks shares.

Whenever a user has zero quota, for example like guest app users, don't
display the upload button.

The quota value is retrieved for the attachment folder.

Signed-off-by: Vincent Petry <[email protected]>
@PVince81 PVince81 force-pushed the bugfix/4138/hide-upload-zero-quota branch from 3583b13 to b8fd427 Compare January 28, 2021 15:02
@PVince81
Copy link
Member Author

Okay, with the correct whitelist (default one + spreed) sharing from a received folder works fine.

I've adjusted the code to distinguish between "upload perm" and "share perm".

Don't render the new message actions container when there are no actions
to render.

Signed-off-by: Vincent Petry <[email protected]>
@nickvergessen nickvergessen added this to the 💚 Next Alpha (21) milestone Jan 29, 2021
@PVince81 PVince81 merged commit 2e667c6 into master Jan 29, 2021
@PVince81 PVince81 deleted the bugfix/4138/hide-upload-zero-quota branch January 29, 2021 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release bug feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

abort infinite upload for guest users without storage
4 participants