From 4603dc16b3e3f0c0d7db04e879f373c17bb03ac3 Mon Sep 17 00:00:00 2001 From: Thijs Kinkhorst <thijs@kinkhorst.com> Date: Wed, 27 May 2015 12:07:26 +0000 Subject: [PATCH] Remove smartnameattribute module. It has been marked deprecated and generates warnings since 2013. The functionality is easily replaced by using the smartattributes module. --- modules/smartnameattribute/default-disable | 3 - .../lib/Auth/Process/SmartName.php | 78 ------------------- 2 files changed, 81 deletions(-) delete mode 100644 modules/smartnameattribute/default-disable delete mode 100644 modules/smartnameattribute/lib/Auth/Process/SmartName.php diff --git a/modules/smartnameattribute/default-disable b/modules/smartnameattribute/default-disable deleted file mode 100644 index fa0bd82e2..000000000 --- a/modules/smartnameattribute/default-disable +++ /dev/null @@ -1,3 +0,0 @@ -This file indicates that the default state of this module -is disabled. To enable, create a file named enable in the -same directory as this file. diff --git a/modules/smartnameattribute/lib/Auth/Process/SmartName.php b/modules/smartnameattribute/lib/Auth/Process/SmartName.php deleted file mode 100644 index 498715c39..000000000 --- a/modules/smartnameattribute/lib/Auth/Process/SmartName.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -/** - * Filter to set name in a smart way, based on available name attributes. - * - * @author Andreas Ă…kre Solberg, UNINETT AS. - * @package simpleSAMLphp - */ -class sspmod_smartnameattribute_Auth_Process_SmartName extends SimpleSAML_Auth_ProcessingFilter { - - /** - * Attributes which should be added/appended. - * - * Assiciative array of arrays. - */ - private $attributes = array(); - - - private function getFullName($attributes) { - if (isset($attributes['displayName'])) - return $attributes['displayName'][0]; - - if (isset($attributes['cn'])) { - if (count(explode(' ', $attributes['cn'][0])) > 1) - return $attributes['cn'][0]; - } - - if (isset($attributes['sn']) && isset($attributes['givenName'])) - return $attributes['givenName'][0] . ' ' . $attributes['sn'][0]; - - if (isset($attributes['cn'])) - return $attributes['cn'][0]; - - if (isset($attributes['sn'])) - return $attributes['sn'][0]; - - if (isset($attributes['givenName'])) - return $attributes['givenName'][0]; - - if (isset($attributes['eduPersonPrincipalName'])) { - $localname = $this->getLocalUser($attributes['eduPersonPrincipalName'][0]); - if (isset($localname)) return $localname; - } - - return NULL; - } - - private function getLocalUser($userid) { - if (strpos($userid, '@') === FALSE) return NULL; - $decomposed = explode('@', $userid); - if(count($decomposed) === 2) { - return $decomposed[0]; - } - return NULL; - } - - /** - * Apply filter to add or replace attributes. - * - * Add or replace existing attributes with the configured values. - * - * @param array &$request The current request - */ - public function process(&$request) { - assert('is_array($request)'); - assert('array_key_exists("Attributes", $request)'); - - SimpleSAML_Logger::warning('You are using the deprecated smartnameattribute:SmartName filter. You should replace it with smartattributes:SmartName instead.'); - - $attributes =& $request['Attributes']; - - $fullname = $this->getFullName($attributes); - - if(isset($fullname)) $request['Attributes']['smartname-fullname'] = array($fullname); - - } - -} -- GitLab