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

Setting quota via curl not working #15

Open
mrAceT opened this issue Mar 1, 2021 · 8 comments
Open

Setting quota via curl not working #15

mrAceT opened this issue Mar 1, 2021 · 8 comments
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working

Comments

@mrAceT
Copy link

mrAceT commented Mar 1, 2021

I have a clean install of NextCloud on CentOS 8 with PHP 7.4

All is working well, I installed the 'groupquota' plugin and I am able to set the group quota via occ and I am able to read the goupquota via curl. But setting the groupquota via curl does not work (following the instructions offcource)

@icewind1991
Copy link
Member

What output do you get from the curl command (if any)

If the response is empty try adding -i to get the response headers

@mrAceT
Copy link
Author

mrAceT commented Mar 3, 2021

Ik get the exact same response as without setting a different quota.. it simply doesn't listen

#curl -u admin:XXXX -H 'OCS-APIRequest: true' https://YYYY/apps/groupquota/quota/zzzz -X POST -d 'quota=1GB'
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message>OK</message>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data>
  <quota_bytes>2147483648</quota_bytes>
  <quota_human>2 GB</quota_human>
  <used_bytes>33584702</used_bytes>
  <used_human>32 MB</used_human>
  <used_relative>1.56</used_relative>
 </data>
</ocs>

@mrAceT
Copy link
Author

mrAceT commented Apr 2, 2021

Excuse me, with the "-i" option:

# curl -u XXX:YYY -i -H 'OCS-APIRequest: true' https://ZZZ/apps/groupquota/quota/xxx-X POST -d 'quota=1GB'
HTTP/2 404
date: Fri, 02 Apr 2021 08:32:24 GMT
server: Apache/2.4.37 (centos) OpenSSL/1.1.1g
x-powered-by: PHP/7.4.16
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
cache-control: no-cache, no-store, must-revalidate
content-security-policy: default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
feature-policy: autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'
x-robots-tag: none
set-cookie: oc_sessionPassphrase=NxxxipkpKFFRp%2BvovujkP0HZ29rzZuWfzU2hITYVKZ2rkS8H9%2zzzRHtZRGUx0D2mx; path=/; secure; HttpOnly; SameSite=Lax
set-cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
set-cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
set-cookie: oXXXw3=hdsoi7nfbZZZqd8; path=/; secure; HttpOnly; SameSite=Lax
set-cookie: cookie_test=test; expires=Fri, 02-Apr-2021 09:32:25 GMT; Max-Age=3600
strict-transport-security: max-age=63072000; includeSubDomains
content-length: 389
content-security-policy: default-src https:; connect-src https:; font-src https: data:; frame-src https:; img-src https: data: blob:; media-src https:; object-src https:; script-src 'unsafe-inline' 'unsafe-eval' https:; style-src 'unsafe-inline' https:; frame-ancestors 'self'
content-type: application/xml; charset=utf-8

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message>OK</message>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data>
  <quota_bytes>2147483648</quota_bytes>
  <quota_human>2 GB</quota_human>
  <used_bytes>50500942</used_bytes>
  <used_human>48.2 MB</used_human>
  <used_relative>2.35</used_relative>
 </data>
</ocs>

Hmmmm, I see "404" !?

@netbuild
Copy link

same problem as here. setting the quota via api does not work.

@netbuild
Copy link

the route to set the quota does not work. the call keeps getting to the getQuota method in the controller. simple workaround:

change this

return [ 'routes' => [ ['name' => 'Quota#setQuota', 'url' => '/quota/{groupId}', 'verb' => 'PUT'], ['name' => 'Quota#getQuota', 'url' => '/quota/{groupId}', 'verb' => 'GET'], ], ];

to

return [ 'ocs' => [ ['name' => 'Quota#setQuota', 'url' => '/quota/{groupId}', 'verb' => 'PUT'], ['name' => 'Quota#getQuota', 'url' => '/quota/{groupId}', 'verb' => 'GET'], ], ];

and use instead of

https://domain.xyz/apps/groupquota/quota

this url pattern

https://domain.xyz/ocs/v2.php/apps/groupquota/quota

@wlaskovic
Copy link

wlaskovic commented Dec 5, 2022

Hi. Has this task been resolved? Because I've encountered the same problem. And as I see from here, the route was changed, but it for some reason never run into the POST, only into the GET part. Via occ I was able to execute the command correctly and the result was also as expected.

@mrAceT
Copy link
Author

mrAceT commented Dec 6, 2022

sorry, forgot about this one.. take a look at this bug:

nextcloud/server#34422

I managed to fix that one.. might it be that that "Q&D fix" fixes this problem too?

@henmohr
Copy link

henmohr commented Sep 12, 2024

Hi!
curl -X PUT https://$ADMIN:$PASS@$URL/ocs/v1.php/cloud/users/$EMAIL -d key="quota" -d value="2GB" -H "OCS-APIRequest: true"


<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message>OK</message>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data/>
</ocs>

But doesn't change nor in web nor in occ groupquota:list.

@joshtrichards joshtrichards added bug Something isn't working 1. to develop Accepted and waiting to be taken care of labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants