Configuration.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Alexander Bergolth <leo@strike.wu.ac.at>
  6. * @author Alex Weirig <alex.weirig@technolink.lu>
  7. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  8. * @author blizzz <blizzz@arthur-schiwon.de>
  9. * @author Joas Schilling <coding@schilljs.com>
  10. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  11. * @author Lennart Rosam <hello@takuto.de>
  12. * @author Lukas Reschke <lukas@statuscode.ch>
  13. * @author Morris Jobke <hey@morrisjobke.de>
  14. * @author Robin McCorkell <robin@mccorkell.me.uk>
  15. * @author Roeland Jago Douma <roeland@famdouma.nl>
  16. * @author Roger Szabo <roger.szabo@web.de>
  17. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  18. * @author Xuanwo <xuanwo@yunify.com>
  19. *
  20. * @license AGPL-3.0
  21. *
  22. * This code is free software: you can redistribute it and/or modify
  23. * it under the terms of the GNU Affero General Public License, version 3,
  24. * as published by the Free Software Foundation.
  25. *
  26. * This program is distributed in the hope that it will be useful,
  27. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. * GNU Affero General Public License for more details.
  30. *
  31. * You should have received a copy of the GNU Affero General Public License, version 3,
  32. * along with this program. If not, see <http://www.gnu.org/licenses/>
  33. *
  34. */
  35. namespace OCA\User_LDAP;
  36. /**
  37. * @property int ldapPagingSize holds an integer
  38. * @property string ldapUserAvatarRule
  39. */
  40. class Configuration {
  41. const AVATAR_PREFIX_DEFAULT = 'default';
  42. const AVATAR_PREFIX_NONE = 'none';
  43. const AVATAR_PREFIX_DATA_ATTRIBUTE = 'data:';
  44. public const LDAP_SERVER_FEATURE_UNKNOWN = 'unknown';
  45. public const LDAP_SERVER_FEATURE_AVAILABLE = 'available';
  46. public const LDAP_SERVER_FEATURE_UNAVAILABLE = 'unavailable';
  47. protected $configPrefix = null;
  48. protected $configRead = false;
  49. /**
  50. * @var string[] pre-filled with one reference key so that at least one entry is written on save request and
  51. * the config ID is registered
  52. */
  53. protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive'];
  54. //settings
  55. protected $config = array(
  56. 'ldapHost' => null,
  57. 'ldapPort' => null,
  58. 'ldapBackupHost' => null,
  59. 'ldapBackupPort' => null,
  60. 'ldapBase' => null,
  61. 'ldapBaseUsers' => null,
  62. 'ldapBaseGroups' => null,
  63. 'ldapAgentName' => null,
  64. 'ldapAgentPassword' => null,
  65. 'ldapTLS' => null,
  66. 'turnOffCertCheck' => null,
  67. 'ldapIgnoreNamingRules' => null,
  68. 'ldapUserDisplayName' => null,
  69. 'ldapUserDisplayName2' => null,
  70. 'ldapUserAvatarRule' => null,
  71. 'ldapGidNumber' => null,
  72. 'ldapUserFilterObjectclass' => null,
  73. 'ldapUserFilterGroups' => null,
  74. 'ldapUserFilter' => null,
  75. 'ldapUserFilterMode' => null,
  76. 'ldapGroupFilter' => null,
  77. 'ldapGroupFilterMode' => null,
  78. 'ldapGroupFilterObjectclass' => null,
  79. 'ldapGroupFilterGroups' => null,
  80. 'ldapGroupDisplayName' => null,
  81. 'ldapGroupMemberAssocAttr' => null,
  82. 'ldapLoginFilter' => null,
  83. 'ldapLoginFilterMode' => null,
  84. 'ldapLoginFilterEmail' => null,
  85. 'ldapLoginFilterUsername' => null,
  86. 'ldapLoginFilterAttributes' => null,
  87. 'ldapQuotaAttribute' => null,
  88. 'ldapQuotaDefault' => null,
  89. 'ldapEmailAttribute' => null,
  90. 'ldapCacheTTL' => null,
  91. 'ldapUuidUserAttribute' => 'auto',
  92. 'ldapUuidGroupAttribute' => 'auto',
  93. 'ldapOverrideMainServer' => false,
  94. 'ldapConfigurationActive' => false,
  95. 'ldapAttributesForUserSearch' => null,
  96. 'ldapAttributesForGroupSearch' => null,
  97. 'ldapExperiencedAdmin' => false,
  98. 'homeFolderNamingRule' => null,
  99. 'hasMemberOfFilterSupport' => false,
  100. 'useMemberOfToDetectMembership' => true,
  101. 'ldapExpertUsernameAttr' => null,
  102. 'ldapExpertUUIDUserAttr' => null,
  103. 'ldapExpertUUIDGroupAttr' => null,
  104. 'lastJpegPhotoLookup' => null,
  105. 'ldapNestedGroups' => false,
  106. 'ldapPagingSize' => null,
  107. 'turnOnPasswordChange' => false,
  108. 'ldapDynamicGroupMemberURL' => null,
  109. 'ldapDefaultPPolicyDN' => null,
  110. 'ldapExtStorageHomeAttribute' => null,
  111. 'ldapMatchingRuleInChainState' => self::LDAP_SERVER_FEATURE_UNKNOWN,
  112. );
  113. /**
  114. * @param string $configPrefix
  115. * @param bool $autoRead
  116. */
  117. public function __construct($configPrefix, $autoRead = true) {
  118. $this->configPrefix = $configPrefix;
  119. if($autoRead) {
  120. $this->readConfiguration();
  121. }
  122. }
  123. /**
  124. * @param string $name
  125. * @return mixed|null
  126. */
  127. public function __get($name) {
  128. if(isset($this->config[$name])) {
  129. return $this->config[$name];
  130. }
  131. return null;
  132. }
  133. /**
  134. * @param string $name
  135. * @param mixed $value
  136. */
  137. public function __set($name, $value) {
  138. $this->setConfiguration(array($name => $value));
  139. }
  140. /**
  141. * @return array
  142. */
  143. public function getConfiguration() {
  144. return $this->config;
  145. }
  146. /**
  147. * set LDAP configuration with values delivered by an array, not read
  148. * from configuration. It does not save the configuration! To do so, you
  149. * must call saveConfiguration afterwards.
  150. * @param array $config array that holds the config parameters in an associated
  151. * array
  152. * @param array &$applied optional; array where the set fields will be given to
  153. * @return false|null
  154. */
  155. public function setConfiguration($config, &$applied = null) {
  156. if(!is_array($config)) {
  157. return false;
  158. }
  159. $cta = $this->getConfigTranslationArray();
  160. foreach($config as $inputKey => $val) {
  161. if(strpos($inputKey, '_') !== false && array_key_exists($inputKey, $cta)) {
  162. $key = $cta[$inputKey];
  163. } elseif(array_key_exists($inputKey, $this->config)) {
  164. $key = $inputKey;
  165. } else {
  166. continue;
  167. }
  168. $setMethod = 'setValue';
  169. switch($key) {
  170. case 'ldapAgentPassword':
  171. $setMethod = 'setRawValue';
  172. break;
  173. case 'homeFolderNamingRule':
  174. $trimmedVal = trim($val);
  175. if ($trimmedVal !== '' && strpos($val, 'attr:') === false) {
  176. $val = 'attr:'.$trimmedVal;
  177. }
  178. break;
  179. case 'ldapBase':
  180. case 'ldapBaseUsers':
  181. case 'ldapBaseGroups':
  182. case 'ldapAttributesForUserSearch':
  183. case 'ldapAttributesForGroupSearch':
  184. case 'ldapUserFilterObjectclass':
  185. case 'ldapUserFilterGroups':
  186. case 'ldapGroupFilterObjectclass':
  187. case 'ldapGroupFilterGroups':
  188. case 'ldapLoginFilterAttributes':
  189. $setMethod = 'setMultiLine';
  190. break;
  191. }
  192. $this->$setMethod($key, $val);
  193. if(is_array($applied)) {
  194. $applied[] = $inputKey;
  195. // storing key as index avoids duplication, and as value for simplicity
  196. }
  197. $this->unsavedChanges[$key] = $key;
  198. }
  199. return null;
  200. }
  201. public function readConfiguration() {
  202. if(!$this->configRead && !is_null($this->configPrefix)) {
  203. $cta = array_flip($this->getConfigTranslationArray());
  204. foreach($this->config as $key => $val) {
  205. if(!isset($cta[$key])) {
  206. //some are determined
  207. continue;
  208. }
  209. $dbKey = $cta[$key];
  210. switch($key) {
  211. case 'ldapBase':
  212. case 'ldapBaseUsers':
  213. case 'ldapBaseGroups':
  214. case 'ldapAttributesForUserSearch':
  215. case 'ldapAttributesForGroupSearch':
  216. case 'ldapUserFilterObjectclass':
  217. case 'ldapUserFilterGroups':
  218. case 'ldapGroupFilterObjectclass':
  219. case 'ldapGroupFilterGroups':
  220. case 'ldapLoginFilterAttributes':
  221. $readMethod = 'getMultiLine';
  222. break;
  223. case 'ldapIgnoreNamingRules':
  224. $readMethod = 'getSystemValue';
  225. $dbKey = $key;
  226. break;
  227. case 'ldapAgentPassword':
  228. $readMethod = 'getPwd';
  229. break;
  230. case 'ldapUserDisplayName2':
  231. case 'ldapGroupDisplayName':
  232. $readMethod = 'getLcValue';
  233. break;
  234. case 'ldapUserDisplayName':
  235. default:
  236. // user display name does not lower case because
  237. // we rely on an upper case N as indicator whether to
  238. // auto-detect it or not. FIXME
  239. $readMethod = 'getValue';
  240. break;
  241. }
  242. $this->config[$key] = $this->$readMethod($dbKey);
  243. }
  244. $this->configRead = true;
  245. }
  246. }
  247. /**
  248. * saves the current config changes in the database
  249. */
  250. public function saveConfiguration() {
  251. $cta = array_flip($this->getConfigTranslationArray());
  252. foreach($this->unsavedChanges as $key) {
  253. $value = $this->config[$key];
  254. switch ($key) {
  255. case 'ldapAgentPassword':
  256. $value = base64_encode($value);
  257. break;
  258. case 'ldapBase':
  259. case 'ldapBaseUsers':
  260. case 'ldapBaseGroups':
  261. case 'ldapAttributesForUserSearch':
  262. case 'ldapAttributesForGroupSearch':
  263. case 'ldapUserFilterObjectclass':
  264. case 'ldapUserFilterGroups':
  265. case 'ldapGroupFilterObjectclass':
  266. case 'ldapGroupFilterGroups':
  267. case 'ldapLoginFilterAttributes':
  268. if(is_array($value)) {
  269. $value = implode("\n", $value);
  270. }
  271. break;
  272. //following options are not stored but detected, skip them
  273. case 'ldapIgnoreNamingRules':
  274. case 'ldapUuidUserAttribute':
  275. case 'ldapUuidGroupAttribute':
  276. continue 2;
  277. }
  278. if(is_null($value)) {
  279. $value = '';
  280. }
  281. $this->saveValue($cta[$key], $value);
  282. }
  283. $this->saveValue('_lastChange', time());
  284. $this->unsavedChanges = [];
  285. }
  286. /**
  287. * @param string $varName
  288. * @return array|string
  289. */
  290. protected function getMultiLine($varName) {
  291. $value = $this->getValue($varName);
  292. if(empty($value)) {
  293. $value = '';
  294. } else {
  295. $value = preg_split('/\r\n|\r|\n/', $value);
  296. }
  297. return $value;
  298. }
  299. /**
  300. * Sets multi-line values as arrays
  301. *
  302. * @param string $varName name of config-key
  303. * @param array|string $value to set
  304. */
  305. protected function setMultiLine($varName, $value) {
  306. if(empty($value)) {
  307. $value = '';
  308. } else if (!is_array($value)) {
  309. $value = preg_split('/\r\n|\r|\n|;/', $value);
  310. if($value === false) {
  311. $value = '';
  312. }
  313. }
  314. if(!is_array($value)) {
  315. $finalValue = trim($value);
  316. } else {
  317. $finalValue = [];
  318. foreach($value as $key => $val) {
  319. if(is_string($val)) {
  320. $val = trim($val);
  321. if ($val !== '') {
  322. //accidental line breaks are not wanted and can cause
  323. // odd behaviour. Thus, away with them.
  324. $finalValue[] = $val;
  325. }
  326. } else {
  327. $finalValue[] = $val;
  328. }
  329. }
  330. }
  331. $this->setRawValue($varName, $finalValue);
  332. }
  333. /**
  334. * @param string $varName
  335. * @return string
  336. */
  337. protected function getPwd($varName) {
  338. return base64_decode($this->getValue($varName));
  339. }
  340. /**
  341. * @param string $varName
  342. * @return string
  343. */
  344. protected function getLcValue($varName) {
  345. return mb_strtolower($this->getValue($varName), 'UTF-8');
  346. }
  347. /**
  348. * @param string $varName
  349. * @return string
  350. */
  351. protected function getSystemValue($varName) {
  352. //FIXME: if another system value is added, softcode the default value
  353. return \OC::$server->getConfig()->getSystemValue($varName, false);
  354. }
  355. /**
  356. * @param string $varName
  357. * @return string
  358. */
  359. protected function getValue($varName) {
  360. static $defaults;
  361. if(is_null($defaults)) {
  362. $defaults = $this->getDefaults();
  363. }
  364. return \OC::$server->getConfig()->getAppValue('user_ldap',
  365. $this->configPrefix.$varName,
  366. $defaults[$varName]);
  367. }
  368. /**
  369. * Sets a scalar value.
  370. *
  371. * @param string $varName name of config key
  372. * @param mixed $value to set
  373. */
  374. protected function setValue($varName, $value) {
  375. if(is_string($value)) {
  376. $value = trim($value);
  377. }
  378. $this->config[$varName] = $value;
  379. }
  380. /**
  381. * Sets a scalar value without trimming.
  382. *
  383. * @param string $varName name of config key
  384. * @param mixed $value to set
  385. */
  386. protected function setRawValue($varName, $value) {
  387. $this->config[$varName] = $value;
  388. }
  389. /**
  390. * @param string $varName
  391. * @param string $value
  392. * @return bool
  393. */
  394. protected function saveValue($varName, $value) {
  395. \OC::$server->getConfig()->setAppValue(
  396. 'user_ldap',
  397. $this->configPrefix.$varName,
  398. $value
  399. );
  400. return true;
  401. }
  402. /**
  403. * @return array an associative array with the default values. Keys are correspond
  404. * to config-value entries in the database table
  405. */
  406. public function getDefaults() {
  407. return array(
  408. 'ldap_host' => '',
  409. 'ldap_port' => '',
  410. 'ldap_backup_host' => '',
  411. 'ldap_backup_port' => '',
  412. 'ldap_override_main_server' => '',
  413. 'ldap_dn' => '',
  414. 'ldap_agent_password' => '',
  415. 'ldap_base' => '',
  416. 'ldap_base_users' => '',
  417. 'ldap_base_groups' => '',
  418. 'ldap_userlist_filter' => '',
  419. 'ldap_user_filter_mode' => 0,
  420. 'ldap_userfilter_objectclass' => '',
  421. 'ldap_userfilter_groups' => '',
  422. 'ldap_login_filter' => '',
  423. 'ldap_login_filter_mode' => 0,
  424. 'ldap_loginfilter_email' => 0,
  425. 'ldap_loginfilter_username' => 1,
  426. 'ldap_loginfilter_attributes' => '',
  427. 'ldap_group_filter' => '',
  428. 'ldap_group_filter_mode' => 0,
  429. 'ldap_groupfilter_objectclass' => '',
  430. 'ldap_groupfilter_groups' => '',
  431. 'ldap_gid_number' => 'gidNumber',
  432. 'ldap_display_name' => 'displayName',
  433. 'ldap_user_display_name_2' => '',
  434. 'ldap_group_display_name' => 'cn',
  435. 'ldap_tls' => 0,
  436. 'ldap_quota_def' => '',
  437. 'ldap_quota_attr' => '',
  438. 'ldap_email_attr' => '',
  439. 'ldap_group_member_assoc_attribute' => '',
  440. 'ldap_cache_ttl' => 600,
  441. 'ldap_uuid_user_attribute' => 'auto',
  442. 'ldap_uuid_group_attribute' => 'auto',
  443. 'home_folder_naming_rule' => '',
  444. 'ldap_turn_off_cert_check' => 0,
  445. 'ldap_configuration_active' => 0,
  446. 'ldap_attributes_for_user_search' => '',
  447. 'ldap_attributes_for_group_search' => '',
  448. 'ldap_expert_username_attr' => '',
  449. 'ldap_expert_uuid_user_attr' => '',
  450. 'ldap_expert_uuid_group_attr' => '',
  451. 'has_memberof_filter_support' => 0,
  452. 'use_memberof_to_detect_membership' => 1,
  453. 'last_jpegPhoto_lookup' => 0,
  454. 'ldap_nested_groups' => 0,
  455. 'ldap_paging_size' => 500,
  456. 'ldap_turn_on_pwd_change' => 0,
  457. 'ldap_experienced_admin' => 0,
  458. 'ldap_dynamic_group_member_url' => '',
  459. 'ldap_default_ppolicy_dn' => '',
  460. 'ldap_user_avatar_rule' => 'default',
  461. 'ldap_ext_storage_home_attribute' => '',
  462. 'ldap_matching_rule_in_chain_state' => self::LDAP_SERVER_FEATURE_UNKNOWN,
  463. );
  464. }
  465. /**
  466. * @return array that maps internal variable names to database fields
  467. */
  468. public function getConfigTranslationArray() {
  469. //TODO: merge them into one representation
  470. static $array = array(
  471. 'ldap_host' => 'ldapHost',
  472. 'ldap_port' => 'ldapPort',
  473. 'ldap_backup_host' => 'ldapBackupHost',
  474. 'ldap_backup_port' => 'ldapBackupPort',
  475. 'ldap_override_main_server' => 'ldapOverrideMainServer',
  476. 'ldap_dn' => 'ldapAgentName',
  477. 'ldap_agent_password' => 'ldapAgentPassword',
  478. 'ldap_base' => 'ldapBase',
  479. 'ldap_base_users' => 'ldapBaseUsers',
  480. 'ldap_base_groups' => 'ldapBaseGroups',
  481. 'ldap_userfilter_objectclass' => 'ldapUserFilterObjectclass',
  482. 'ldap_userfilter_groups' => 'ldapUserFilterGroups',
  483. 'ldap_userlist_filter' => 'ldapUserFilter',
  484. 'ldap_user_filter_mode' => 'ldapUserFilterMode',
  485. 'ldap_user_avatar_rule' => 'ldapUserAvatarRule',
  486. 'ldap_login_filter' => 'ldapLoginFilter',
  487. 'ldap_login_filter_mode' => 'ldapLoginFilterMode',
  488. 'ldap_loginfilter_email' => 'ldapLoginFilterEmail',
  489. 'ldap_loginfilter_username' => 'ldapLoginFilterUsername',
  490. 'ldap_loginfilter_attributes' => 'ldapLoginFilterAttributes',
  491. 'ldap_group_filter' => 'ldapGroupFilter',
  492. 'ldap_group_filter_mode' => 'ldapGroupFilterMode',
  493. 'ldap_groupfilter_objectclass' => 'ldapGroupFilterObjectclass',
  494. 'ldap_groupfilter_groups' => 'ldapGroupFilterGroups',
  495. 'ldap_gid_number' => 'ldapGidNumber',
  496. 'ldap_display_name' => 'ldapUserDisplayName',
  497. 'ldap_user_display_name_2' => 'ldapUserDisplayName2',
  498. 'ldap_group_display_name' => 'ldapGroupDisplayName',
  499. 'ldap_tls' => 'ldapTLS',
  500. 'ldap_quota_def' => 'ldapQuotaDefault',
  501. 'ldap_quota_attr' => 'ldapQuotaAttribute',
  502. 'ldap_email_attr' => 'ldapEmailAttribute',
  503. 'ldap_group_member_assoc_attribute' => 'ldapGroupMemberAssocAttr',
  504. 'ldap_cache_ttl' => 'ldapCacheTTL',
  505. 'home_folder_naming_rule' => 'homeFolderNamingRule',
  506. 'ldap_turn_off_cert_check' => 'turnOffCertCheck',
  507. 'ldap_configuration_active' => 'ldapConfigurationActive',
  508. 'ldap_attributes_for_user_search' => 'ldapAttributesForUserSearch',
  509. 'ldap_attributes_for_group_search' => 'ldapAttributesForGroupSearch',
  510. 'ldap_expert_username_attr' => 'ldapExpertUsernameAttr',
  511. 'ldap_expert_uuid_user_attr' => 'ldapExpertUUIDUserAttr',
  512. 'ldap_expert_uuid_group_attr' => 'ldapExpertUUIDGroupAttr',
  513. 'has_memberof_filter_support' => 'hasMemberOfFilterSupport',
  514. 'use_memberof_to_detect_membership' => 'useMemberOfToDetectMembership',
  515. 'last_jpegPhoto_lookup' => 'lastJpegPhotoLookup',
  516. 'ldap_nested_groups' => 'ldapNestedGroups',
  517. 'ldap_paging_size' => 'ldapPagingSize',
  518. 'ldap_turn_on_pwd_change' => 'turnOnPasswordChange',
  519. 'ldap_experienced_admin' => 'ldapExperiencedAdmin',
  520. 'ldap_dynamic_group_member_url' => 'ldapDynamicGroupMemberURL',
  521. 'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN',
  522. 'ldap_ext_storage_home_attribute' => 'ldapExtStorageHomeAttribute',
  523. 'ldap_matching_rule_in_chain_state' => 'ldapMatchingRuleInChainState',
  524. 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig
  525. );
  526. return $array;
  527. }
  528. /**
  529. * @param string $rule
  530. * @return array
  531. * @throws \RuntimeException
  532. */
  533. public function resolveRule($rule) {
  534. if($rule === 'avatar') {
  535. return $this->getAvatarAttributes();
  536. }
  537. throw new \RuntimeException('Invalid rule');
  538. }
  539. public function getAvatarAttributes() {
  540. $value = $this->ldapUserAvatarRule ?: self::AVATAR_PREFIX_DEFAULT;
  541. $defaultAttributes = ['jpegphoto', 'thumbnailphoto'];
  542. if($value === self::AVATAR_PREFIX_NONE) {
  543. return [];
  544. }
  545. if(strpos($value, self::AVATAR_PREFIX_DATA_ATTRIBUTE) === 0) {
  546. $attribute = trim(substr($value, strlen(self::AVATAR_PREFIX_DATA_ATTRIBUTE)));
  547. if($attribute === '') {
  548. return $defaultAttributes;
  549. }
  550. return [strtolower($attribute)];
  551. }
  552. if($value !== self::AVATAR_PREFIX_DEFAULT) {
  553. \OC::$server->getLogger()->warning('Invalid config value to ldapUserAvatarRule; falling back to default.');
  554. }
  555. return $defaultAttributes;
  556. }
  557. }