summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-07-09 21:51:19 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-07-09 21:51:19 +0200
commitd0b625352cc8acc160e22cb2f4e9ae8e10f753f6 (patch)
tree70ce62fafd75de45d7c1c5e9616ac5229ef7537e /settings
parentacb196e17fb6d01a808e8758b5f852447cc03d99 (diff)
downloadnextcloud-server-d0b625352cc8acc160e22cb2f4e9ae8e10f753f6.tar.gz
nextcloud-server-d0b625352cc8acc160e22cb2f4e9ae8e10f753f6.zip
some work on subadmins
Diffstat (limited to 'settings')
-rw-r--r--settings/templates/users.php22
-rw-r--r--settings/users.php25
2 files changed, 37 insertions, 10 deletions
diff --git a/settings/templates/users.php b/settings/templates/users.php
index 55112424561..b16aa1ae16c 100644
--- a/settings/templates/users.php
+++ b/settings/templates/users.php
@@ -1,13 +1,14 @@
-<?php /**
+<?php
+/**
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
-
$allGroups=array();
foreach($_["groups"] as $group) {
$allGroups[]=$group['name'];
}
+$_['subadmingroups'] = $_['groups'];
?>
<div id="controls">
@@ -60,6 +61,9 @@ foreach($_["groups"] as $group) {
<th id='headerName'><?php echo $l->t('Name')?></th>
<th id="headerPassword"><?php echo $l->t( 'Password' ); ?></th>
<th id="headerGroups"><?php echo $l->t( 'Groups' ); ?></th>
+ <?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
+ <th id="headerSubAdmins"><?php echo $l->t('SubAdmins'); ?></th>
+ <?php endif;?>
<th id="headerQuota"><?php echo $l->t( 'Quota' ); ?></th>
<th id="headerRemove">&nbsp;</th>
</tr>
@@ -84,6 +88,20 @@ foreach($_["groups"] as $group) {
<?php endforeach;?>
</select>
</td>
+ <?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
+ <td class="subadmins"><select
+ data-username="<?php echo $user['name'] ;?>"
+ data-user-groups="<?php echo $user['groups'] ;?>"
+ data-placeholder="subadmins" title="<?php echo $l->t('SubAdmin for ...')?>"
+ multiple="multiple">
+ <?php foreach($_["subadmingroups"] as $group): ?>
+ <option value="<?php echo $group['name'];?>">
+ <?php echo $group['name'];?>
+ </option>
+ <?php endforeach;?>
+ </select>
+ </td>
+ <?php endif;?>
<td class="quota">
<div class="quota-select-wrapper">
<select class='quota-user'>
diff --git a/settings/users.php b/settings/users.php
index 026a30a750c..a6ce94bb5bd 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -6,7 +6,7 @@
*/
require_once('../lib/base.php');
-OC_Util::checkAdminUser();
+OC_Util::checkSubAdminUser();
// We have some javascript foo!
OC_Util::addScript( 'settings', 'users' );
@@ -17,11 +17,22 @@ OC_App::setActiveNavigationEntry( 'core_users' );
$users = array();
$groups = array();
-foreach( OC_User::getUsers() as $i ){
- $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Preferences::getValue($i,'files','quota','default'));
+$isadmin = OC_Group::inGroup(OC_User::getUser(),'admin')?true:false;
+if($isadmin){
+ $groups = OC_Group::getGroups();
+ $accessibleusers = OC_User::getUsers();
+ $subadmins = OC_SubAdmin::getAllSubAdmins();
+}else{
+ $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
+ $accessibleusers = OC_Group::usersInGroups($groups);
+ $subadmins = false;
}
-foreach( OC_Group::getGroups() as $i ){
+foreach($accessibleusers as $i){
+ $users[] = array( "name" => $i, "groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($i)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/),'quota'=>OC_Preferences::getValue($i,'files','quota','default'));
+}
+
+foreach( $groups as $i ){
// Do some more work here soon
$groups[] = array( "name" => $i );
}
@@ -44,10 +55,8 @@ if (\OC_App::isEnabled( "files_sharing" ) ) {
$tmpl = new OC_Template( "settings", "users", "user" );
$tmpl->assign( "users", $users );
$tmpl->assign( "groups", $groups );
+$tmpl->assign( 'subadmins', $subadmins);
$tmpl->assign( 'quota_preset', $quotaPreset);
$tmpl->assign( 'default_quota', $defaultQuota);
$tmpl->assign( 'share_notice', $shareNotice);
-$tmpl->printPage();
-
-?>
-
+$tmpl->printPage(); \ No newline at end of file