fix attribute casing to ensure array keys work
This commit is contained in:
parent
e1d61284f8
commit
f96e552164
|
@ -691,8 +691,9 @@ class Access extends LDAPUtility implements user\IUserTools {
|
|||
* @param array $ldapRecords
|
||||
*/
|
||||
public function batchApplyUserAttributes(array $ldapRecords){
|
||||
$displayNameAttribute = strtolower($this->connection->ldapUserDisplayName);
|
||||
foreach($ldapRecords as $userRecord) {
|
||||
$ocName = $this->dn2ocname($userRecord['dn'][0], $userRecord[$this->connection->ldapUserDisplayName]);
|
||||
$ocName = $this->dn2ocname($userRecord['dn'][0], $userRecord[$displayNameAttribute]);
|
||||
$this->cacheUserExists($ocName);
|
||||
$user = $this->userManager->get($ocName);
|
||||
$user->processAttributes($userRecord);
|
||||
|
|
|
@ -230,24 +230,34 @@ class Test_Access extends \Test\TestCase {
|
|||
$mapperMock = $this->getMockBuilder('\OCA\User_LDAP\Mapping\UserMapping')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mapperMock->expects($this->any())
|
||||
->method('getNameByDN')
|
||||
->will($this->returnValue('a_username'));
|
||||
|
||||
$userMock = $this->getMockBuilder('\OCA\user_ldap\lib\user\User')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$access->connection->expects($this->any())
|
||||
->method('__get')
|
||||
->will($this->returnValue('displayName'));
|
||||
|
||||
$access->setUserMapper($mapperMock);
|
||||
|
||||
$displayNameAttribute = strtolower($access->connection->ldapUserDisplayName);
|
||||
$data = array(
|
||||
array(
|
||||
'dn' => 'foobar',
|
||||
$con->ldapUserDisplayName => 'barfoo'
|
||||
$displayNameAttribute => 'barfoo'
|
||||
),
|
||||
array(
|
||||
'dn' => 'foo',
|
||||
$con->ldapUserDisplayName => 'bar'
|
||||
$displayNameAttribute => 'bar'
|
||||
),
|
||||
array(
|
||||
'dn' => 'raboof',
|
||||
$con->ldapUserDisplayName => 'oofrab'
|
||||
$displayNameAttribute => 'oofrab'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue