From 6cf418f2fae60dd5f7d3dd1cf77977f6faa0dfcb Mon Sep 17 00:00:00 2001
From: Georg Ehrke <dev@georgswebsite.de>
Date: Thu, 19 Jul 2012 18:00:33 +0200
Subject: [PATCH] fix copy&paste fail and deny subadmins to set the default
 qouta

---
 settings/ajax/removeuser.php | 2 +-
 settings/ajax/setquota.php   | 4 ++--
 settings/templates/users.php | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/settings/ajax/removeuser.php b/settings/ajax/removeuser.php
index 1439cfe373..bfab13a68c 100644
--- a/settings/ajax/removeuser.php
+++ b/settings/ajax/removeuser.php
@@ -10,7 +10,7 @@ $username = $_POST["username"];
 
 if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)){
 	$l = OC_L10N::get('core');
-	self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
+	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
 	exit();
 }
 
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
index 55e936515e..2a30b1d97e 100644
--- a/settings/ajax/setquota.php
+++ b/settings/ajax/setquota.php
@@ -13,9 +13,9 @@ OCP\JSON::callCheck();
 
 $username = isset($_POST["username"])?$_POST["username"]:'';
 
-if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)){
+if(($username == '' && !OC_Group::inGroup(OC_User::getUser(), 'admin')) || (!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username))){
 	$l = OC_L10N::get('core');
-	self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
+	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
 	exit();
 }
 
diff --git a/settings/templates/users.php b/settings/templates/users.php
index 649fce107d..9f246423d2 100644
--- a/settings/templates/users.php
+++ b/settings/templates/users.php
@@ -32,7 +32,7 @@ $_['subadmingroups'] = array_flip($items);
 	<div class="quota">
 		<span><?php echo $l->t('Default Quota');?>:</span>
 		<div class="quota-select-wrapper">
-			<select class='quota'>
+			<select class='quota' <?php if(!(is_array($_['subadmins']) || $_['subadmins'])) echo 'disabled="disabled"'; ?>>
 				<?php foreach($_['quota_preset'] as $preset):?>
 				<?php if($preset!='default'):?>
 				<option
-- 
GitLab