@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | 51 | private static $dependencies = [ |
| 52 | - 'gateway' => '%$' . LDAPGateway::class |
|
| 52 | + 'gateway' => '%$'.LDAPGateway::class |
|
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public static function get_cache() |
| 127 | 127 | { |
| 128 | - return Injector::inst()->get(CacheInterface::class . '.ldap'); |
|
| 128 | + return Injector::inst()->get(CacheInterface::class.'.ldap'); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | // show better errors than the defaults for various status codes returned by LDAP |
| 208 | 208 | if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_ACCOUNT_LOCKED_OUT') !== false) { |
| 209 | 209 | $message = _t( |
| 210 | - __CLASS__ . '.ACCOUNTLOCKEDOUT', |
|
| 211 | - 'Your account has been temporarily locked because of too many failed login attempts. ' . |
|
| 210 | + __CLASS__.'.ACCOUNTLOCKEDOUT', |
|
| 211 | + 'Your account has been temporarily locked because of too many failed login attempts. '. |
|
| 212 | 212 | 'Please try again later.' |
| 213 | 213 | ); |
| 214 | 214 | } |
| 215 | 215 | if (!empty($messages[1]) && strpos($messages[1], 'NT_STATUS_LOGON_FAILURE') !== false) { |
| 216 | 216 | $message = _t( |
| 217 | - __CLASS__ . '.INVALIDCREDENTIALS', |
|
| 217 | + __CLASS__.'.INVALIDCREDENTIALS', |
|
| 218 | 218 | 'The provided details don\'t seem to be correct. Please try again.' |
| 219 | 219 | ); |
| 220 | 220 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | public function getNodes($cached = true, $attributes = []) |
| 238 | 238 | { |
| 239 | 239 | $cache = self::get_cache(); |
| 240 | - $cacheKey = 'nodes' . md5(implode('', $attributes)); |
|
| 240 | + $cacheKey = 'nodes'.md5(implode('', $attributes)); |
|
| 241 | 241 | $results = $cache->has($cacheKey); |
| 242 | 242 | |
| 243 | 243 | if (!$results || !$cached) { |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | { |
| 268 | 268 | $searchLocations = $this->config()->groups_search_locations ?: [null]; |
| 269 | 269 | $cache = self::get_cache(); |
| 270 | - $cacheKey = 'groups' . md5(implode('', array_merge($searchLocations, $attributes))); |
|
| 270 | + $cacheKey = 'groups'.md5(implode('', array_merge($searchLocations, $attributes))); |
|
| 271 | 271 | $results = $cache->has($cacheKey); |
| 272 | 272 | |
| 273 | 273 | if (!$results || !$cached) { |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | $member->IsExpired = ($data['useraccountcontrol'] & 2) == 2; |
| 538 | - $member->LastSynced = (string)DBDatetime::now(); |
|
| 538 | + $member->LastSynced = (string) DBDatetime::now(); |
|
| 539 | 539 | |
| 540 | 540 | foreach ($member->config()->ldap_field_mappings as $attribute => $field) { |
| 541 | 541 | // Special handling required for attributes that don't exist in the response. |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | } else { |
| 557 | 557 | $this->getLogger()->debug( |
| 558 | 558 | sprintf( |
| 559 | - 'Attribute %s configured in Member.ldap_field_mappings, ' . |
|
| 559 | + 'Attribute %s configured in Member.ldap_field_mappings, '. |
|
| 560 | 560 | 'but no available attribute in AD data (GUID: %s, Member ID: %s)', |
| 561 | 561 | $attribute, |
| 562 | 562 | $data['objectguid'], |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | if ($imageClass !== Image::class && !is_subclass_of($imageClass, Image::class)) { |
| 642 | 642 | $this->getLogger()->warning( |
| 643 | 643 | sprintf( |
| 644 | - 'Member field %s configured for ' . $attributeName . ' AD attribute, but it isn\'t a valid relation to an ' |
|
| 644 | + 'Member field %s configured for '.$attributeName.' AD attribute, but it isn\'t a valid relation to an ' |
|
| 645 | 645 | . 'Image class', |
| 646 | 646 | $fieldName |
| 647 | 647 | ) |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | // Setup variables |
| 669 | 669 | $thumbnailFolder = Folder::find_or_make($member->config()->ldap_thumbnail_path); |
| 670 | - $filename = sprintf($attributeName . '-%s.jpg', $data['objectguid']); |
|
| 670 | + $filename = sprintf($attributeName.'-%s.jpg', $data['objectguid']); |
|
| 671 | 671 | $filePath = File::join_paths($thumbnailFolder->getFilename(), $filename); |
| 672 | 672 | $fileCfg = [ |
| 673 | 673 | // if there's a filename conflict we've got new content so overwrite it. |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | // Lookup the previous mappings and see if there is any mappings no longer present. |
| 763 | - $unmappedGroups = $member->Groups()->alterDataQuery(function (DataQuery $query) { |
|
| 763 | + $unmappedGroups = $member->Groups()->alterDataQuery(function(DataQuery $query) { |
|
| 764 | 764 | // join with the Group_Members table because we only want those group members assigned by this module. |
| 765 | 765 | $query->leftJoin("Group_Members", '"Group_Members"."GroupID" = "Group"."ID"'); |
| 766 | 766 | $query->where('"Group_Members"."IsImportedFromLDAP" = 1'); |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | $group->Description = $data['description']; |
| 802 | 802 | } |
| 803 | 803 | $group->DN = $data['dn']; |
| 804 | - $group->LastSynced = (string)DBDatetime::now(); |
|
| 804 | + $group->LastSynced = (string) DBDatetime::now(); |
|
| 805 | 805 | $group->write(); |
| 806 | 806 | |
| 807 | 807 | // Mappings on this group are automatically maintained to contain just the group's DN. |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | ), |
| 865 | 865 | ]); |
| 866 | 866 | } catch (Exception $e) { |
| 867 | - throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage()); |
|
| 867 | + throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage()); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | $user = $this->getUserByUsername($member->Username); |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | 'distinguishedname' => $dn |
| 909 | 909 | ]); |
| 910 | 910 | } catch (Exception $e) { |
| 911 | - throw new ValidationException('LDAP group creation failure: ' . $e->getMessage()); |
|
| 911 | + throw new ValidationException('LDAP group creation failure: '.$e->getMessage()); |
|
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | $data = $this->getGroupByDN($dn); |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | $dn = $newDn; |
| 965 | 965 | } |
| 966 | 966 | } catch (Exception $e) { |
| 967 | - throw new ValidationException('LDAP move failure: ' . $e->getMessage()); |
|
| 967 | + throw new ValidationException('LDAP move failure: '.$e->getMessage()); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | try { |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | |
| 989 | 989 | $this->update($dn, $attributes); |
| 990 | 990 | } catch (Exception $e) { |
| 991 | - throw new ValidationException('LDAP synchronisation failure: ' . $e->getMessage()); |
|
| 991 | + throw new ValidationException('LDAP synchronisation failure: '.$e->getMessage()); |
|
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | 994 | |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | try { |
| 1074 | 1074 | $this->update($groupDn, ['member' => $members]); |
| 1075 | 1075 | } catch (Exception $e) { |
| 1076 | - throw new ValidationException('LDAP group membership remove failure: ' . $e->getMessage()); |
|
| 1076 | + throw new ValidationException('LDAP group membership remove failure: '.$e->getMessage()); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | } |
| 1079 | 1079 | } |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | try { |
| 1100 | 1100 | $this->update($groupDn, ['member' => $members]); |
| 1101 | 1101 | } catch (Exception $e) { |
| 1102 | - throw new ValidationException('LDAP group membership add failure: ' . $e->getMessage()); |
|
| 1102 | + throw new ValidationException('LDAP group membership add failure: '.$e->getMessage()); |
|
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | 1105 | |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | try { |
| 1183 | 1183 | $this->delete($data['distinguishedname']); |
| 1184 | 1184 | } catch (Exception $e) { |
| 1185 | - throw new ValidationException('LDAP delete user failed: ' . $e->getMessage()); |
|
| 1185 | + throw new ValidationException('LDAP delete user failed: '.$e->getMessage()); |
|
| 1186 | 1186 | } |
| 1187 | 1187 | } |
| 1188 | 1188 | |