/[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 23 - (hide annotations)
Mon Mar 17 13:02:50 2008 UTC (16 years, 1 month ago) by dpavlin
Original Path: lib/A3C/Model/User.pm
File size: 7568 byte(s)
added few more columns to match ldap

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

  ViewVC Help
Powered by ViewVC 1.1.26