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

Contents of /lib/A3C/Model/hrEduOrg.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 131 - (show annotations)
Mon May 26 18:12:15 2008 UTC (11 years, 1 month ago) by dpavlin
File size: 5232 byte(s)
- validate uidNumber and gitNumber
- remove debug culutter
1 package A3C::Model::hrEduOrg;
2 use strict;
3 use warnings;
4
5 use Jifty::DBI::Schema;
6 use Data::Dump qw/dump/;
7
8 sub create {
9 #warn "# create",dump(@_);
10 my $self = shift;
11 my %data = @_ or die "no data?";
12 foreach my $col ( keys %data ) {
13 #warn "## ref($col)=",ref($col);
14 $data{$col} = join(' <*> ', @{$data{$col}}) if ref( $data{$col} ) eq 'ARRAY';
15 }
16 #warn "## data = ",dump( %data );
17 $self->SUPER::create( %data );
18 }
19
20 use A3C::Record schema {
21
22 # hrEduOrg super: organization
23
24 # hrEduOrg must:
25
26 column hrEduOrgUniqueNumber =>
27 label is _('Visestruka vrijednost brojcani identifikator ustanove'),
28 max_length is 128,
29 is indexed,
30 is mandatory;
31
32 column hrEduOrgMail =>
33 label is _('Sluzbena e-mail adresa ustanove'),
34 max_length is 256,
35 is mandatory;
36
37 column o =>
38 label is _('RFC2256: organization this object belongs to'),
39 is mandatory;
40
41 column hrEduOrgURL =>
42 label is _('URL adresa Web sjedista ustanove'),
43 max_length is 256,
44 is mandatory;
45
46 column hrEduOrgType =>
47 label is _('Jednostruka vrijednost prema kategorizaciji MZOS'),
48 max_length is 128,
49 is mandatory;
50
51 column objectClass =>
52 label is _('RFC2256: object classes of the entity'),
53 is mandatory;
54
55
56 # hrEduOrg may:
57
58 column businessCategory =>
59 label is _('RFC2256: business category'),
60 max_length is 128;
61
62 column searchGuide =>
63 label is _('RFC2256: search guide, obsoleted by enhancedSearchGuide');
64
65 column internationaliSDNNumber =>
66 label is _('RFC2256: international ISDN number'),
67 max_length is 16;
68
69 column telexNumber =>
70 label is _('RFC2256: Telex Number');
71
72 column hrEduOrgPolicyURI =>
73 label is _('URI s oznakom; pokazuje na sluzbenu politiku ustanove'),
74 max_length is 256;
75
76 column postOfficeBox =>
77 label is _('RFC2256: Post Office Box'),
78 max_length is 40;
79
80 column telephoneNumber =>
81 label is _('RFC2256: Telephone Number'),
82 max_length is 32;
83
84 column destinationIndicator =>
85 label is _('RFC2256: destination indicator'),
86 max_length is 128;
87
88 column facsimileTelephoneNumber =>
89 label is _('RFC2256: Facsimile (Fax) Telephone Number');
90
91 column hrEduOrgMobile =>
92 label is _('Broj mobilnog telefona ustanove');
93
94 column userPassword =>
95 label is _('RFC2256/2307: password of user'),
96 max_length is 128;
97
98 column x121Address =>
99 label is _('RFC2256: X.121 Address'),
100 max_length is 15;
101
102 column st =>
103 label is _('RFC2256: state or province which this object resides in');
104
105 column postalCode =>
106 label is _('RFC2256: postal code'),
107 max_length is 40;
108
109 column seeAlso =>
110 label is _('RFC2256: DN of related object');
111
112 column postalAddress =>
113 render as 'textarea',
114 label is _('RFC2256: postal address');
115
116 column physicalDeliveryOfficeName =>
117 label is _('RFC2256: Physical Delivery Office Name'),
118 max_length is 128;
119
120 column teletexTerminalIdentifier =>
121 label is _('RFC2256: Teletex Terminal Identifier');
122
123 column l =>
124 label is _('RFC2256: locality which this object resides in');
125
126 column registeredAddress =>
127 label is _('RFC2256: registered postal address');
128
129 column hrEduOrgMember =>
130 label is _('Pripadnost nekoj ustanovi'),
131 max_length is 128;
132
133 column description =>
134 label is _('RFC2256: descriptive information'),
135 max_length is 1024;
136
137 column preferredDeliveryMethod =>
138 label is _('RFC2256: preferred delivery method');
139
140 column street =>
141 label is _('RFC2256: street address of this object'),
142 max_length is 128;
143
144
145 # dcObject super: top
146
147 # dcObject must:
148
149 column dc =>
150 label is _('RFC1274/2247: domain component'),
151 is mandatory;
152
153
154 # posixAccount super: top
155
156 # posixAccount must:
157
158 column uidNumber =>
159 type is 'int',
160 label is _('An integer uniquely identifying a user in an administrative domain'),
161 is indexed,
162 is distinct,
163 is mandatory;
164
165 column uid =>
166 label is _('RFC1274: user identifier'),
167 max_length is 256,
168 is indexed,
169 is distinct,
170 is mandatory;
171
172 column homeDirectory =>
173 label is _('The absolute path to the home directory'),
174 is mandatory;
175
176 column cn =>
177 label is _('RFC2256: common name(s) for which the entity is known by'),
178 is indexed,
179 is mandatory;
180
181 column gidNumber =>
182 type is 'int',
183 label is _('An integer uniquely identifying a group in an administrative domain'),
184 is mandatory;
185
186
187 # posixAccount may:
188
189 column gecos =>
190 label is _('The GECOS field; the common name');
191
192 column loginShell =>
193 label is _('The path to the login shell');
194
195
196
197
198 };
199
200
201 =head2 name
202
203 Humanly readable name of organization
204
205 =cut
206
207 sub name {
208 my $self = shift;
209 return $self->cn . ' - ' . $self->o;
210 }
211
212 =head2 validate_uidNumber
213
214 =cut
215
216 sub validate_uidNumber {
217 my ( $self, $value ) = @_;
218 return ( 0, _('uidNumber must be only digits') ) unless $value =~ m/^\d+$/;
219 return ( 1, 'OK' );
220 }
221
222 =head2 validate_gidNumber
223
224 =cut
225
226 sub validate_gidNumber {
227 my ( $self, $value ) = @_;
228 return ( 0, _('gidNumber must be only digits') ) unless $value =~ m/^\d+$/;
229 return ( 1, 'OK' );
230 }
231
232 =head2 ACL
233
234 We use L<A3C::DefaultACL> for access control
235
236 =cut
237
238 use A3C::DefaultACL;
239
240 # added to make Jifty::View::Declare::CRUD happy because it
241 # tries to capitalize first letter of model creating
242 # A3C::Model::HrEduOrg which is invalid
243 sub object_type { 'A3C::Model::hrEduOrg' }
244 sub collection_class { 'A3C::Model::hrEduOrgCollection' }
245
246 1;

  ViewVC Help
Powered by ViewVC 1.1.26