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

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

  ViewVC Help
Powered by ViewVC 1.1.26