forked from silverstripe/silverstripe-ldap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request silverstripe#3 from caffeineinc/bugfix/fix-remove-…
…group-mappings Fix group mappings for removed Groups
- Loading branch information
Showing
7 changed files
with
371 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,6 +248,7 @@ public function onAfterDelete() | |
} | ||
|
||
$service->deleteLDAPMember($this->owner); | ||
|
||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ class LDAPFakeGateway extends LDAPGateway implements TestOnly | |
{ | ||
public function __construct() | ||
{ | ||
// do nothing | ||
// thumbnail images are raw JPEG/JFIF files, but that's not important | ||
// for this test, as long as the binary content are the same | ||
self::$data['users']['456']['thumbnailphoto'] = base64_decode(self::$data['users']['456']['thumbnailphoto']); | ||
} | ||
|
||
private static $data = [ | ||
|
@@ -42,6 +44,42 @@ public function __construct() | |
'canonicalName'=>'mockCanonicalName', | ||
'userprincipalname' => '[email protected]', | ||
'samaccountname' => 'joe' | ||
], | ||
'456' => [ | ||
'distinguishedname' => 'CN=Appleseed,DC=playpen,DC=local', | ||
'objectguid' => '456', | ||
'cn' => 'jappleseed', | ||
'useraccountcontrol' => '1', | ||
'givenname' => 'Johnny', | ||
'sn' => 'Appleseed', | ||
'mail' => '[email protected]', | ||
'password' => 'mockPassword1', | ||
'canonicalName' => 'mockCanonicalName2', | ||
'userprincipalname' => '[email protected]', | ||
'samaccountname' => 'john', | ||
'thumbnailphoto' => 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==', | ||
'displayname' => 'Johnny Appleseed' | ||
], | ||
'789' => [ | ||
'distinguishedname' => 'CN=Appleseed,DC=playpen,DC=local', | ||
'objectguid' => '456', | ||
'cn' => 'jappleseed', | ||
'useraccountcontrol' => '1', | ||
'givenname' => 'Johnny', | ||
'sn' => 'Appleseed', | ||
'mail' => '[email protected]', | ||
'password' => 'mockPassword1', | ||
'canonicalName' => 'mockCanonicalName2', | ||
'userprincipalname' => '[email protected]', | ||
'samaccountname' => 'john', | ||
'thumbnailphoto' => 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==', | ||
'displayname' => 'Johnny Appleseed', | ||
'memberof' => [ | ||
'CN=Group1,CN=Users,DC=playpen,DC=local', | ||
'CN=Group2,CN=Users,DC=playpen,DC=local', | ||
'CN=Group3,CN=Users,DC=playpen,DC=local', | ||
'CN=Group4,CN=Users,DC=playpen,DC=local', | ||
] | ||
] | ||
] | ||
]; | ||
|
@@ -77,8 +115,19 @@ public function getGroups($baseDn = null, $scope = Ldap::SEARCH_SCOPE_SUB, $attr | |
} | ||
} | ||
|
||
/** | ||
* Return nested groups for a DN. Not currently implemented. | ||
* | ||
* @param string $dn | ||
* @param null $baseDn | ||
* @param int $scope | ||
* @param array $attributes | ||
* | ||
* @return array | ||
*/ | ||
public function getNestedGroups($dn, $baseDn = null, $scope = Ldap::SEARCH_SCOPE_SUB, $attributes = []) | ||
{ | ||
return []; | ||
} | ||
|
||
public function getGroupByGUID($guid, $baseDn = null, $scope = Ldap::SEARCH_SCOPE_SUB, $attributes = []) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace SilverStripe\LDAP\Tests\Model; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
use SilverStripe\Security\Member; | ||
use SilverStripe\Assets\Image; | ||
|
||
class LDAPFakeMember extends Member implements TestOnly | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private static $has_one = [ | ||
'ProfileImage' => Image::class | ||
]; | ||
|
||
/** | ||
* We don't actually want/need to change anything | ||
* | ||
* @return int|void | ||
*/ | ||
public function write(){ | ||
// Noop | ||
} | ||
} |
Oops, something went wrong.