]> source.dussan.org Git - nextcloud-server.git/commitdiff
Show user backend in user management
authorMorris Jobke <hey@morrisjobke.de>
Fri, 12 Dec 2014 09:21:50 +0000 (10:21 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 12 Dec 2014 13:19:29 +0000 (14:19 +0100)
* add switch to settings to show user backend
* user classes for headers and rows to unify the show/hide statement
* add user backend to response of user create request
* proper markup in settings area

settings/controller/userscontroller.php
settings/css/settings.css
settings/js/users/users.js
settings/templates/users/main.php
settings/templates/users/part.userlist.php
tests/settings/controller/userscontrollertest.php

index 589b0a888cbe3015f7f9f53a419c987eeb6c633a..dd3aa72890e893f3f70c1d00ec6c444f8357fd7c 100644 (file)
@@ -185,7 +185,8 @@ class UsersController extends Controller {
                        array(
                                'username' => $username,
                                'groups' => $this->groupManager->getUserGroupIds($user),
-                               'storageLocation' => $user->getHome()
+                               'storageLocation' => $user->getHome(),
+                               'backend' => $user->getBackendClassName()
                        ),
                        Http::STATUS_CREATED
                );
index 4594a22c6d01c52fbd06b28a6eb3361b6e66fd1a..fa699e50a4b626d89cc212cae4b4a363a202a9f7 100644 (file)
@@ -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>span, td.quota>span, rd.displayName>span { margin-right: 1.2em; color: #C7C7C7; }
 span.usersLastLoginTooltip { white-space: nowrap; }
-th#headerLastLogin, td.lastLogin { display : none; }
-th#headerStorageLocation, td.storageLocation { display : none; }
+#userlist .storageLocation,
+#userlist .userBackend,
+#userlist .lastLogin {
+       display : none;
+}
 
 td.remove { width:1em; padding-right:1em; }
 tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; }
index 70dd115396d8891dbb8e5acc811c8485f731b710..62e18d1be04350bda94627353d8acd357cf17b5f 100644 (file)
@@ -28,7 +28,7 @@ var UserList = {
                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();
                // this removes just the `display:none` of the template row
                $tr.removeAttr('style');
@@ -116,6 +116,11 @@ var UserList = {
                 */
                $tr.find('td.storageLocation').text(storageLocation);
 
+               /**
+                * user backend
+                */
+               $tr.find('td.userBackend').text(backend);
+
                /**
                 * last login
                 */
@@ -372,7 +377,7 @@ var UserList = {
                                        if(UserList.has(user.name)) {
                                                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');
                                        trs.push($tr);
                                        loadedUsers++;
@@ -731,7 +736,7 @@ $(document).ready(function () {
                                                }, 10000);
                                }
                                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();
                                GroupList.incEveryoneCount();
@@ -743,21 +748,25 @@ $(document).ready(function () {
        // Option to display/hide the "Storage location" column
        $('#CheckboxStorageLocation').click(function() {
                if ($('#CheckboxStorageLocation').is(':checked')) {
-                       $("#headerStorageLocation").show();
-                       $("#userlist td.storageLocation").show();
+                       $("#userlist .storageLocation").show();
                } else {
-                       $("#headerStorageLocation").hide();
-                       $("#userlist td.storageLocation").hide();
+                       $("#userlist .storageLocation").hide();
                }
        });
        // Option to display/hide the "Last Login" column
        $('#CheckboxLastLogin').click(function() {
                if ($('#CheckboxLastLogin').is(':checked')) {
-                       $("#headerLastLogin").show();
-                       $("#userlist td.lastLogin").show();
+                       $("#userlist .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 {
-                       $("#headerLastLogin").hide();
-                       $("#userlist td.lastLogin").hide();
+                       $("#userlist .userBackend").hide();
                }
        });
 
index 1923f4b0493af043d66cbba58069f01bae726ccb..c32c8df68096d4d9acac19ef291761a7b9366b77 100644 (file)
@@ -44,14 +44,24 @@ translation('settings');
                        <?php print_unescaped($this->inc('users/part.setquota')); ?>
 
                        <div id="userlistoptions">
-                               <p><label>
-                                               <input type="checkbox" name="StorageLocation" value="StorageLocation" id="CheckboxStorageLocation">
+                               <p>
+                                       <input type="checkbox" name="StorageLocation" value="StorageLocation" id="CheckboxStorageLocation">
+                                       <label for="CheckboxStorageLocation">
                                                <?php p($l->t('Show storage location')) ?>
-                               </label></p>
-                               <p><label>
+                                       </label>
+                               </p>
+                               <p>
                                        <input type="checkbox" name="LastLogin" value="LastLogin" id="CheckboxLastLogin">
-                                       <?php p($l->t('Show last log in')) ?>
-                               </label></p>
+                                       <label for="CheckboxLastLogin">
+                                               <?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>
index c531323a2fac6fbea23d37f9cdb9b97d9b525d9c..6a6b0b69fa2e0f49439f57e106644d50e8934e53 100644 (file)
@@ -12,8 +12,9 @@
                        <th id="headerSubAdmins"><?php p($l->t('Group Admin for')); ?></th>
                        <?php endif;?>
                        <th id="headerQuota"><?php p($l->t('Quota')); ?></th>
-                       <th id="headerStorageLocation"><?php p($l->t('Storage Location')); ?></th>
-                       <th id="headerLastLogin"><?php p($l->t('Last Login')); ?></th>
+                       <th class="storageLocation"><?php p($l->t('Storage Location')); ?></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>
                </tr>
        </thead>
@@ -55,6 +56,7 @@
                                </select>
                        </td>
                        <td class="storageLocation"></td>
+                       <td class="userBackend"></td>
                        <td class="lastLogin"></td>
                        <td class="remove"></td>
                </tr>
index eb48babadc85ebdbbff8f4d67b18f0e48407e99f..26ca6f7e5f336f42e909a7e09df32843a17ccd0f 100644 (file)
@@ -182,6 +182,10 @@ class UsersControllerTest extends \Test\TestCase {
                $user
                        ->method('getHome')
                        ->will($this->returnValue('/home/user'));
+               $user
+                       ->expects($this->once())
+                       ->method('getBackendClassName')
+                       ->will($this->returnValue('bar'));
 
                $this->container['UserManager']
                        ->expects($this->once())
@@ -193,7 +197,8 @@ class UsersControllerTest extends \Test\TestCase {
                        array(
                                'username' => 'foo',
                                'groups' => null,
-                               'storageLocation' => '/home/user'
+                               'storageLocation' => '/home/user',
+                               'backend' => 'bar'
                        ),
                        Http::STATUS_CREATED
                );
@@ -214,6 +219,10 @@ class UsersControllerTest extends \Test\TestCase {
                $user
                        ->method('getHome')
                        ->will($this->returnValue('/home/user'));
+               $user
+                       ->expects($this->once())
+                       ->method('getBackendClassName')
+                       ->will($this->returnValue('bar'));
                $existingGroup = $this->getMockBuilder('\OCP\IGroup')
                        ->disableOriginalConstructor()->getMock();
                $existingGroup
@@ -250,7 +259,8 @@ class UsersControllerTest extends \Test\TestCase {
                        array(
                                'username' => 'foo',
                                'groups' => array('NewGroup', 'ExistingGroup'),
-                               'storageLocation' => '/home/user'
+                               'storageLocation' => '/home/user',
+                               'backend' => 'bar'
                        ),
                        Http::STATUS_CREATED
                );