memberOf resembles a DN as well and is actively used
This commit is contained in:
parent
d68079f932
commit
0dde79b75b
|
@ -215,7 +215,9 @@ class Access extends LDAPUtility implements user\IUserTools {
|
||||||
$resemblingAttributes = array(
|
$resemblingAttributes = array(
|
||||||
'dn',
|
'dn',
|
||||||
'uniquemember',
|
'uniquemember',
|
||||||
'member'
|
'member',
|
||||||
|
// memberOf is an "operational" attribute, without a definition in any RFC
|
||||||
|
'memberof'
|
||||||
);
|
);
|
||||||
return in_array($attr, $resemblingAttributes);
|
return in_array($attr, $resemblingAttributes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,4 +260,38 @@ class Test_Access extends \Test\TestCase {
|
||||||
|
|
||||||
$access->batchApplyUserAttributes($data);
|
$access->batchApplyUserAttributes($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dNAttributeProvider() {
|
||||||
|
// corresponds to Access::resemblesDN()
|
||||||
|
return array(
|
||||||
|
'dn' => array('dn'),
|
||||||
|
'uniqueMember' => array('uniquemember'),
|
||||||
|
'member' => array('member'),
|
||||||
|
'memberOf' => array('memberof')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider dNAttributeProvider
|
||||||
|
*/
|
||||||
|
public function testSanitizeDN($attribute) {
|
||||||
|
list($lw, $con, $um) = $this->getConnectorAndLdapMock();
|
||||||
|
|
||||||
|
|
||||||
|
$dnFromServer = 'cn=Mixed Cases,ou=Are Sufficient To,ou=Test,dc=example,dc=org';
|
||||||
|
|
||||||
|
$lw->expects($this->any())
|
||||||
|
->method('isResource')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
|
$lw->expects($this->any())
|
||||||
|
->method('getAttributes')
|
||||||
|
->will($this->returnValue(array(
|
||||||
|
$attribute => array('count' => 1, $dnFromServer)
|
||||||
|
)));
|
||||||
|
|
||||||
|
$access = new Access($con, $lw, $um);
|
||||||
|
$values = $access->readAttribute('uid=whoever,dc=example,dc=org', $attribute);
|
||||||
|
$this->assertSame($values[0], strtolower($dnFromServer));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue