2012-08-11 20:01:43 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ownCloud
|
|
|
|
*
|
|
|
|
* @author Michael Gapczynski
|
|
|
|
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
OC_JSON::callCheck();
|
|
|
|
OC_JSON::checkSubAdminUser();
|
|
|
|
if (isset($_GET['offset'])) {
|
|
|
|
$offset = $_GET['offset'];
|
|
|
|
} else {
|
|
|
|
$offset = 0;
|
|
|
|
}
|
|
|
|
$users = array();
|
2013-01-14 18:45:17 +00:00
|
|
|
if (OC_User::isAdminUser(OC_User::getUser())) {
|
2013-02-22 13:51:21 +00:00
|
|
|
$batch = OC_User::getDisplayNames('', 10, $offset);
|
|
|
|
foreach ($batch as $user => $displayname) {
|
2012-09-04 10:00:56 +00:00
|
|
|
$users[] = array(
|
2012-11-04 21:16:04 +00:00
|
|
|
'name' => $user,
|
2013-02-22 13:51:21 +00:00
|
|
|
'displayname' => $displayname,
|
2012-11-04 21:16:04 +00:00
|
|
|
'groups' => join(', ', OC_Group::getUserGroups($user)),
|
|
|
|
'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)),
|
2012-09-04 10:00:56 +00:00
|
|
|
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
|
2012-08-11 20:01:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
|
2012-08-11 20:24:50 +00:00
|
|
|
$batch = OC_Group::usersInGroups($groups, '', 10, $offset);
|
2012-08-11 20:01:43 +00:00
|
|
|
foreach ($batch as $user) {
|
2012-09-04 10:00:56 +00:00
|
|
|
$users[] = array(
|
2012-11-04 21:16:04 +00:00
|
|
|
'name' => $user,
|
2013-04-08 21:11:33 +00:00
|
|
|
'displayname' => OC_User::getDisplayName($user),
|
2012-11-04 21:16:04 +00:00
|
|
|
'groups' => join(', ', OC_Group::getUserGroups($user)),
|
2012-09-04 10:00:56 +00:00
|
|
|
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
|
2012-08-11 20:01:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-29 16:08:54 +00:00
|
|
|
OC_JSON::success(array('data' => $users));
|