Merge pull request #12806 from owncloud/display-backend-in-usermgnt

Show user backend in user management
remotes/origin/fix-10825
Vincent Petry 10 years ago
commit c7ce3b84f0
  1. 3
      settings/controller/userscontroller.php
  2. 7
      settings/css/settings.css
  3. 31
      settings/js/users/users.js
  4. 22
      settings/templates/users/main.php
  5. 6
      settings/templates/users/part.userlist.php
  6. 14
      tests/settings/controller/userscontrollertest.php

@ -185,7 +185,8 @@ class UsersController extends Controller {
array( array(
'username' => $username, 'username' => $username,
'groups' => $this->groupManager->getUserGroupIds($user), 'groups' => $this->groupManager->getUserGroupIds($user),
'storageLocation' => $user->getHome() 'storageLocation' => $user->getHome(),
'backend' => $user->getBackendClassName()
), ),
Http::STATUS_CREATED Http::STATUS_CREATED
); );

@ -94,8 +94,11 @@ td.password>img,td.displayName>img, td.remove>a, td.quota>img { visibility:hidde
td.password, td.quota, td.displayName { width:12em; cursor:pointer; } td.password, td.quota, td.displayName { width:12em; cursor:pointer; }
td.password>span, td.quota>span, rd.displayName>span { margin-right: 1.2em; color: #C7C7C7; } td.password>span, td.quota>span, rd.displayName>span { margin-right: 1.2em; color: #C7C7C7; }
span.usersLastLoginTooltip { white-space: nowrap; } span.usersLastLoginTooltip { white-space: nowrap; }
th#headerLastLogin, td.lastLogin { display : none; } #userlist .storageLocation,
th#headerStorageLocation, td.storageLocation { display : none; } #userlist .userBackend,
#userlist .lastLogin {
display : none;
}
td.remove { width:1em; padding-right:1em; } td.remove { width:1em; padding-right:1em; }
tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; } tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; }

