1<?php 2/* 3 * The function plaincas_group_patterns has to return an array 4 * with the groups as keys and the corresponding regular expressions as values. 5 * Other groups can be assigned with the custom groups. 6 */ 7function plaincas_group_patterns() { 8 $groups = array( 9 'group1' => '/^(some-attribute)$/', 10 11 ); 12 13 return $groups; 14} 15 16/* 17 * The function plaincas_pattern_attributes has to return an array 18 * with the CAS attributes which will be matched against the regular expressions 19 * $attributes = phpCAS::getAttributes(); 20 */ 21function plaincas_pattern_attributes( $attributes ){ 22 if (is_array($attributes['roles'])) { 23 return $attributes['roles']; 24 } 25 else { 26 return array($attributes['roles']); 27 } 28} 29 30/* 31 * The function plaincas_user_attributes has to return an array 32 * with keys 'name' and 'mail' representing the user. 33 * $attributes = phpCAS::getAttributes(); 34 */ 35function plaincas_user_attributes( $attributes ){ 36 return array( 37 'name' => $attributes['first'] . ' ' . $attributes['last'], 38 'mail' => $attributes['mail'], 39 ); 40} 41 42/* 43 * The function plaincas_custom_groups has to return an array 44 * with groupnames as keys and an array or usernames. 45 * 46 * Custom groups are independent of CAS attributes or groups but the group names can be the same. 47 */ 48function plaincas_custom_groups(){ 49 50 $groups = array( 51 'group1' => array('username1', 'userame2'), 52 'group2' => array('username3', 'userame4'), 53 ); 54 55 return $groups; 56} 57 58 59