From a47f33d7a4e3783d15e8eac767ddd87d2333f726 Mon Sep 17 00:00:00 2001 From: Johannes Keyser Date: Thu, 31 Aug 2017 01:08:54 +0200 Subject: [PATCH] disks: warning about low space only for users in admin group Signed-off-by: Johannes Keyser Reviewed-by: Sunil Mohan Adapa --- plinth/modules/disks/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plinth/modules/disks/views.py b/plinth/modules/disks/views.py index 1fa1dffa2..77720d939 100644 --- a/plinth/modules/disks/views.py +++ b/plinth/modules/disks/views.py @@ -26,7 +26,7 @@ from django.template.response import TemplateResponse from django.urls import reverse from django.utils.translation import ugettext as _ from plinth.modules import disks as disks_module -from plinth.utils import format_lazy +from plinth.utils import format_lazy, is_user_admin logger = logging.getLogger(__name__) @@ -76,6 +76,9 @@ def expand_partition(request, device): def warn_about_low_disk_space(request): """Warn about insufficient space on root partition.""" + if not is_user_admin(request, cached=False): + return + disks = disks_module.get_disks() list_root = [disk for disk in disks if disk['mountpoint'] == '/'] perc_used = list_root[0]['percentage_used'] if list_root else -1