1 |
use strict; |
2 |
use warnings; |
3 |
|
4 |
package CAdmin::Model::User; |
5 |
use Jifty::DBI::Schema; |
6 |
|
7 |
use CAdmin::Record schema { |
8 |
|
9 |
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 |
is mandatory, |
62 |
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 |
is mandatory; |
239 |
|
240 |
column l => |
241 |
label is _('Mjesto'), |
242 |
hist is 'Zagreb', |
243 |
is mandatory; |
244 |
|
245 |
column postalCode => |
246 |
label is _('Poštanski broj'), |
247 |
hint is 'HR-10000'; |
248 |
|
249 |
column street => |
250 |
label is _('Ulica i kućni broj'); |
251 |
|
252 |
column homePostalAddress => |
253 |
label is _('Kućna poštanska adresa'); |
254 |
|
255 |
column homePhone => |
256 |
label is _('Kućni telefonski broj'); |
257 |
|
258 |
column hrEduPersonCommURI => |
259 |
label is _('Desktop uređaj'); |
260 |
|
261 |
column hrEduPersonPrivacy => |
262 |
label is _('Oznaka privatnosti'); |
263 |
|
264 |
}; |
265 |
|
266 |
use Jifty::Plugin::User::Mixin::Model::User; |
267 |
use Jifty::Plugin::Authentication::Password::Mixin::Model::User; |
268 |
#use Jifty::Plugin::OpenID::Mixin::Model::User; |
269 |
use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
270 |
|
271 |
# Your model-specific methods go here. |
272 |
|
273 |
=head2 validate_telephoneNumber |
274 |
|
275 |
=cut |
276 |
|
277 |
sub validate_telephoneNumber { |
278 |
my ( $self, $value ) = @_; |
279 |
|
280 |
return ( 0, _('Telephone number invalid') ) if $value !~ m/^(\+?385)?[\d\s-]+$/; |
281 |
|
282 |
return ( 1, 'OK' ); |
283 |
} |
284 |
|
285 |
sub current_user_can { |
286 |
# FIXME no security for now :-) |
287 |
return 1; |
288 |
} |
289 |
|
290 |
1; |
291 |
|