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