'/^(CH-[A-Z]{4}-[A-Z]{3}_National\.webmaster)$/', 'board' => '/^(CH-[A-Z]{4}-[A-Z]{3}_National\.(' . $national_roles . '))$/', 'basel' => '/^(CH-BASE-ESN_Local\.(' . $local_roles . '))$/', 'bern' => '/^(CH-BERN-ESN_Local\.(' . $local_roles . '))$/', 'chur' => '/^(CH-CHUR-HTW_Local\.(' . $local_roles . '))$/', 'fribourg' => '/^(CH-FRIB-ESN_Local\.(' . $local_roles . '))$/', 'geneva' => '/^(CH-GENE-UNI_Local\.(' . $local_roles . '))$/', 'epfl' => '/^(CH-LAUS-XEP_Local\.(' . $local_roles . '))$/', 'unil' => '/^(CH-LAUS-XUL_Local\.(' . $local_roles . '))$/', 'lugano' => '/^(CH-LUGA-ESN_Local\.(' . $local_roles . '))$/', 'neuchatel' => '/^(CH-NEUC-ESN_Local\.(' . $local_roles . '))$/', 'stgallen' => '/^(CH-SGAL-ESN_Local\.(' . $local_roles . '))$/', 'waedenswil' => '/^(CH-WAED-ESN_Local\.(' . $local_roles . '))$/', 'winterthur' => '/^(CH-WINT-ESN_Local\.(' . $local_roles . '))$/', 'zuerich' => '/^(CH-ZURI-[A-Z]{3}_Local\.(' . $local_roles . '))$/', 'alumni' => '/^(CH-[A-Z]{4}-[A-Z]{3}_(International|National|Local)\.(ALCoordinator|alumnus))$/', ); return $casGroups; } /* * The function plaincas_pattern_attributes has to return an array * with the CAS attributes which will be matched against the regular expressions * $attributes = phpCAS::getAttributes(); */ function plaincas_pattern_attributes( $attributes ){ $matchAttributes = array(); // in this example the attribute 'roles' is an array // and all of the elements will be prepended by the attribute 'sc' $roles = $attributes['roles']; $section = $attributes['sc']; if (!is_array($roles)) { $roles = array($roles); } foreach ($roles as $role) { $matchAttributes[] = $section . '_' . $role; } // finally the array is returned. return $matchAttributes; } /* * The function plaincas_user_attributes has to return an array * with keys 'name' and 'mail' representing the user. * $attributes = phpCAS::getAttributes(); */ function plaincas_user_attributes( $attributes ){ return array( 'name' => $attributes['first'] . ' ' . $attributes['last'], 'mail' => $attributes['mail'], ); } /* * The function plaincas_custom_groups has to return an array * with groupnames as keys and an array or usernames. * * Custom groups are independent of CAS attributes or groups but the group names can be the same. */ function plaincas_custom_groups(){ $customGroups = array( 'group1' => array('admin', 'userame2'), 'group2' => array('username3', 'userame4'), ); return $customGroups; }