Commit aee3ac58 authored by Boiget Boiget's avatar Boiget Boiget

Set quota on folder creation (in bytes, unlimited if not set)

parent 59c1d697
Pipeline #2325 passed with stages
in 5 minutes and 5 seconds
......@@ -114,6 +114,33 @@ class NextcloudClient {
});
}
_addQuotaToFolder(folderId) {
// get quota (in bytes) from settings, or -3 if not set (unlimited)
const quota = Meteor.settings.nextcloud.nextcloudQuota || -3;
return axios
.post(
`${this.appsURL}/groupfolders/folders/${folderId}/quota`,
{
quota,
},
{
params: { format: 'json' },
headers: {
'Content-Type': 'application/json',
Authorization: `Basic ${this.basicAuth}`,
'OCS-APIRequest': true,
},
},
)
.then((response) => {
const infos = response.data.ocs.meta;
if (_checkFolderActive(response) && infos.status === 'ok') {
return true;
}
return false;
});
}
addGroupFolder(groupName, folderName) {
// creates a new group folder and configure access for group users
return axios
......@@ -138,9 +165,16 @@ class NextcloudClient {
return this._addGroupToFolder(groupName, folderName, response.data.ocs.data.id).then((resp) => {
if (resp === true) {
console.log(`Nextcloud: access and permissions set for group folder ${folderName}`);
} else {
console.log(`Nextcloud: ERROR settings group permissions for group folder ${folderName}`);
return this._addQuotaToFolder(response.data.ocs.data.id).then((respQuota) => {
if (respQuota) {
console.log(`Nextcloud: quota set for group folder ${folderName}`);
} else {
console.log(`Nextcloud: ERROR setting quota on group folder ${folderName}`);
}
return respQuota;
});
}
console.log(`Nextcloud: ERROR settings group permissions for group folder ${folderName}`);
return resp;
});
}
......
......@@ -47,7 +47,7 @@
"nextcloud": {
"nextcloudUser": "",
"nextcloudPassword": "",
"nextcloudQuota": ""
"nextcloudQuota": "1073741824"
},
"private": {
"fillWithFakeData": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment