/[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

lib/CAdmin/Model/User.pm revision 4 by dpavlin, Mon Mar 10 00:19:52 2008 UTC lib/A3C/Model/User.pm revision 33 by dpavlin, Tue Mar 18 19:22:30 2008 UTC
# Line 1  Line 1 
1  use strict;  use strict;
2  use warnings;  use warnings;
3    
4  package CAdmin::Model::User;  package A3C::Model::User;
5  use Jifty::DBI::Schema;  use Jifty::DBI::Schema;
6    
7  use CAdmin::Record schema {  use utf8;
8    
9          column name =>  use A3C::Record schema {
10                  type is 'text',  
11                  label is _('Ime'),          column uid =>
12                    label is ('uid'),
13                    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 58  use CAdmin::Record schema { Line 63  use CAdmin::Record schema {
63                  label is _('Fax broj');                  label is _('Fax broj');
64    
65          column hrEduPersonUniqueNumber =>          column hrEduPersonUniqueNumber =>
66                  is mandatory,  #               is mandatory,
67                  label is _('JMBG');                  label is _('JMBG');
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 CAdmin::Record schema { Line 86  use CAdmin::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 organization =>
152                    refers_to A3C::Model::Organization by 'id',
153                    is mandatory;
154    
155          column hrEduPersonAffiliation =>          column hrEduPersonAffiliation =>
156                  label is _('Povezanost s ustanovom'),                  label is _('Povezanost s ustanovom'),
157                  is mandatory,                  is mandatory,
158                  available are [                  valid are [
                         'djelatnik',  
                         'gost',  
                         'korisnik usluge',  
                         'student',  
159                          'učenik',                          'učenik',
160                            'student',
161                            'djelatnik',
162                          'vanjski suradnik',                          'vanjski suradnik',
163                  ];                          'korisnik usluge',
164                            'gost',
165                    ],
166                    default is 'korisnik usluge';
167    
168          column hrEduPersonPrimaryAffiliation =>          column hrEduPersonPrimaryAffiliation =>
169                  label is _('Temeljna povezanost s ustanovom');                  label is _('Temeljna povezanost s ustanovom');
170                  is mandatory,                  is mandatory,
171                  available are [                  valid are [
                         'djelatnik',  
                         'gost',  
                         'korisnik usluge',  
                         'student',  
172                          'učenik',                          'učenik',
173                            'student',
174                            'djelatnik',
175                          'vanjski suradnik',                          'vanjski suradnik',
176                  ];                          'korisnik usluge',
177                            'gost',
178                    ],
179                    default is 'korisnik usluge';
180    
181          column hrEduPersonStudentCategory =>          column hrEduPersonStudentCategory =>
182                  label is 'Vrsta studenta',                  label is 'Vrsta studenta',
183                  available are [                  valid are [
184                          'dodiplomac',                          '',
185                          'osnovnoškolac',                          'osnovnoškolac',
                         'pauzira godinu',  
                         'postdiplomac',  
                         'preddiplomac',  
                         'prekid studija',  
186                          'srednjoškolac',                          'srednjoškolac',
187                          'student stručnog studija',                          'student stručnog studija',
188                  ];                          'preddiplomac',
189                            'postdiplomac',
190                            'dodiplomac',
191                            'pauzira godinu',
192                            'prekid studija',
193                    ],
194                    default is '';
195    
196          column hrEduPersonExpireDate =>          column hrEduPersonExpireDate =>
197                  label is _('Datum isteka temeljne povezanosti'),                  label is _('Datum isteka temeljne povezanosti'),
198                  type is 'date',                  type is 'date',
199                  hint is 'dd.mm.gggg',                  render as 'date',
200                  is mandatory,                  is mandatory,
201                    filters are 'Jifty::DBI::Filter::Date';
202    
203          column hrEduPersonTitle =>          column hrEduPersonTitle =>
204                  label is 'Položaj u ustanovi',                  label is 'Položaj u ustanovi',
205                  available are [                  valid are [     # FIXME reorder
206                            '',
207                          'dekan',                          'dekan',
208                          'direktor',                          'direktor',
209                          'pomoćnik ravnatelja',                          'pomoćnik ravnatelja',
# Line 187  use CAdmin::Record schema { Line 221  use CAdmin::Record schema {
221                          'voditelj projekta',                          'voditelj projekta',
222                          'zamjenik pročelnika sveučilišn',                          'zamjenik pročelnika sveučilišn',
223                          'zamjenik ravnatelja',                          'zamjenik ravnatelja',
224                  ];                  ],
225                    default is '';
226    
227          column hrEduPersonRole =>          column hrEduPersonRole =>
228                  label is 'Uloga u ustanovi',                  label is 'Uloga u ustanovi',
229                  available are [                  valid are [
230                            '',
231                          'administrator imenika',                          'administrator imenika',
232                          'CARNet koordinator',                          'CARNet koordinator',
233                          'CARNet sistem inženjer',                          'CARNet sistem inženjer',
# Line 201  use CAdmin::Record schema { Line 237  use CAdmin::Record schema {
237                          'MS koordinator',                          'MS koordinator',
238                          'MATICA operater',                          'MATICA operater',
239                          'MATICA urednik',                          'MATICA urednik',
240                  ];                  ],
241                    default is '';
242    
243          column hrEduPersonStaffCategory =>          column hrEduPersonStaffCategory =>
244                  label is 'Vrsta posla u ustanovi',                  label is 'Vrsta posla u ustanovi',
245                  available are [                  valid are [
246                          'administrativno osoblje',                          'administrativno osoblje',
247                          'ICT podrška',                          'ICT podrška',
248                          'istraživači',                          'istraživači',
# Line 218  use CAdmin::Record schema { Line 255  use CAdmin::Record schema {
255                  label is 'Pripadnost grupi',                  label is 'Pripadnost grupi',
256                  hint is 'skolskagodina::razred';                  hint is 'skolskagodina::razred';
257    
         column o =>  
                 label is _('Naziv matične ustanove'),  
                 is mandatory;  
           
         column hrEduPersonHomeOrg =>  
                 label is _('Oznaka matične ustanove'),  
                 hint is 'CARNet',  
                 is mandatory;  
   
258          column ou =>          column ou =>
259                  label is _('Organizacijska jedinica');                  label is _('Organizacijska jedinica');
260                    
261          column roomNumber =>          column roomNumber =>
262                  label is _('Broj sobe');                  label is _('Broj sobe');
263    
         column postalAddress =>  
                 label is _('Poštanska adresa'),  
                 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');  
           
264          column homePostalAddress =>          column homePostalAddress =>
265                  label is _('Kućna poštanska adresa');                  label is _('Kućna poštanska adresa'),
266                    render as 'textarea';
267                    
268          column homePhone =>          column homePhone =>
269                  label is _('Kućni telefonski broj');                  label is _('Kućni telefonski broj');
# Line 261  use CAdmin::Record schema { Line 274  use CAdmin::Record schema {
274          column hrEduPersonPrivacy =>          column hrEduPersonPrivacy =>
275                  label is _('Oznaka privatnosti');                  label is _('Oznaka privatnosti');
276    
277            column loginShell =>
278                    label is _('shell');
279    
280            column uidNumber =>
281                    label is _('uid'),
282                    type is 'int';
283    
284            column gidNumber =>
285                    label is _('gid');
286                    type is 'int';
287    
288            column homeDirectory =>
289                    label is _('home');
290    
291  };  };
292    
293  use Jifty::Plugin::User::Mixin::Model::User;  # we don't use following mixing because it wants to send notificaitons on e-mail address change
294    #use Jifty::Plugin::User::Mixin::Model::User;
295  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;  use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
296  #use Jifty::Plugin::OpenID::Mixin::Model::User;  #use Jifty::Plugin::OpenID::Mixin::Model::User;
297  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
298    
299  # Your model-specific methods go here.  # Your model-specific methods go here.
300    
301    =head2 before_create
302    
303    Implement virtual columns, for now put mail from ldap into email row
304    
305    =cut
306    
307    =for later
308    
309    sub before_create {
310            my ($self, $attr) = @_;
311            if ( ! $attr->{'email'} ) {
312                    warn "push mail to email";
313                    $attr->{'email'} = $attr->{'mail'};
314            }
315    }
316    
317    =cut
318    
319    =head2 email
320    
321    Accessor for compatibility with Jifty mixins
322    
323    =cut
324    
325    sub email {
326            my $self = shift;
327            return $self->__value('mail');
328    }
329    
330    sub email_confirmed { 1 };
331    
332  =head2 validate_telephoneNumber  =head2 validate_telephoneNumber
333    
334  =cut  =cut
# Line 282  sub validate_telephoneNumber { Line 341  sub validate_telephoneNumber {
341          return ( 1, 'OK' );          return ( 1, 'OK' );
342  }  }
343    
344    =head2 canonicalize_hrEduPersonExpireDate
345    
346    Support NONE as 2042-12-30
347    
348    =cut
349    
350    sub canonicalize_hrEduPersonExpireDate {
351            my ( $self, $value ) = @_;
352    
353            if ( lc($value) eq 'none' ) {
354                    $self->log->warn("fixed hrEduPersonExpireDate");
355                    $value = '2042-12-30';
356            }
357    
358            return $value;
359    }
360    
361    =head2 current_user_can
362    
363    =cut
364    
365    sub current_user_can {
366            # FIXME no security for now :-)
367            return 1;
368    }
369    
370  1;  1;
371    

Legend:
Removed from v.4  
changed lines
  Added in v.33

  ViewVC Help
Powered by ViewVC 1.1.26