@ -28,7 +28,7 @@ var UserList = {
this.$el.find('.quota-user').singleSelect().on('change', this.onQuotaSelect); this.$el.find('.quota-user').singleSelect().on('change', this.onQuotaSelect);
}, },
add: function (username, displayname, groups, subadmin, quota, storageLocation, lastLogin, sort) { add: function (username, displayname, groups, subadmin, quota, storageLocation, lastLogin, sort, backend) {
var $tr = $userListBody.find('tr:first-child').clone(); var $tr = $userListBody.find('tr:first-child').clone();
// this removes just the `display:none` of the template row // this removes just the `display:none` of the template row
$tr.removeAttr('style'); $tr.removeAttr('style');
@ -116,6 +116,11 @@ var UserList = {
*/ */
$tr.find('td.storageLocation').text(storageLocation); $tr.find('td.storageLocation').text(storageLocation);
/**
* user backend
*/
$tr.find('td.userBackend').text(backend);
/** /**
* last login * last login
*/ */
@ -372,7 +377,7 @@ var UserList = {
if(UserList.has(user.name)) { if(UserList.has(user.name)) {
return true; return true;
} }
var $tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, user.storageLocation, user.lastLogin, false); var $tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, user.storageLocation, user.lastLogin, false, user.backend);
$tr.addClass('appear transparent'); $tr.addClass('appear transparent');
trs.push($tr); trs.push($tr);
loadedUsers++; loadedUsers++;
@ -731,7 +736,7 @@ $(document).ready(function () {
}, 10000); }, 10000);
} }
if(!UserList.has(username)) { if(!UserList.has(username)) {
UserList.add(username, username, result.groups, null, 'default', result.storageLocation, 0, true); UserList.add(username, username, result.groups, null, 'default', result.storageLocation, 0, true, result.backend);
} }
$('#newusername').focus(); $('#newusername').focus();
GroupList.incEveryoneCount(); GroupList.incEveryoneCount();
@ -743,21 +748,25 @@ $(document).ready(function () {
// Option to display/hide the "Storage location" column // Option to display/hide the "Storage location" column
$('#CheckboxStorageLocation').click(function() { $('#CheckboxStorageLocation').click(function() {
if ($('#CheckboxStorageLocation').is(':checked')) { if ($('#CheckboxStorageLocation').is(':checked')) {
$("#headerStorageLocation").show(); $("#userlist .storageLocation").show();
$("#userlist td.storageLocation").show();
} else { } else {
$("#headerStorageLocation").hide(); $("#userlist .storageLocation").hide();
$("#userlist td.storageLocation").hide();
} }
}); });
// Option to display/hide the "Last Login" column // Option to display/hide the "Last Login" column
$('#CheckboxLastLogin').click(function() { $('#CheckboxLastLogin').click(function() {
if ($('#CheckboxLastLogin').is(':checked')) { if ($('#CheckboxLastLogin').is(':checked')) {
$("#headerLastLogin").show(); $("#userlist .lastLogin").show();
$("#userlist td.lastLogin").show(); } else {
$("#userlist .lastLogin").hide();
}
});
// Option to display/hide the "Last Login" column
$('#CheckboxUserBackend').click(function() {
if ($('#CheckboxUserBackend').is(':checked')) {
$("#userlist .userBackend").show();
} else { } else {
$("#headerLastLogin").hide(); $("#userlist .userBackend").hide();
$("#userlist td.lastLogin").hide();
} }
}); });

@ -44,14 +44,24 @@ translation('settings');
<?php print_unescaped($this->inc('users/part.setquota')); ?> <?php print_unescaped($this->inc('users/part.setquota')); ?>
<div id="userlistoptions"> <div id="userlistoptions">
<p><label> <p>
<input type="checkbox" name="StorageLocation" value="StorageLocation" id="CheckboxStorageLocation"> <input type="checkbox" name="StorageLocation" value="StorageLocation" id="CheckboxStorageLocation">
<label for="CheckboxStorageLocation">
<?php p($l->t('Show storage location')) ?> <?php p($l->t('Show storage location')) ?>
</label></p> </label>
<p><label> </p>
<p>
<input type="checkbox" name="LastLogin" value="LastLogin" id="CheckboxLastLogin"> <input type="checkbox" name="LastLogin" value="LastLogin" id="CheckboxLastLogin">
<?php p($l->t('Show last log in')) ?> <label for="CheckboxLastLogin">
</label></p> <?php p($l->t('Show last log in')) ?>
</label>
</p>
<p>
<input type="checkbox" name="UserBackend" value="UserBackend" id="CheckboxUserBackend">
<label for="CheckboxUserBackend">
<?php p($l->t('Show user backend')) ?>
</label>
</p>
</div> </div>
</div> </div>
</div> </div>

@ -12,8 +12,9 @@
<th id="headerSubAdmins"><?php p($l->t('Group Admin for')); ?></th> <th id="headerSubAdmins"><?php p($l->t('Group Admin for')); ?></th>
<?php endif;?> <?php endif;?>
<th id="headerQuota"><?php p($l->t('Quota')); ?></th> <th id="headerQuota"><?php p($l->t('Quota')); ?></th>
<th id="headerStorageLocation"><?php p($l->t('Storage Location')); ?></th> <th class="storageLocation"><?php p($l->t('Storage Location')); ?></th>
<th id="headerLastLogin"><?php p($l->t('Last Login')); ?></th> <th class="userBackend"><?php p($l->t('User Backend')); ?></th>
<th class="lastLogin"><?php p($l->t('Last Login')); ?></th>
<th id="headerRemove">&nbsp;</th> <th id="headerRemove">&nbsp;</th>
</tr> </tr>
</thead> </thead>
@ -55,6 +56,7 @@
</select> </select>
</td> </td>
<td class="storageLocation"></td> <td class="storageLocation"></td>
<td class="userBackend"></td>
<td class="lastLogin"></td> <td class="lastLogin"></td>
<td class="remove"></td> <td class="remove"></td>
</tr> </tr>

@ -182,6 +182,10 @@ class UsersControllerTest extends \Test\TestCase {
$user $user
->method('getHome') ->method('getHome')
->will($this->returnValue('/home/user')); ->will($this->returnValue('/home/user'));
$user
->expects($this->once())
->method('getBackendClassName')
->will($this->returnValue('bar'));
$this->container['UserManager'] $this->container['UserManager']
->expects($this->once()) ->expects($this->once())
@ -193,7 +197,8 @@ class UsersControllerTest extends \Test\TestCase {
array( array(
'username' => 'foo', 'username' => 'foo',
'groups' => null, 'groups' => null,
'storageLocation' => '/home/user' 'storageLocation' => '/home/user',
'backend' => 'bar'
), ),
Http::STATUS_CREATED Http::STATUS_CREATED
); );
@ -214,6 +219,10 @@ class UsersControllerTest extends \Test\TestCase {
$user $user
->method('getHome') ->method('getHome')
->will($this->returnValue('/home/user')); ->will($this->returnValue('/home/user'));
$user
->expects($this->once())
->method('getBackendClassName')
->will($this->returnValue('bar'));
$existingGroup = $this->getMockBuilder('\OCP\IGroup') $existingGroup = $this->getMockBuilder('\OCP\IGroup')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$existingGroup $existingGroup
@ -250,7 +259,8 @@ class UsersControllerTest extends \Test\TestCase {
array( array(
'username' => 'foo', 'username' => 'foo',
'groups' => array('NewGroup', 'ExistingGroup'), 'groups' => array('NewGroup', 'ExistingGroup'),
'storageLocation' => '/home/user' 'storageLocation' => '/home/user',
'backend' => 'bar'
), ),
Http::STATUS_CREATED Http::STATUS_CREATED
); );

Loading…
Cancel
Save