Skip to content
Snippets Groups Projects
Verified Commit d000a132 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Can now update user quota in UI

parent 68540cf4
No related branches found
No related tags found
No related merge requests found
......@@ -93,11 +93,13 @@ class ManageUserSimpleSerializer(serializers.ModelSerializer):
"date_joined",
"last_activity",
"privacy_level",
"upload_quota",
)
class ManageUserSerializer(serializers.ModelSerializer):
permissions = PermissionsSerializer(source="*")
upload_quota = serializers.IntegerField(allow_null=True)
class Meta:
model = users_models.User
......@@ -113,6 +115,7 @@ class ManageUserSerializer(serializers.ModelSerializer):
"last_activity",
"permissions",
"privacy_level",
"upload_quota",
)
read_only_fields = [
"id",
......
......@@ -78,6 +78,25 @@
</select>
</td>
</tr>
<tr>
<td>
<translate>Upload quota</translate>
<span :data-tooltip="labels.uploadQuota"><i class="question circle icon"></i></span>
</td>
<td>
<div class="ui right labeled input">
<input
class="ui input"
@change="update('upload_quota', true)"
v-model.number="object.upload_quota"
step="100"
type="number" />
<div class="ui basic label">
<translate>MB</translate>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
......@@ -122,8 +141,12 @@ export default {
self.isLoading = false
})
},
update (attr) {
update (attr, toNull) {
let newValue = this.object[attr]
if (toNull && !newValue) {
newValue = null
}
console.log(newValue, typeof(newValue))
let params = {}
if (attr === 'permissions') {
params['permissions'] = {}
......@@ -143,7 +166,8 @@ export default {
computed: {
labels () {
return {
inactive: this.$gettext('Determine if the user account is active or not. Inactive users cannot login or use the service.')
inactive: this.$gettext('Determine if the user account is active or not. Inactive users cannot login or use the service.'),
uploadQuota: this.$gettext('Determine how much content the user can upload. Leave empty to use the default value of the instance.')
}
},
allPermissions () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment