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

Support getting disk quota usage of a user programmatically #1345

Closed
NyanCatTW1 opened this issue Jul 2, 2023 · 3 comments
Closed

Support getting disk quota usage of a user programmatically #1345

NyanCatTW1 opened this issue Jul 2, 2023 · 3 comments
Labels
invalid This doesn't seem right

Comments

@NyanCatTW1
Copy link

NyanCatTW1 commented Jul 2, 2023

Is your feature request related to a problem? Please describe.

Me and a friend want to provide storage renting service, and SFTPGo seems like a promising solution. However, there currently isn't a reliable way to know how much storage an user is using without logging into their user, or viewing the SQL database directly (used_quota_size and used_quota_files). This is blocking me from writing another daemon that tracks the disk usage in real time, so that we know how much the users should pay. That's why I hope there is an endpoint for the purpose.

Describe the solution you'd like

Add a new endpoint, GET /quotas/users/{username}/usage, that returns similarly to the following

{
  "used_quota_size": 90381755170,
  "used_quota_files": 2508
}

While we are at it, it might be a good idea to also add endpoints for getting transfer quota usage and folder quota usage.

Describe alternatives you've considered

  1. Logging into the user's account to view the quota usage
    Why not: Requires either knowing the password of the user and storing them in plaintext, or adding a backdoor to the login mechanism, which is even unsafer. It's also slightly more complicated to automate

  2. Fetching quota usage from the SQL database directly
    Why not: Requires root/sftpgo permission and exposes the daemon to more information than necessary (eg. the salted passwords)

What are you using SFTPGo for?

2-person business

Additional context

I might implement this myself within this week, as it seems like a simple task to do. Hopefully my instinct is right this time!

@NyanCatTW1 NyanCatTW1 added the suggestion Feature suggestion label Jul 2, 2023
@NyanCatTW1 NyanCatTW1 changed the title Support getting disk quota usage of a user Support getting disk quota usage of a user programmatically Jul 2, 2023
@drakkan drakkan added invalid This doesn't seem right and removed suggestion Feature suggestion labels Jul 2, 2023
@drakkan drakkan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2023
@NyanCatTW1
Copy link
Author

NyanCatTW1 commented Jul 2, 2023

@drakkan May I know what was invalid with the Issue?
Oh, right, how ignorant I was to post the issue without reading the Support policy first. Well then, see you in the PR later

@drakkan
Copy link
Owner

drakkan commented Jul 2, 2023

@drakkan May I know what was invalid with the Issue? Oh, right, how ignorant I was to post the issue without reading the Support policy first. Well then, see you in the PR later

this can already be done, a PR will be closed the same way, as for PRs read this comment. Thank you

@NyanCatTW1
Copy link
Author

For the record, it's in GET /users/{username}. Dumb me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants