/[A3C]/lib/A3C/Model/User.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/A3C/Model/User.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 14 by dpavlin, Thu Mar 13 16:38:33 2008 UTC revision 21 by dpavlin, Thu Mar 13 19:51:45 2008 UTC
# Line 8  use utf8; Line 8  use utf8;
8    
9  use A3C::Record schema {  use A3C::Record schema {
10    
11          column name =>          column uid =>
12                  type is 'text',                  label is ('uid'),
13                  label is _('Ime'),                  is indexed,
14                    is mandatory,
15                    is distinct;
16    
17            column hrEduPersonUniqueID =>
18                    label is ('hrEduPersonUniqueID'),
19                    is indexed,
20                    is distinct,
21                  is mandatory;                  is mandatory;
22    
23          column cn =>          column cn =>
24                  label is _('Ime'),                  label is _('Ime i prezime'),
25                  type is 'virtual';                  type is 'virtual';
26    
27          column sn =>          column sn =>
# Line 27  use A3C::Record schema { Line 34  use A3C::Record schema {
34                  label is _('Ime'),                  label is _('Ime'),
35                  is mandatory;                  is mandatory;
36    
37          column email =>          column mail =>
38                  type is 'text',                  type is 'text',
39                  is mandatory,                  is mandatory,
40                  label is _('Email address'), default is '', is immutable, is distinct;                  label is _('Email address'), default is '',
41                    is immutable,
42          column email_confirmed =>                  is distinct;
                 label is _('Email address confirmed?'),  
                 type is 'boolean';  
43    
44          column password =>          column password =>
45                  is unreadable,                  is unreadable,
# Line 65  use A3C::Record schema { Line 70  use A3C::Record schema {
70    
71          column hrEduPersonDateOfBirth =>          column hrEduPersonDateOfBirth =>
72                  type is 'date',                  type is 'date',
73                  label is _('Datum rođenja');                  render as 'date',
74                    label is _('Datum rođenja'),
75                    filters are 'Jifty::DBI::Filter::Date';
76    
77          column hrEduPersonGender =>          column hrEduPersonGender =>
78                  label is _('Spol');                  label is _('Spol');
# Line 81  use A3C::Record schema { Line 88  use A3C::Record schema {
88                    
89          column wtAdminType =>          column wtAdminType =>
90                  label is _('Tip administratora'),                  label is _('Tip administratora'),
91                  available are qw( AS AI AR AHU );                  valid are [ '', 'AS', 'AI', 'AR', 'AHU' ];
92    
93          column hrEduPersonProfessionalStatus =>          column hrEduPersonProfessionalStatus =>
94                  label is _('Stručni status'),                  label is _('Stručni status'),
95                  available are qw( DR KV MR NKV PKV SSS VKV VS VSS VŠS );                  valid are [
96                            '',
97                            'NKV',
98                            'PKV',
99                            'KV',
100                            'VKV',
101                            'SSS',
102                            'VS',
103                            'VSS',
104                            'VŠS',
105                            'MR',
106                            'DR',
107                    ],
108                    default is '';
109    
110          column hrEduPersonAcademicStatus =>          column hrEduPersonAcademicStatus =>
111                  label is _('Zvanje'),                  label is _('Zvanje'),
112                  available are [                  valid are [
113                          'asistent',                          '',
                         'asistent - predavač',  
                         'asistent visoke škole',  
                         'docent',  
                         'izvanredni profesor',  
114                          'knjižničar',                          'knjižničar',
115                            'viši knjižničar',
116                          'korepetitor',                          'korepetitor',
117                            'viši korepetitor',
118                          'lektor',                          'lektor',
119                            'viši lektor',
120                            'stručni suradnik',
121                            'asistent visoke škole',
122                            'profesor visoke škole',
123                          'mlađi asistent',                          'mlađi asistent',
124                            'znanstveni novak',
125                            'znanstveni asistent',
126                            'znanstveni suradnik',
127                          'predavač',                          'predavač',
                         'profesor visoke škole',  
                         'redoviti profesor',  
                         'stručni suradnik',  
                         'viši asistent',  
                         'viši knjižničar',  
                         'viši korepetitor',  
                         'viši lektor',  
128                          'viši predavač',                          'viši predavač',
129                          'viši znanstveni suradnik',                          'asistent',
130                          'znanstveni asistent',                          'asistent - predavač',
131                          'znanstveni novak',                          'viši asistent',
132                            'docent',
133                            'izvanredni profesor',
134                            'redoviti profesor',
135                          'znanstveni savjetnik',                          'znanstveni savjetnik',
136                          'znanstveni suradnik',                          'viši znanstveni suradnik',
137                  ];                  ],
138                    default is '';
139    
140          column hrEduPersonScienceArea =>          column hrEduPersonScienceArea =>
141                  label is _('Područje znanosti'),                  label is _('Područje znanosti'),
142                  available are [                  valid are [
143                            '',
144                          'Tehničke znanosti',                          'Tehničke znanosti',
145                          'Prirodne znanosti',                          'Prirodne znanosti',
146                          'Humanističke znanosti',                          'Humanističke znanosti',
147                          'Društvene znanosti',                          'Društvene znanosti',
148                          'Biotehničke znanosti',                          'Biotehničke znanosti',
149                          'Biomedicina i zdravstvo',                          'Biomedicina i zdravstvo',
150                  ];                  ],
151                    default is '';
152    
153          column hrEduPersonAffiliation =>          column hrEduPersonAffiliation =>
154                  label is _('Povezanost s ustanovom'),                  label is _('Povezanost s ustanovom'),
155                  is mandatory,                  is mandatory,
156                  available are [                  valid are [
                         'djelatnik',  
                         'gost',  
                         'korisnik usluge',  
                         'student',  
157                          'učenik',                          'učenik',
158                            'student',
159                            'djelatnik',
160                          'vanjski suradnik',                          'vanjski suradnik',
161                  ];                          'korisnik usluge',
162                            'gost',
163                    ],
164                    default is 'korisnik usluge';
165    
166          column hrEduPersonPrimaryAffiliation =>          column hrEduPersonPrimaryAffiliation =>
167                  label is _('Temeljna povezanost s ustanovom');                  label is _('Temeljna povezanost s ustanovom');
168                  is mandatory,                  is mandatory,
169                  available are [                  valid are [
                         'djelatnik',  
                         'gost',  
                         'korisnik usluge',  
                         'student',  
170                          'učenik',                          'učenik',
171                            'student',
172                            'djelatnik',
173                          'vanjski suradnik',                          'vanjski suradnik',
174                  ];                          'korisnik usluge',
175                            'gost',
176                    ],
177                    default is 'korisnik usluge';
178    
179          column hrEduPersonStudentCategory =>          column hrEduPersonStudentCategory =>
180                  label is 'Vrsta studenta',                  label is 'Vrsta studenta',
181                  available are [                  valid are [
182                          'dodiplomac',                          '',
183                          'osnovnoškolac',                          'osnovnoškolac',
                         'pauzira godinu',  
                         'postdiplomac',  
                         'preddiplomac',  
                         'prekid studija',  
184                          'srednjoškolac',                          'srednjoškolac',
185                          'student stručnog studija',                          'student stručnog studija',
186                  ];                          'preddiplomac',
187                            'postdiplomac',
188                            'dodiplomac',
189                            'pauzira godinu',
190                            'prekid studija',
191                    ],
192                    default is '';
193    
194          column hrEduPersonExpireDate =>          column hrEduPersonExpireDate =>
195                  label is _('Datum isteka temeljne povezanosti'),                  label is _('Datum isteka temeljne povezanosti'),
196                  type is 'date',                  type is 'date',
197                  hint is 'dd.mm.gggg',                  render as 'date',
198                  is mandatory,                  is mandatory,
199                    filters are 'Jifty::DBI::Filter::Date';
200    
201          column hrEduPersonTitle =>          column hrEduPersonTitle =>
202                  label is 'Položaj u ustanovi',                  label is 'Položaj u ustanovi',
203                  available are [                  valid are [     # FIXME reorder
204                            '',
205                          'dekan',                          'dekan',
206                          'direktor',                          'direktor',
207                          'pomoćnik ravnatelja',                          'pomoćnik ravnatelja',
# Line 189  use A3C::Record schema { Line 219  use A3C::Record schema {
219                          'voditelj projekta',                          'voditelj projekta',
220                          'zamjenik pročelnika sveučilišn',                          'zamjenik pročelnika sveučilišn',
221                          'zamjenik ravnatelja',                          'zamjenik ravnatelja',
222                  ];                  ],
223                    default is '';
224    
225          column hrEduPersonRole =>          column hrEduPersonRole =>
226                  label is 'Uloga u ustanovi',                  label is 'Uloga u ustanovi',
227                  available are [                  valid are [
228                            '',
229                          'administrator imenika',                          'administrator imenika',
230                          'CARNet koordinator',                          'CARNet koordinator',
231                          'CARNet sistem inženjer',                          'CARNet sistem inženjer',
# Line 203  use A3C::Record schema { Line 235  use A3C::Record schema {
235                          'MS koordinator',                          'MS koordinator',
236                          'MATICA operater',                          'MATICA operater',
237                          'MATICA urednik',                          'MATICA urednik',
238                  ];                  ],
239                    default is '';
240    
241          column hrEduPersonStaffCategory =>          column hrEduPersonStaffCategory =>
242                  label is 'Vrsta posla u ustanovi',                  label is 'Vrsta posla u ustanovi',
243                  available are [                  valid are [
244                          'administrativno osoblje',                          'administrativno osoblje',
245                          'ICT podrška',                          'ICT podrška',
246                          'istraživači',                          'istraživači',
# Line 267  use A3C::Record schema { Line 300  use A3C::Record schema {
300    
301  };  };
302    
303  use Jifty::Plugin::User::Mixin::Model::User;  # we don't use following mixing because it wants to send notificaitons on e-mail address change
304    #use Jifty::Plugin::User::Mixin::Model::User;
305  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
306  #use Jifty::Plugin::OpenID::Mixin::Model::User;  #use Jifty::Plugin::OpenID::Mixin::Model::User;
307  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
308    
309  # Your model-specific methods go here.  # Your model-specific methods go here.
310    
311    =head2 before_create
312    
313    Implement virtual columns, for now put mail from ldap into email row
314    
315    =cut
316    
317    =for later
318    
319    sub before_create {
320            my ($self, $attr) = @_;
321            if ( ! $attr->{'email'} ) {
322                    warn "push mail to email";
323                    $attr->{'email'} = $attr->{'mail'};
324            }
325    }
326    
327    =cut
328    
329    =head2 email
330    
331    Accessor for compatibility with Jifty mixins
332    
333    =cut
334    
335    sub email {
336            my $self = shift;
337            return $self->__value('mail');
338    }
339    
340    sub email_confirmed { 1 };
341    
342  =head2 validate_telephoneNumber  =head2 validate_telephoneNumber
343    
344  =cut  =cut
# Line 286  sub validate_telephoneNumber { Line 351  sub validate_telephoneNumber {
351          return ( 1, 'OK' );          return ( 1, 'OK' );
352  }  }
353    
354    =head2 canonicalize_hrEduPersonExpireDate
355    
356    Support NONE as 2042-12-30
357    
358    =cut
359    
360    sub canonicalize_hrEduPersonExpireDate {
361            my ( $self, $value ) = @_;
362    
363            if ( $value eq 'NONE' ) {
364                    $self->log->warn("fixed hrEduPersonExpireDate");
365                    $value = '2042-12-30';
366            }
367    
368            return $value;
369    }
370    
371    =head2 current_user_can
372    
373    =cut
374    
375  sub current_user_can {  sub current_user_can {
376          # FIXME no security for now :-)          # FIXME no security for now :-)
377          return 1;          return 1;

Legend:
Removed from v.14  
changed lines
  Added in v.21

  ViewVC Help
Powered by ViewVC 1.1.26