diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-04-25 15:07:05 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-04-25 15:07:05 +0200 |
commit | 43f451e9e0e92c99285a471209e6645ff0b0eed9 (patch) | |
tree | ee0d2c480fed33f5d625cff2efcec90d02a4193b /apps/user_ldap/tests | |
parent | 685faad5ca437895e035cfe9583e1978e6ddedba (diff) | |
download | nextcloud-server-43f451e9e0e92c99285a471209e6645ff0b0eed9.tar.gz nextcloud-server-43f451e9e0e92c99285a471209e6645ff0b0eed9.zip |
Fix usersInGroup retrieval
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r-- | apps/user_ldap/tests/Group_LDAPTest.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index fc13b8a35e5..9b5216742fe 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -443,6 +443,43 @@ class Group_LDAPTest extends \Test\TestCase { ->will($this->returnCallback(function($dn, $attr) { if($attr === 'primaryGroupToken') { return array(1337); + } else if($attr === 'gidNumber') { + return [4211]; + } + return array(); + })); + + $access->expects($this->any()) + ->method('groupname2dn') + ->will($this->returnValue('cn=foobar,dc=foo,dc=bar')); + + $access->expects($this->exactly(2)) + ->method('nextcloudUserNames') + ->willReturnOnConsecutiveCalls(['lisa', 'bart', 'kira', 'brad'], ['walle', 'dino', 'xenia']); + + $groupBackend = new GroupLDAP($access); + $users = $groupBackend->usersInGroup('foobar'); + + $this->assertSame(7, count($users)); + } + + /** + * tests that a user listing is complete, if all it's members have the group + * as their primary. + */ + public function testUsersInGroupPrimaryAndUnixMembers() { + $access = $this->getAccessMock(); + $this->enableGroups($access); + + $access->connection->expects($this->any()) + ->method('getFromCache') + ->will($this->returnValue(null)); + + $access->expects($this->any()) + ->method('readAttribute') + ->will($this->returnCallback(function($dn, $attr) { + if($attr === 'primaryGroupToken') { + return array(1337); } return array(); })); |