17 |
column hrEduPersonUniqueID => |
column hrEduPersonUniqueID => |
18 |
label is ('hrEduPersonUniqueID'), |
label is ('hrEduPersonUniqueID'), |
19 |
is indexed, |
is indexed, |
20 |
is mandatory, |
is distinct, |
|
is distinct; |
|
|
|
|
|
column name => |
|
|
type is 'text', |
|
|
label is _('Ime'), |
|
21 |
is mandatory; |
is mandatory; |
22 |
|
|
23 |
column cn => |
column cn => |
24 |
label is _('Ime'), |
label is _('Ime i prezime'), |
25 |
type is 'virtual'; |
is mandatory; |
26 |
|
|
27 |
column sn => |
column sn => |
|
type is 'virtual', |
|
28 |
label is _('Prezime'), |
label is _('Prezime'), |
29 |
is mandatory; |
is mandatory; |
30 |
|
|
31 |
column givenName => |
column givenName => |
|
type is 'virtual', |
|
32 |
label is _('Ime'), |
label is _('Ime'), |
33 |
is mandatory; |
is mandatory; |
34 |
|
|
35 |
column mail => |
column mail => |
|
type is 'virtual'; |
|
|
|
|
|
column email => |
|
36 |
type is 'text', |
type is 'text', |
37 |
is mandatory, |
is mandatory, |
38 |
label is _('Email address'), default is '', is immutable, is distinct; |
label is _('Email address'), default is '', |
39 |
|
is immutable, |
40 |
column email_confirmed => |
is distinct; |
|
label is _('Email address confirmed?'), |
|
|
type is 'boolean'; |
|
41 |
|
|
42 |
column password => |
column password => |
43 |
is unreadable, |
is unreadable, |
64 |
|
|
65 |
column hrEduPersonUniqueNumber => |
column hrEduPersonUniqueNumber => |
66 |
# is mandatory, |
# is mandatory, |
67 |
label is _('JMBG'); |
label is _('Unique number'); |
68 |
|
|
69 |
column hrEduPersonDateOfBirth => |
column hrEduPersonDateOfBirth => |
70 |
type is 'date', |
type is 'date', |
88 |
label is _('Tip administratora'), |
label is _('Tip administratora'), |
89 |
valid are [ '', 'AS', 'AI', 'AR', 'AHU' ]; |
valid are [ '', 'AS', 'AI', 'AR', 'AHU' ]; |
90 |
|
|
91 |
|
column hrEduPersonHomeOrg => |
92 |
|
label is _('Oznaka matične ustanove'), |
93 |
|
hint is 'CARNet', |
94 |
|
is mandatory; |
95 |
|
|
96 |
column hrEduPersonProfessionalStatus => |
column hrEduPersonProfessionalStatus => |
97 |
label is _('Stručni status'), |
label is _('Stručni status'), |
98 |
valid are [ |
valid are [ |
153 |
], |
], |
154 |
default is ''; |
default is ''; |
155 |
|
|
156 |
|
# column organization => |
157 |
|
# refers_to A3C::Model::Organization by 'id', |
158 |
|
# is mandatory; |
159 |
|
|
160 |
column hrEduPersonAffiliation => |
column hrEduPersonAffiliation => |
161 |
label is _('Povezanost s ustanovom'), |
label is _('Povezanost s ustanovom'), |
162 |
is mandatory, |
is mandatory, |
260 |
label is 'Pripadnost grupi', |
label is 'Pripadnost grupi', |
261 |
hint is 'skolskagodina::razred'; |
hint is 'skolskagodina::razred'; |
262 |
|
|
|
column o => |
|
|
label is _('Naziv matične ustanove'), |
|
|
is mandatory; |
|
|
|
|
|
column hrEduPersonHomeOrg => |
|
|
label is _('Oznaka matične ustanove'), |
|
|
hint is 'CARNet', |
|
|
is mandatory; |
|
|
|
|
263 |
column ou => |
column ou => |
264 |
label is _('Organizacijska jedinica'); |
label is _('Organizacijska jedinica'); |
265 |
|
|
266 |
column roomNumber => |
column roomNumber => |
267 |
label is _('Broj sobe'); |
label is _('Broj sobe'); |
268 |
|
|
|
column postalAddress => |
|
|
label is _('Poštanska adresa'), |
|
|
render as 'textarea', |
|
|
is mandatory; |
|
|
|
|
|
column l => |
|
|
label is _('Mjesto'), |
|
|
hist is 'Zagreb', |
|
|
is mandatory; |
|
|
|
|
|
column postalCode => |
|
|
label is _('Poštanski broj'), |
|
|
hint is 'HR-10000'; |
|
|
|
|
|
column street => |
|
|
label is _('Ulica i kućni broj'); |
|
|
|
|
269 |
column homePostalAddress => |
column homePostalAddress => |
270 |
label is _('Kućna poštanska adresa'), |
label is _('Kućna poštanska adresa'), |
271 |
render as 'textarea'; |
render as 'textarea'; |
279 |
column hrEduPersonPrivacy => |
column hrEduPersonPrivacy => |
280 |
label is _('Oznaka privatnosti'); |
label is _('Oznaka privatnosti'); |
281 |
|
|
282 |
|
column loginShell => |
283 |
|
label is _('shell'); |
284 |
|
|
285 |
|
column uidNumber => |
286 |
|
label is _('uid'), |
287 |
|
type is 'int'; |
288 |
|
|
289 |
|
column gidNumber => |
290 |
|
label is _('gid'); |
291 |
|
type is 'int'; |
292 |
|
|
293 |
|
column homeDirectory => |
294 |
|
label is _('home'); |
295 |
|
|
296 |
}; |
}; |
297 |
|
|
298 |
use Jifty::Plugin::User::Mixin::Model::User; |
# we don't use following mixing because it wants to send notificaitons on e-mail address change |
299 |
|
#use Jifty::Plugin::User::Mixin::Model::User; |
300 |
use Jifty::Plugin::Authentication::Password::Mixin::Model::User; |
use Jifty::Plugin::Authentication::Password::Mixin::Model::User; |
301 |
#use Jifty::Plugin::OpenID::Mixin::Model::User; |
#use Jifty::Plugin::OpenID::Mixin::Model::User; |
302 |
use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
303 |
|
|
304 |
# Your model-specific methods go here. |
# Your model-specific methods go here. |
305 |
|
|
306 |
=head2 set_mail |
=head2 before_create |
307 |
|
|
308 |
Put mail from ldap into email row |
Implement virtual columns, for now put mail from ldap into email row |
309 |
|
|
310 |
=cut |
=cut |
311 |
|
|
312 |
sub set_mail { |
=for later |
313 |
my ($self,$v) = @_; |
|
314 |
$self->set_email( $v ); |
sub before_create { |
315 |
|
my ($self, $attr) = @_; |
316 |
|
if ( ! $attr->{'email'} ) { |
317 |
|
warn "push mail to email"; |
318 |
|
$attr->{'email'} = $attr->{'mail'}; |
319 |
|
} |
320 |
} |
} |
321 |
|
|
322 |
|
=cut |
323 |
|
|
324 |
|
=head2 email |
325 |
|
|
326 |
|
Accessor for compatibility with Jifty mixins |
327 |
|
|
328 |
|
=cut |
329 |
|
|
330 |
|
sub email { |
331 |
|
my $self = shift; |
332 |
|
return $self->__value('mail'); |
333 |
|
} |
334 |
|
|
335 |
|
sub email_confirmed { 1 }; |
336 |
|
|
337 |
=head2 validate_telephoneNumber |
=head2 validate_telephoneNumber |
338 |
|
|
339 |
=cut |
=cut |
346 |
return ( 1, 'OK' ); |
return ( 1, 'OK' ); |
347 |
} |
} |
348 |
|
|
349 |
|
=head2 hrEduPersonUniqueNumber |
350 |
|
|
351 |
|
Check if JMBG is valid |
352 |
|
|
353 |
|
=cut |
354 |
|
|
355 |
|
sub validate_hrEduPersonUniqueNumber { |
356 |
|
my ( $self, $value ) = @_; |
357 |
|
|
358 |
|
if ( $value =~ m/^JMBG:\s+(\d+)$/ ) { |
359 |
|
|
360 |
|
my $jmbg = $1; |
361 |
|
|
362 |
|
return ( 0, _('JMBG must have 13 digits') ) unless length($jmbg) == 13; |
363 |
|
|
364 |
|
sub digit_at { |
365 |
|
my ($jmbg,$pos) = @_; |
366 |
|
return ord(substr($jmbg,$pos,1)) - ord('0'); |
367 |
|
} |
368 |
|
|
369 |
|
my $sum; |
370 |
|
my $fact = 7; |
371 |
|
|
372 |
|
foreach my $i ( 0 .. 11 ) { |
373 |
|
my $c = digit_at( $jmbg, $i ); |
374 |
|
$sum += $c * $fact; |
375 |
|
# warn "## $c * $fact => $sum\n"; |
376 |
|
$fact--; |
377 |
|
$fact = 7 if $fact == 1; |
378 |
|
} |
379 |
|
|
380 |
|
my $ost = $sum % 11; |
381 |
|
$ost = 11 - $ost if $ost > 1; |
382 |
|
|
383 |
|
return ( 0, _("JMBG is invalid") ) if $ost != digit_at( $jmbg, 12 ); |
384 |
|
} |
385 |
|
|
386 |
|
return ( 1, 'OK' ); |
387 |
|
} |
388 |
|
|
389 |
=head2 canonicalize_hrEduPersonExpireDate |
=head2 canonicalize_hrEduPersonExpireDate |
390 |
|
|
391 |
Support NONE as 2042-12-30 |
Support NONE as 2042-12-30 |
395 |
sub canonicalize_hrEduPersonExpireDate { |
sub canonicalize_hrEduPersonExpireDate { |
396 |
my ( $self, $value ) = @_; |
my ( $self, $value ) = @_; |
397 |
|
|
398 |
if ( $value eq 'NONE' ) { |
if ( lc($value) eq 'none' ) { |
399 |
$self->log->warn("fixed hrEduPersonExpireDate"); |
$self->log->warn("fixed hrEduPersonExpireDate"); |
400 |
$value = '2042-12-30'; |
$value = '2042-12-30'; |
401 |
} |
} |