/[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 12 by dpavlin, Thu Mar 13 16:34:47 2008 UTC revision 23 by dpavlin, Mon Mar 17 13:02:50 2008 UTC
# Line 4  use warnings; Line 4  use warnings;
4  package A3C::Model::User;  package A3C::Model::User;
5  use Jifty::DBI::Schema;  use Jifty::DBI::Schema;
6    
7    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 25  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 63  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 79  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 187  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 201  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 263  use A3C::Record schema { Line 298  use A3C::Record schema {
298          column hrEduPersonPrivacy =>          column hrEduPersonPrivacy =>
299                  label is _('Oznaka privatnosti');                  label is _('Oznaka privatnosti');
300    
301            column loginShell =>
302                    label is _('shell');
303    
304            column uidNumber =>
305                    label is _('uid'),
306                    type is 'int';
307    
308            column gidNumber =>
309                    label is _('gid');
310                    type is 'int';
311    
312            column homeDirectory =>
313                    label is _('home');
314    
315            column objectClass =>
316                    type is 'virtual';
317    
318  };  };
319    
320  use Jifty::Plugin::User::Mixin::Model::User;  # we don't use following mixing because it wants to send notificaitons on e-mail address change
321    #use Jifty::Plugin::User::Mixin::Model::User;
322  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
323  #use Jifty::Plugin::OpenID::Mixin::Model::User;  #use Jifty::Plugin::OpenID::Mixin::Model::User;
324  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
325    
326  # Your model-specific methods go here.  # Your model-specific methods go here.
327    
328    =head2 before_create
329    
330    Implement virtual columns, for now put mail from ldap into email row
331    
332    =cut
333    
334    =for later
335    
336    sub before_create {
337            my ($self, $attr) = @_;
338            if ( ! $attr->{'email'} ) {
339                    warn "push mail to email";
340                    $attr->{'email'} = $attr->{'mail'};
341            }
342    }
343    
344    =cut
345    
346    =head2 email
347    
348    Accessor for compatibility with Jifty mixins
349    
350    =cut
351    
352    sub email {
353            my $self = shift;
354            return $self->__value('mail');
355    }
356    
357    sub email_confirmed { 1 };
358    
359  =head2 validate_telephoneNumber  =head2 validate_telephoneNumber
360    
361  =cut  =cut
# Line 284  sub validate_telephoneNumber { Line 368  sub validate_telephoneNumber {
368          return ( 1, 'OK' );          return ( 1, 'OK' );
369  }  }
370    
371    =head2 canonicalize_hrEduPersonExpireDate
372    
373    Support NONE as 2042-12-30
374    
375    =cut
376    
377    sub canonicalize_hrEduPersonExpireDate {
378            my ( $self, $value ) = @_;
379    
380            if ( $value eq 'NONE' ) {
381                    $self->log->warn("fixed hrEduPersonExpireDate");
382                    $value = '2042-12-30';
383            }
384    
385            return $value;
386    }
387    
388    =head2 current_user_can
389    
390    =cut
391    
392  sub current_user_can {  sub current_user_can {
393          # FIXME no security for now :-)          # FIXME no security for now :-)
394          return 1;          return 1;

Legend:
Removed from v.12  
changed lines
  Added in v.23

  ViewVC Help
Powered by ViewVC 1.1.26