Skip to content

Commit 3e6ad7a

Browse files
committed
Indicate users default quota
Indicate users default quota Signed-off-by: Rinat Gumirov <rinat.gumirov@mail.ru>
1 parent 0a2476f commit 3e6ad7a

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

apps/provisioning_api/lib/Controller/AUserData.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ protected function getUserSubAdminGroupsData(string $userId): array {
159159
*/
160160
protected function fillStorageInfo(string $userId): array {
161161
try {
162+
$quotaConfig = \OC::$server->getConfig()->getUserValue($userId, 'files', 'quota', 'default');
163+
$isQuotaDefault = $quotaConfig === 'default';
162164
\OC_Util::tearDownFS();
163165
\OC_Util::setupFS($userId);
164166
$storage = OC_Helper::getStorageInfo('/');
@@ -168,6 +170,7 @@ protected function fillStorageInfo(string $userId): array {
168170
'total' => $storage['total'],
169171
'relative' => $storage['relative'],
170172
'quota' => $storage['quota'],
173+
'isQuotaDefault' => $isQuotaDefault,
171174
];
172175
} catch (NotFoundException $ex) {
173176
// User fs is not setup yet
@@ -181,7 +184,8 @@ protected function fillStorageInfo(string $userId): array {
181184
}
182185
$data = [
183186
'quota' => $quota !== false ? $quota : 'none',
184-
'used' => 0
187+
'used' => 0,
188+
'isQuotaDefault' => $isQuotaDefault,
185189
];
186190
}
187191
return $data;

settings/src/components/userList.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,9 @@ export default {
150150
InfiniteLoading
151151
},
152152
data() {
153-
let unlimitedQuota = {id:'none', label:t('settings', 'Unlimited')},
154-
defaultQuota = {id:'default', label:t('settings', 'Default quota')};
153+
let unlimitedQuota = {id:'none', label:t('settings', 'Unlimited')};
155154
return {
156155
unlimitedQuota: unlimitedQuota,
157-
defaultQuota: defaultQuota,
158156
loading: {
159157
all: false,
160158
groups: false
@@ -168,7 +166,7 @@ export default {
168166
mailAddress:'',
169167
groups: [],
170168
subAdminsGroups: [],
171-
quota: defaultQuota,
169+
quota: this.defaultQuota,
172170
language: {code: 'en', name: t('settings', 'Default language')}
173171
}
174172
};
@@ -197,6 +195,12 @@ export default {
197195
this.userSearch = new OCA.Search(this.search, this.resetSearch);
198196
},
199197
computed: {
198+
defaultQuota() {
199+
return {
200+
id: 'default',
201+
label: `${this.settings.defaultQuota} (${t('settings', 'Default quota')})`
202+
};
203+
},
200204
settings() {
201205
return this.$store.getters.getServerData;
202206
},

settings/src/components/userList/userRow.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ export default {
234234
},
235235
// Mapping saved values to objects
236236
userQuota() {
237-
if (this.user.quota.quota >= 0) {
237+
if (this.user.quota.quota >= 0 && !this.user.quota.isQuotaDefault) {
238238
// if value is valid, let's map the quotaOptions or return custom quota
239239
let humanQuota = OC.Util.humanFileSize(this.user.quota.quota);
240240
let userQuota = this.quotaOptions.find(quota => quota.id === humanQuota);
241241
return userQuota ? userQuota : {id:humanQuota, label:humanQuota};
242-
} else if (this.user.quota.quota === 'default') {
242+
} else if (this.user.quota.quota === 'default' || this.user.quota.isQuotaDefault) {
243243
// default quota is replaced by the proper value on load
244244
return this.quotaOptions[0];
245245
}

0 commit comments

Comments
 (0)