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

Legend:
Removed from v.2  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.26