136 |
|
|
137 |
my @attrs; |
my @attrs; |
138 |
|
|
139 |
map { |
foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) { |
140 |
if ( $_->{type} eq 'hrEduPersonUniqueNumber' ) { |
if ( $attr->{type} =~ m/date/i ) { |
141 |
foreach my $val ( @{ $_->{vals} } ) { |
foreach my $i ( 0 .. $#{ $attr->{vals} } ) { |
142 |
|
$attr->{vals}->[$i] = "$1-$2-$3" if $attr->{vals}->[$i] =~ m/^([12]\d\d\d)([01]\d+)([0123]\d+)$/; |
143 |
|
} |
144 |
|
} elsif ( $attr->{type} eq 'hrEduPersonUniqueNumber' ) { |
145 |
|
foreach my $val ( @{ $attr->{vals} } ) { |
146 |
next if $val !~ m{.+:.+}; |
next if $val !~ m{.+:.+}; |
147 |
my ( $n, $v ) = split(/\s*:\s*/, $val ); |
my ( $n, $v ) = split(/\s*:\s*/, $val ); |
148 |
push @attrs, { type => $_->{type} . '_' . $n, vals => [ $v ] }; |
push @attrs, { type => $attr->{type} . '_' . $n, vals => [ $v ] }; |
149 |
|
} |
150 |
|
} elsif ( $attr->{type} eq 'hrEduPersonGroupMember' ) { |
151 |
|
foreach my $i ( 0 .. $#{ $attr->{vals} } ) { |
152 |
|
$attr->{vals}->[$i] =~ s/^u2010/p2010/gs && warn "FIXME group"; |
153 |
} |
} |
154 |
} |
} |
155 |
} @{ $response->{protocolOp}->{searchResEntry}->{attributes} }; |
} |
156 |
|
|
157 |
warn "# ++ attrs ",dump( @attrs ); |
warn "# ++ attrs ",dump( @attrs ); |
158 |
|
|
159 |
push @{ $response->{protocolOp}->{searchResEntry}->{attributes} }, $_ foreach @attrs; |
push @{ $response->{protocolOp}->{searchResEntry}->{attributes} }, $_ foreach @attrs; |
160 |
|
|
161 |
my $path = $config->{yaml_dir} . "$uid.yaml"; |
my @additional_yamls = ( $uid ); |
162 |
if ( -e $path ) { |
foreach my $attr ( @{ $response->{protocolOp}->{searchResEntry}->{attributes} } ) { |
163 |
my $data = LoadFile($path); |
foreach my $v ( @{ $attr->{vals} } ) { |
164 |
warn "# yaml = ",dump($data); |
push @additional_yamls, $attr->{type} . '/' . $v; |
165 |
|
} |
166 |
|
} |
167 |
|
|
168 |
|
#warn "# additional_yamls ",dump( @additional_yamls ); |
169 |
|
|
170 |
|
foreach my $path ( @additional_yamls ) { |
171 |
|
my $full_path = $config->{yaml_dir} . '/' . $path . '.yaml'; |
172 |
|
next unless -e $full_path; |
173 |
|
|
174 |
|
my $data = LoadFile( $full_path ); |
175 |
|
warn "# $full_path yaml = ",dump($data); |
176 |
|
|
177 |
foreach my $type ( keys %$data ) { |
foreach my $type ( keys %$data ) { |
178 |
|
|