From 6da737879ba91ba2ddf44938e7f566a45432b781 Mon Sep 17 00:00:00 2001 From: Sabina Talipova Date: Wed, 11 Oct 2023 16:37:54 +1300 Subject: [PATCH] MNT Remove TODO comments --- src/Iterators/LDAPIterator.php | 5 +---- src/Model/LDAPGateway.php | 3 --- src/Services/LDAPService.php | 7 +------ 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Iterators/LDAPIterator.php b/src/Iterators/LDAPIterator.php index dc3c534..f9a8ea8 100644 --- a/src/Iterators/LDAPIterator.php +++ b/src/Iterators/LDAPIterator.php @@ -121,10 +121,7 @@ private function fetchPagedResult(): bool $resultResource = ldap_search($resource, $baseDn ?? '', $this->getFilter() ?? ''); } if (! is_resource($resultResource)) { - /* - * @TODO better exception msg - */ - throw new \Exception('ldap_search returned something wrong...' . ldap_error($resource)); + throw new \Exception('ldap_search returned a non-resource type value' . ldap_error($resource)); } $entries = ldap_get_entries($resource, $resultResource); diff --git a/src/Model/LDAPGateway.php b/src/Model/LDAPGateway.php index d9e78df..e4f42e9 100644 --- a/src/Model/LDAPGateway.php +++ b/src/Model/LDAPGateway.php @@ -364,7 +364,6 @@ public function getUserByUsername($username, $baseDn = null, $scope = Ldap::SEAR $filter = sprintf('(&(objectClass=user)(samaccountname=%s))', AbstractFilter::escapeValue($username)); break; case Ldap::ACCTNAME_FORM_BACKSLASH: // backslash style usernames, e.g. FOO\alice - // @todo Not supported yet! throw new Exception('Backslash style not supported in LDAPGateway::getUserByUsername()!'); break; case Ldap::ACCTNAME_FORM_PRINCIPAL: // principal style usernames, e.g. alice@foo.com @@ -374,7 +373,6 @@ public function getUserByUsername($username, $baseDn = null, $scope = Ldap::SEAR ); break; case Ldap::ACCTNAME_FORM_DN: // distinguished name, e.g. CN=someone,DC=example,DC=co,DC=nz - // @todo Not supported yet! throw new Exception('DN style not supported in LDAPGateway::getUserByUsername()!'); break; default: // default to principal style @@ -406,7 +404,6 @@ public function getCanonicalUsername($data) } return $data['samaccountname']; case Ldap::ACCTNAME_FORM_BACKSLASH: // backslash style usernames, e.g. FOO\alice - // @todo Not supported yet! throw new Exception('Backslash style not supported in LDAPGateway::getUsernameByEmail()!'); case Ldap::ACCTNAME_FORM_PRINCIPAL: // principal style usernames, e.g. alice@foo.com if (empty($data['userprincipalname'])) { diff --git a/src/Services/LDAPService.php b/src/Services/LDAPService.php index 3a91a64..211f887 100644 --- a/src/Services/LDAPService.php +++ b/src/Services/LDAPService.php @@ -974,9 +974,7 @@ public function updateLDAPFromMember(Member $member) ]; foreach ($member->config()->ldap_field_mappings as $attribute => $field) { $relationClass = $member->getRelationClass($field); - if ($relationClass) { - // todo no support for writing back relations yet. - } else { + if (!$relationClass) { $attributes[$attribute] = $member->$field; } } @@ -1102,9 +1100,6 @@ public function addLDAPUserToGroup($userDn, $groupDn) * Change a members password on the AD. Works with ActiveDirectory compatible services that saves the * password in the `unicodePwd` attribute. * - * @todo Use the Laminas\Ldap\Attribute::setPassword functionality to create a password in - * an abstract way, so it works on other LDAP directories, not just Active Directory. - * * Ensure that the LDAP bind:ed user can change passwords and that the connection is secure. * * @param Member $member