diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-07-01 22:02:41 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-07-08 21:32:21 +0200 |
commit | da490bdbbeadfccd06a27d3c8f0cc8a9bc778294 (patch) | |
tree | d387c8c03ba8ee08ee6976edc7203d6f9fe9f2b0 /apps/user_ldap/tests/access.php | |
parent | dc15223edf6e534748b60bd32796ef3d7ee674c4 (diff) | |
download | nextcloud-server-da490bdbbeadfccd06a27d3c8f0cc8a9bc778294.tar.gz nextcloud-server-da490bdbbeadfccd06a27d3c8f0cc8a9bc778294.zip |
support for AD primary groups
support for primary groups
actually the problem is only known on AD, it is only needed to take care of their attributes
adjust to ADs special behaviour
this change was not intended
cache the SID value so it is not requested over and over again
theres only one, use singular
we are access
add tests for new Access methods
add tests for new Group methods
address scrutinizer findings, mostly doc
call ldap_explode_dn from ldap wrapper, enables tests without php5-ldap
PHP Doc
yo dawg, i heard you like backslashes … php doc fix
PHPDoc updated and typos fixed while reviewing
Diffstat (limited to 'apps/user_ldap/tests/access.php')
-rw-r--r-- | apps/user_ldap/tests/access.php | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php index 8ead5d68482..2ff7540b8ef 100644 --- a/apps/user_ldap/tests/access.php +++ b/apps/user_ldap/tests/access.php @@ -77,4 +77,54 @@ class Test_Access extends \PHPUnit_Framework_TestCase { $expected = 'foo\\\\*bar'; $this->assertTrue($expected === $access->escapeFilterPart($input)); } -}
\ No newline at end of file + + public function testConvertSID2StrSuccess() { + list($lw, $con, $um) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw, $um); + + $sidBinary = file_get_contents(__DIR__ . '/data/sid.dat'); + $sidExpected = 'S-1-5-21-249921958-728525901-1594176202'; + + $this->assertSame($sidExpected, $access->convertSID2Str($sidBinary)); + } + + public function testConvertSID2StrInputError() { + list($lw, $con, $um) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw, $um); + + $sidIllegal = 'foobar'; + $sidExpected = ''; + + $this->assertSame($sidExpected, $access->convertSID2Str($sidIllegal)); + } + + public function testGetDomainDNFromDNSuccess() { + list($lw, $con, $um) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw, $um); + + $inputDN = 'uid=zaphod,cn=foobar,dc=my,dc=server,dc=com'; + $domainDN = 'dc=my,dc=server,dc=com'; + + $lw->expects($this->once()) + ->method('explodeDN') + ->with($inputDN, 0) + ->will($this->returnValue(explode(',', $inputDN))); + + $this->assertSame($domainDN, $access->getDomainDNFromDN($inputDN)); + } + + public function testGetDomainDNFromDNError() { + list($lw, $con, $um) = $this->getConnecterAndLdapMock(); + $access = new Access($con, $lw, $um); + + $inputDN = 'foobar'; + $expected = ''; + + $lw->expects($this->once()) + ->method('explodeDN') + ->with($inputDN, 0) + ->will($this->returnValue(false)); + + $this->assertSame($expected, $access->getDomainDNFromDN($inputDN)); + } +} |