/[A3C]/lib/A3C/Model/Person.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

Annotation of /lib/A3C/Model/Person.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (hide annotations)
Tue Mar 18 16:15:16 2008 UTC (16 years ago) by dpavlin
Original Path: lib/A3C/Model/User.pm
File size: 7476 byte(s)
give up on virtual columns (for now)

1 dpavlin 2 use strict;
2     use warnings;
3    
4 dpavlin 11 package A3C::Model::User;
5 dpavlin 2 use Jifty::DBI::Schema;
6    
7 dpavlin 14 use utf8;
8    
9 dpavlin 11 use A3C::Record schema {
10 dpavlin 2
11 dpavlin 16 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 dpavlin 18 is distinct,
21 dpavlin 4 is mandatory;
22    
23     column cn =>
24 dpavlin 21 label is _('Ime i prezime'),
25 dpavlin 29 is mandatory;
26 dpavlin 4
27     column sn =>
28     label is _('Prezime'),
29     is mandatory;
30    
31     column givenName =>
32     label is _('Ime'),
33     is mandatory;
34    
35 dpavlin 16 column mail =>
36 dpavlin 4 type is 'text',
37     is mandatory,
38 dpavlin 18 label is _('Email address'), default is '',
39     is immutable,
40     is distinct;
41 dpavlin 4
42     column password =>
43     is unreadable,
44     label is _('Password'),
45     type is 'varchar',
46     hints is _('Your password should be at least six characters'),
47     render_as 'password',
48     # filters are 'Jifty::DBI::Filter::SaltHash',
49     is mandatory;
50    
51     column telephoneNumber =>
52     type is 'text',
53     label is _('Telefonski broj'),
54     hint is '+385 xx yyyyyy';
55    
56     column hrEduPersonExtensionNumber =>
57     label is _('Lokalni telefonski broj');
58    
59     column mobile =>
60     label is _('Broj mobilnog telefona');
61    
62     column facsimileTelephoneNumber =>
63     label is _('Fax broj');
64    
65     column hrEduPersonUniqueNumber =>
66 dpavlin 10 # is mandatory,
67 dpavlin 4 label is _('JMBG');
68    
69     column hrEduPersonDateOfBirth =>
70     type is 'date',
71 dpavlin 15 render as 'date',
72 dpavlin 16 label is _('Datum rođenja'),
73     filters are 'Jifty::DBI::Filter::Date';
74 dpavlin 4
75     column hrEduPersonGender =>
76     label is _('Spol');
77    
78     column jpegPhoto =>
79     label is _('Slika');
80    
81     column userCertificate =>
82     label is _('Ceritifikat');
83    
84     column labeledURI =>
85     label is _('URI adresa');
86    
87     column wtAdminType =>
88     label is _('Tip administratora'),
89 dpavlin 15 valid are [ '', 'AS', 'AI', 'AR', 'AHU' ];
90 dpavlin 4
91     column hrEduPersonProfessionalStatus =>
92     label is _('Stručni status'),
93 dpavlin 15 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 dpavlin 4
108     column hrEduPersonAcademicStatus =>
109     label is _('Zvanje'),
110 dpavlin 15 valid are [
111     '',
112 dpavlin 4 'knjižničar',
113 dpavlin 15 'viši knjižničar',
114 dpavlin 4 'korepetitor',
115 dpavlin 15 'viši korepetitor',
116 dpavlin 4 'lektor',
117 dpavlin 15 'viši lektor',
118     'stručni suradnik',
119     'asistent visoke škole',
120     'profesor visoke škole',
121 dpavlin 4 'mlađi asistent',
122 dpavlin 15 'znanstveni novak',
123     'znanstveni asistent',
124     'znanstveni suradnik',
125 dpavlin 4 'predavač',
126 dpavlin 15 'viši predavač',
127     'asistent',
128     'asistent - predavač',
129     'viši asistent',
130     'docent',
131     'izvanredni profesor',
132 dpavlin 4 'redoviti profesor',
133 dpavlin 15 'znanstveni savjetnik',
134 dpavlin 4 'viši znanstveni suradnik',
135 dpavlin 15 ],
136     default is '';
137 dpavlin 4
138     column hrEduPersonScienceArea =>
139     label is _('Područje znanosti'),
140 dpavlin 15 valid are [
141     '',
142 dpavlin 4 'Tehničke znanosti',
143     'Prirodne znanosti',
144     'Humanističke znanosti',
145     'Društvene znanosti',
146     'Biotehničke znanosti',
147     'Biomedicina i zdravstvo',
148 dpavlin 15 ],
149     default is '';
150 dpavlin 4
151     column hrEduPersonAffiliation =>
152     label is _('Povezanost s ustanovom'),
153     is mandatory,
154 dpavlin 15 valid are [
155     'učenik',
156     'student',
157 dpavlin 4 'djelatnik',
158 dpavlin 15 'vanjski suradnik',
159     'korisnik usluge',
160 dpavlin 4 'gost',
161 dpavlin 15 ],
162     default is 'korisnik usluge';
163 dpavlin 4
164     column hrEduPersonPrimaryAffiliation =>
165     label is _('Temeljna povezanost s ustanovom');
166     is mandatory,
167 dpavlin 15 valid are [
168     'učenik',
169     'student',
170 dpavlin 4 'djelatnik',
171 dpavlin 15 'vanjski suradnik',
172     'korisnik usluge',
173 dpavlin 4 'gost',
174 dpavlin 15 ],
175     default is 'korisnik usluge';
176 dpavlin 4
177     column hrEduPersonStudentCategory =>
178     label is 'Vrsta studenta',
179 dpavlin 15 valid are [
180     '',
181     'osnovnoškolac',
182     'srednjoškolac',
183     'student stručnog studija',
184     'preddiplomac',
185     'postdiplomac',
186 dpavlin 4 'dodiplomac',
187     'pauzira godinu',
188     'prekid studija',
189 dpavlin 15 ],
190     default is '';
191 dpavlin 4
192     column hrEduPersonExpireDate =>
193     label is _('Datum isteka temeljne povezanosti'),
194     type is 'date',
195 dpavlin 15 render as 'date',
196 dpavlin 4 is mandatory,
197 dpavlin 16 filters are 'Jifty::DBI::Filter::Date';
198 dpavlin 4
199     column hrEduPersonTitle =>
200     label is 'Položaj u ustanovi',
201 dpavlin 15 valid are [ # FIXME reorder
202     '',
203 dpavlin 4 'dekan',
204     'direktor',
205     'pomoćnik ravnatelja',
206     'predstojnik zavoda',
207     'pročelnik katedre',
208     'pročelnik odsjeka',
209     'pročelnik sveučilišnog odjela',
210     'prodekan',
211     'prorektor',
212     'ravnatelj',
213     'rektor',
214     'voditelj laboratorija',
215     'voditelj odjela',
216     'voditelj organizacijske jedini',
217     'voditelj projekta',
218     'zamjenik pročelnika sveučilišn',
219     'zamjenik ravnatelja',
220 dpavlin 15 ],
221     default is '';
222 dpavlin 4
223     column hrEduPersonRole =>
224     label is 'Uloga u ustanovi',
225 dpavlin 15 valid are [
226     '',
227 dpavlin 4 'administrator imenika',
228     'CARNet koordinator',
229     'CARNet sistem inženjer',
230     'ICT koordinator',
231     'ISVU koordinator',
232     'kontakt za sigurnosna pitanja',
233     'MS koordinator',
234     'MATICA operater',
235     'MATICA urednik',
236 dpavlin 15 ],
237     default is '';
238 dpavlin 4
239     column hrEduPersonStaffCategory =>
240     label is 'Vrsta posla u ustanovi',
241 dpavlin 15 valid are [
242 dpavlin 4 'administrativno osoblje',
243     'ICT podrška',
244     'istraživači',
245     'nastavno osoblje',
246     'osoblje knjižnice',
247     'tehničko osoblje',
248     ];
249    
250     column hrEduPersonGroupMember =>
251     label is 'Pripadnost grupi',
252     hint is 'skolskagodina::razred';
253    
254     column o =>
255     label is _('Naziv matične ustanove'),
256     is mandatory;
257    
258     column hrEduPersonHomeOrg =>
259     label is _('Oznaka matične ustanove'),
260     hint is 'CARNet',
261     is mandatory;
262    
263     column ou =>
264     label is _('Organizacijska jedinica');
265    
266     column roomNumber =>
267     label is _('Broj sobe');
268    
269     column postalAddress =>
270     label is _('Poštanska adresa'),
271 dpavlin 12 render as 'textarea',
272 dpavlin 4 is mandatory;
273    
274     column l =>
275     label is _('Mjesto'),
276     hist is 'Zagreb',
277     is mandatory;
278    
279     column postalCode =>
280     label is _('Poštanski broj'),
281     hint is 'HR-10000';
282    
283     column street =>
284     label is _('Ulica i kućni broj');
285    
286     column homePostalAddress =>
287 dpavlin 12 label is _('Kućna poštanska adresa'),
288     render as 'textarea';
289 dpavlin 4
290     column homePhone =>
291     label is _('Kućni telefonski broj');
292    
293     column hrEduPersonCommURI =>
294     label is _('Desktop uređaj');
295    
296     column hrEduPersonPrivacy =>
297     label is _('Oznaka privatnosti');
298    
299 dpavlin 23 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 dpavlin 2 };
314    
315 dpavlin 18 # 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 dpavlin 4 use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
318     #use Jifty::Plugin::OpenID::Mixin::Model::User;
319     use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on
320    
321 dpavlin 2 # Your model-specific methods go here.
322    
323 dpavlin 18 =head2 before_create
324 dpavlin 16
325 dpavlin 18 Implement virtual columns, for now put mail from ldap into email row
326 dpavlin 16
327     =cut
328    
329 dpavlin 18 =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 dpavlin 16 }
338    
339 dpavlin 18 =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 dpavlin 4 =head2 validate_telephoneNumber
355    
356     =cut
357    
358     sub validate_telephoneNumber {
359     my ( $self, $value ) = @_;
360    
361     return ( 0, _('Telephone number invalid') ) if $value !~ m/^(\+?385)?[\d\s-]+$/;
362    
363     return ( 1, 'OK' );
364     }
365    
366 dpavlin 16 =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 dpavlin 7 sub current_user_can {
388     # FIXME no security for now :-)
389     return 1;
390     }
391    
392 dpavlin 2 1;
393    

  ViewVC Help
Powered by ViewVC 1.1.26