Changeset 1023
- Timestamp:
- 05/29/12 10:25:51 (12 years ago)
- Location:
- trunk/LATMOS-Accounts
- Files:
-
- 2 added
- 51 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/bin/la-search
r861 r1023 75 75 =back 76 76 77 =back 78 77 79 =cut 78 80 -
trunk/LATMOS-Accounts/bin/la-sql-edit-form
r975 r1023 9 9 =head1 NAME 10 10 11 la- edit- Tools to edit forms (accreq)11 la-sql-edit-form - Tools to edit forms (accreq) 12 12 13 13 =head1 SYNOPSIS 14 14 15 la- edit [options] obj_id15 la-sql-edit-form formid 16 16 17 17 =cut … … 113 113 =head2 SYNTAX 114 114 115 The form must be describe in YAML format (L< TODO: Wikipedia link>).115 The form must be describe in YAML format (L<http://en.wikipedia.org/wiki/YAML>). 116 116 117 117 =head2 OPTIONS -
trunk/LATMOS-Accounts/bin/la-sql-rev
r1007 r1023 35 35 Query this specific base instead of the default one. 36 36 37 =back 38 37 39 =cut 38 40 -
trunk/LATMOS-Accounts/bin/la-sync-manager
r983 r1023 11 11 use LATMOS::Accounts::Task; 12 12 13 =head1 NAME 14 15 la-sync-manager - Daemon performing synchronisation and various tasks 16 17 =head1 SYNOPSIS 18 19 la-sync-manager [options...] 20 21 =cut 22 13 23 GetOptions( 14 24 'nodaemon' => \my $nodaemon, 15 25 'c|config=s' => \my $config, 16 26 'help' => sub { pod2usage(0) }, 17 'test' => \my $test,18 27 'wait=i' => \my $wait, 19 28 ) or pod2usage(); 29 30 =head1 OPTIONS 31 32 =over 4 33 34 =item --nodaemon 35 36 Don't go into background 37 38 =item -c|--config configdir 39 40 Use this configuration instead default one 41 42 =item --help 43 44 Display this help 45 46 =item --wait minutes 47 48 Wait this number of minutes before process synchronisation (default is 5 49 minutes) 50 51 =back 52 53 =cut 20 54 21 55 my $needsync = 2; … … 118 152 } 119 153 154 __END__ 155 156 =head1 SEE ALSO 157 158 L<la-sync-manager.ini>, L<latmos-accounts.ini> 159 160 =head1 AUTHOR 161 162 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 163 164 =head1 COPYRIGHT AND LICENSE 165 166 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 167 168 This library is free software; you can redistribute it and/or modify 169 it under the same terms as Perl itself, either Perl version 5.10.0 or, 170 at your option, any later version of Perl 5 you may have available. 171 172 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts.pm
r1022 r1023 309 309 __END__ 310 310 311 =head1 SEE ALSO312 313 311 =head1 AUTHOR 314 312 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Acls.pm
r918 r1023 6 6 7 7 our $VERSION = (q$Rev: 330 $ =~ /^Rev: (\d+) /)[0]; 8 9 =head1 NAME 10 11 LATMOS::Accounts::Acls - Acl support in L<LATMOS::Accounts> 12 13 =head1 FUNCTIONS 14 15 =cut 16 17 =head1 new($file) 18 19 Instanciate Acls from C<$file> 20 21 =cut 8 22 9 23 sub new { … … 61 75 62 76 ACL are applied in the order they appear in the file. 77 78 =cut 79 80 =head2 read_acl_file ($file) 81 82 Load acls from file C<$file>. 63 83 64 84 =cut … … 118 138 } 119 139 140 =head2 add ($obj_dot_attr, $list) 141 142 A new acl for C<$obj_dot_attr> (in form C<object.attribute>) with C<$list> 143 permissions. 144 145 =cut 146 120 147 sub add { 121 148 my ($self, $obj, $list) = @_; … … 126 153 } 127 154 155 =head2 check ($obj, $attr, $perm, $who, $groups) 156 157 Return true is this acl apply to C<$obj>/C<$attr> for C<$perm> by user 158 C<$who> in groups C<$groups>. 159 160 =cut 161 128 162 sub check { 129 163 my ($self, $obj, $attr, $perm, $who, $groups) = @_; … … 148 182 use strict; 149 183 use warnings; 184 185 =head1 LATMOS::Accounts::Acls::acl 186 187 =head2 new($objdotatt, $list) 188 189 Create new sub acl where C<$objdotatt> is object in form C<Object.Attribute> and 190 C<$list> the list of permission. 191 192 =cut 150 193 151 194 sub new { … … 168 211 } 169 212 213 =head2 add_perm($perm) 214 215 Add a permission to this sub acl 216 217 =cut 218 170 219 sub add_perm { 171 220 my ($self, $perm) = @_; … … 187 236 1 188 237 } 238 239 =head2 match($obj, $attr, $perm, $who, $groups) 240 241 Return true is this sub acl apply to C<$obj>/C<$attr> for C<$perm> by user 242 C<$who> in groups C<$groups>. 243 244 =cut 189 245 190 246 sub match { … … 228 284 } 229 285 286 =head2 dump 287 288 Return a textual dump of the sub acl 289 290 =cut 291 230 292 sub dump { 231 293 my ($self) = @_; … … 243 305 244 306 __END__ 307 308 =head1 SEE ALSO 309 310 =head1 AUTHOR 311 312 Thauvin Olivier, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 313 314 =head1 COPYRIGHT AND LICENSE 315 316 Copyright (C) 2009, 2010, 2011, 2012 by Thauvin Olivier 317 318 This library is free software; you can redistribute it and/or modify 319 it under the same terms as Perl itself, either Perl version 5.10.0 or, 320 at your option, any later version of Perl 5 you may have available. 321 322 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm
r1002 r1023 55 55 } 56 56 57 =head2 wexported 58 59 See L</unexported> 60 61 =cut 62 57 63 sub wexported { unexported(@_) } 64 65 =head2 unexported ($wexported) 66 67 Set base to report unexported object or not 68 69 =cut 58 70 59 71 sub unexported { … … 90 102 } 91 103 104 =head2 type 105 106 Return the type of the base 107 108 =cut 109 92 110 sub type { 93 111 $_[0]->{_type}; … … 101 119 102 120 sub la { $_[0]->{_la} }; 121 122 =head2 options ($opt) 123 124 Return options from config 125 126 =cut 103 127 104 128 sub options { … … 132 156 return @sobj; 133 157 } 158 159 =head2 ordered_objects 160 161 Return supported object type ordered in best order for synchronisation 162 163 =cut 134 164 135 165 sub ordered_objects { … … 356 386 } 357 387 388 =head2 obj_attr_allowed_values ($otype, $attr) 389 390 Return value allowed for this attribute 391 392 =cut 393 358 394 sub obj_attr_allowed_values { 359 395 my ($self, $otype, $attr) = @_; … … 364 400 return(); 365 401 } 402 403 =head2 check_allowed_values ($otype, $attr, $attrvalues) 404 405 Check attributes C<$attr> of object type C<$otype> allow values C<$attrvalues> 406 407 =cut 366 408 367 409 sub check_allowed_values { … … 406 448 } 407 449 450 =head2 get_attr_schema 451 452 Deprecated 453 454 =cut 455 456 # TODO: kill this 457 408 458 sub get_attr_schema { 409 459 my ($self, $otype, $attribute) = @_; … … 415 465 } 416 466 } 467 468 =head2 attribute($otype, $attribute) 469 470 Return attribute object. 471 472 See L<LATMOS::Accounts::Bases::Attribute> 473 474 =cut 417 475 418 476 sub attribute { … … 434 492 ); 435 493 } 494 495 =head2 delayed_fields 496 497 DEPRECATED 498 499 =cut 500 501 # TODO: kill this 436 502 437 503 sub delayed_fields { … … 449 515 @attrs 450 516 } 517 518 =head2 ochelper ($otype) 519 520 Return L<LATMOS::Accounts::Bases::OChelper> object 521 522 =cut 451 523 452 524 sub ochelper { … … 580 652 } 581 653 654 =head2 postcommit 655 656 Run postcommit command 657 658 =cut 659 582 660 sub postcommit { 583 661 my ($self) = @_; … … 642 720 } 643 721 } 722 723 =head2 sync_object_from($srcbase, $otype, $id, %options) 724 725 Sync object type C<$otype> C<$id> from base C<$srcbase> to current base. 726 727 C<%options>: 728 729 =over 4 730 731 =item nodelete 732 733 Don't delete object if the object synchronize don't exist in source base 734 735 =back 736 737 =cut 644 738 645 739 sub sync_object_from { … … 733 827 } 734 828 829 =head2 attributes_summary($otype, $attr) 830 831 Return couple object id / value for attribute C<$attr> of object type C<$otype> 832 833 This method is designed to be faster than fetching object one by one. 834 835 =cut 836 735 837 sub attributes_summary { 736 838 my ($self, $otype, $attr) = @_; … … 739 841 } 740 842 843 =head2 find_next_numeric_id($otype, $field, $min, $max) 844 845 Return, if possible, next numeric id available (typically unix user UID). 846 847 =cut 848 741 849 sub find_next_numeric_id { 742 850 my ($self, $otype, $field, $min, $max) = @_; … … 744 852 $pclass->find_next_numeric_id($self, $field, $min, $max); 745 853 } 854 855 =head2 authenticate_user($username, $passwd) 856 857 Return true if authentication success. 858 859 Must be override by driver if the base have a proper authentication method 860 861 =cut 746 862 747 863 sub authenticate_user { … … 784 900 } 785 901 902 =head2 connect($username, $password) 903 904 Authenticate the user and store the username as connected 905 906 =cut 907 786 908 sub connect { 787 909 my ($self, $username, $password) = @_; … … 793 915 return $auth; 794 916 } 917 918 =head2 check_acl($obj, $attr, $perm) 919 920 Return true if connected user have C<$perm> permission on attribute C<$attr> of 921 object C<$obj>. 922 923 =cut 795 924 796 925 sub check_acl { … … 813 942 } 814 943 944 =head2 text_empty_dump($fh, $otype, $options) 945 946 Empty object dump 947 948 =cut 949 815 950 sub text_empty_dump { 816 951 my ($self, $fh, $otype, $options) = @_; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Attributes.pm
r959 r1023 14 14 15 15 =head2 new($attributes, $base_or_object, $maybe_otype) 16 17 Instanciate a new Attributes object. 16 18 17 19 =cut … … 43 45 } 44 46 47 =head2 base 48 49 Return base handle 50 51 =cut 52 45 53 sub base { $_[0]->{_base} } 54 55 =head2 name 56 57 Return attribute name 58 59 =cut 60 46 61 sub name { $_[0]->{_name} } 62 63 =head2 otype 64 65 Return object type for this attribute 66 67 =cut 68 69 47 70 sub otype { $_[0]->{_otype} } 71 72 =head2 mandatory 73 74 Return true if attribute is mandatory 75 76 =cut 77 48 78 sub mandatory { $_[0]->{mandatory} || 0 } 79 80 =head2 object 81 82 Return handle object if any 83 84 =cut 85 49 86 sub object { $_[0]->{_object} } 50 87 … … 65 102 } 66 103 67 =head2 104 =head2 iname 68 105 69 106 Return internal name of attributes … … 73 110 sub iname { $_[0]->{iname} || $_[0]->name } 74 111 112 =head2 label 113 114 Return the label to display 115 116 =cut 117 75 118 sub label { $_[0]->{label} || $_[0]->{_name} } 119 120 =head2 has_values_list 121 122 Return true if the attribute have a fixed list of accepted values 123 124 =cut 76 125 77 126 sub has_values_list { … … 87 136 } 88 137 } 138 139 =head2 can_values 140 141 Return possible value allowed by this attribute 142 143 =cut 89 144 90 145 sub can_values { … … 107 162 } 108 163 164 =head2 display ($value) 165 166 Return the well formated value according attribute 167 168 =cut 169 109 170 sub display { 110 171 my ($self, $value) = @_; … … 116 177 } 117 178 179 =head2 input ($value) 180 181 Return well formated single value for insert into base 182 183 =cut 184 118 185 sub input { 119 186 my ($self, $value) = @_; … … 125 192 } 126 193 194 =head2 readable 195 196 Return true if attribute can be read 197 198 =cut 199 200 sub readable { 201 my ($self) = @_; 202 if (ref $self->{readable} eq 'CODE') { 203 return $self->{readable}->($self->object) || 0; 204 } else { 205 return defined($_[0]->{readable}) ? $_[0]->{readable} : 1; 206 } 207 } 208 209 =head2 ro 210 211 Return true if the attribute cannot be write by design 212 213 =cut 214 127 215 sub ro { 128 216 my ($self) = @_; … … 134 222 } 135 223 136 sub readable { 137 my ($self) = @_; 138 if (ref $self->{readable} eq 'CODE') { 139 return $self->{readable}->($self->object) || 0; 140 } else { 141 return defined($_[0]->{readable}) ? $_[0]->{readable} : 1; 142 } 143 } 224 =head2 readonly 225 226 Return true if attribute cannot be read according acls or attributes state 227 228 =cut 144 229 145 230 sub readonly { … … 150 235 } 151 236 237 =head2 check_acl ($mode) 238 239 Return true is access to C<$mode> is granted 240 241 =cut 242 152 243 sub check_acl { 153 244 my ($self, $mode) = @_; … … 160 251 } 161 252 253 =head2 real_form_type 254 255 Return the way the fields must be show in GUI. 256 For each type option maybe given by form_option 257 258 =head3 LABEL 259 260 =over 4 261 262 =item length 263 264 The length to use to show the attribute 265 266 =back 267 268 =head3 TEXT 269 270 =head3 TEXTAREA 271 272 =head3 DATE 273 274 =head3 LIST 275 276 =head3 CHECKBOX 277 278 =over 4 279 280 =item rawvalue 281 282 The real value of the attribute must be show 283 284 =back 285 286 =cut 287 288 sub real_form_type { $_[0]->{formtype} || 'TEXT' } 289 162 290 =head2 form_type 163 291 164 Return the way the fields must be show in GUI. 165 For each type option maybe given by from_option 166 167 =head3 LABEL 168 169 =over 4 170 171 =item length 172 173 The length to use to show the attribute 174 175 =back 176 177 =head3 TEXT 178 179 =head3 TEXTAREA 180 181 =head3 DATE 182 183 =head3 LIST 184 185 =head3 CHECKBOX 186 187 =over 4 188 189 =item rawvalue 190 191 The real value of the attribute must be show 192 193 =back 194 195 =cut 196 197 sub real_form_type { $_[0]->{formtype} || 'TEXT' } 292 Return the way the attribute must be displayed 293 294 =cut 198 295 199 296 sub form_type { … … 204 301 } 205 302 303 =head2 form_option ($option) 304 305 Return the form option C<$option> 306 307 =cut 308 206 309 sub form_option { 207 310 my ($self, $option) = @_; … … 209 312 } 210 313 314 =head2 uniq 315 316 Return true is attribute value must be uniq 317 318 =cut 319 211 320 sub uniq { $_[0]->{uniq} || 0 } 212 321 322 =head2 multiple 323 324 Return true is attribute value can be set several times 325 326 =cut 327 213 328 sub multiple { $_[0]->{multiple} || 0 } 214 329 330 =head2 hidden 331 332 Return true if attributes must not appear in list by can be query. 333 334 =cut 335 215 336 sub hidden { $_[0]->{hide} || 0 } 337 338 =head2 delayed 339 340 Return true if attribute must be set after object creation during 341 synchronisation 342 343 =cut 216 344 217 345 sub delayed { $_[0]->{delayed} || 0 } … … 232 360 } 233 361 } 362 363 =head2 set ($values) 364 365 Set attribute value to attached object 366 367 =cut 234 368 235 369 sub set { … … 250 384 } 251 385 386 =head2 default_value 387 388 Return default value for this attribute 389 390 =cut 391 252 392 sub default_value { 253 393 my ($self) = @_; … … 258 398 259 399 1; 400 401 __END__ 402 403 =head1 SEE ALSO 404 405 L<LATMOS::Accounts::Bases> 406 407 =head1 AUTHOR 408 409 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 410 411 =head1 COPYRIGHT AND LICENSE 412 413 Copyright (C) 2012 CNRS SA/CETP/LATMOS 414 415 This library is free software; you can redistribute it and/or modify 416 it under the same terms as Perl itself, either Perl version 5.10.0 or, 417 at your option, any later version of Perl 5 you may have available. 418 419 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Dummy.pm
r3 r1023 4 4 use warnings; 5 5 use base qw(LATMOS::Accounts::Bases); 6 7 =head1 NAME 8 9 LATMOS::Accounts::Bases::Dummy - Dummy base for testing purpose 10 11 =head1 DESCRIPTION 12 13 This base does nothing except returning true, it can be used to test process 14 15 =cut 6 16 7 17 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; … … 13 23 14 24 1; 25 26 __END__ 27 28 =head1 SEE ALSO 29 30 L<LATMOS::Accounts::Bases> 31 32 =head1 AUTHOR 33 34 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 35 36 =head1 COPYRIGHT AND LICENSE 37 38 Copyright (C) 2012 CNRS SA/CETP/LATMOS 39 40 This library is free software; you can redistribute it and/or modify 41 it under the same terms as Perl itself, either Perl version 5.10.0 or, 42 at your option, any later version of Perl 5 you may have available. 43 44 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Dummy/User.pm
r861 r1023 4 4 use warnings; 5 5 use base qw(LATMOS::Accounts::Bases::Objects); 6 7 =head1 NAME 8 9 LATMOS::Accounts::Bases::Dummy::User - User support for Dummy base 10 11 =cut 6 12 7 13 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; … … 29 35 30 36 1; 37 38 __END__ 39 40 =head1 SEE ALSO 41 42 L<LATMOS::Accounts::Bases::Sql>, L<LATMOS::Accounts::Bases::Sql::DataRequest> 43 44 =head1 AUTHOR 45 46 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 47 48 =head1 COPYRIGHT AND LICENSE 49 50 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 51 52 This library is free software; you can redistribute it and/or modify 53 it under the same terms as Perl itself, either Perl version 5.10.0 or, 54 at your option, any later version of Perl 5 you may have available. 55 56 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Heimdal.pm
r917 r1023 82 82 } 83 83 84 sub param {84 sub _param { 85 85 my ($self, $var) = @_; 86 86 return $self->{_param}{$var} … … 93 93 $self->{_heimdal} and return 1; 94 94 95 if (!$self-> param('realm')) {96 if ($self-> param('domain')) {95 if (!$self->_param('realm')) { 96 if ($self->_param('domain')) { 97 97 $self->{_param}{realm} = $self->_domain2realm or do { 98 98 $self->log(LA_ERR, 99 99 'Cannot find kerberos TXT record for domain `%s\'', 100 $self-> param('domain'),100 $self->_param('domain'), 101 101 ); 102 102 return; 103 103 }; 104 $self->log(LA_DEBUG, 'kerberos REALM is %s', $self-> param('realm'));104 $self->log(LA_DEBUG, 'kerberos REALM is %s', $self->_param('realm')); 105 105 } else { 106 106 # No way to find realm … … 108 108 } 109 109 } 110 my @servers = $self-> param('server')111 ? ($self-> param('server'))112 : $self-> param('domain')110 my @servers = $self->_param('server') 111 ? ($self->_param('server')) 112 : $self->_param('domain') 113 113 ? $self->_domain2server 114 114 : (); … … 125 125 # Port => '8899', 126 126 # Required: 127 Principal => $self-> param('login'),128 Realm => $self-> param('realm'),127 Principal => $self->_param('login'), 128 Realm => $self->_param('realm'), 129 129 # --- Either --- 130 Password => $self-> param('password'),130 Password => $self->_param('password'), 131 131 # --- Or --- 132 # Keytab => $self-> param('keytab'),132 # Keytab => $self->_param('keytab'), 133 133 ); 134 134 … … 157 157 158 158 my $resolver = Net::DNS::Resolver->new; 159 my $query = $resolver->query("_kerberos-adm._tcp." . $self-> param('domain'),159 my $query = $resolver->query("_kerberos-adm._tcp." . $self->_param('domain'), 160 160 "SRV") or return; 161 161 foreach my $rr ( … … 173 173 my $resolver = Net::DNS::Resolver->new; 174 174 my $query = $resolver->query( 175 "_kerberos." . $self-> param('domain'),175 "_kerberos." . $self->_param('domain'), 176 176 "TXT") or return; 177 177 foreach my $rr ($query->answer) { … … 182 182 } 183 183 184 =head2 heimdal 185 186 Return heimdal handle. 187 188 =cut 189 184 190 sub heimdal { 185 191 return $_[0]->{_heimdal}; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Heimdal/User.pm
r933 r1023 80 80 } 81 81 82 sub uid2prin { 82 =head2 uid2principal ($uid, $base) 83 84 Convert UID to kerberos principal 85 86 =cut 87 88 sub uid2principal { 83 89 my ($self, $uid, $base) = @_; 84 90 my $ba = $base || $self->base; … … 92 98 93 99 _is_ignored_user($base, $uid) and return; 94 my $entry = $base->heimdal->getPrincipal($class->uid2prin ($uid, $base));100 my $entry = $base->heimdal->getPrincipal($class->uid2principal($uid, $base)); 95 101 return if (!$entry); 96 102 bless({ entry => $entry, _base => $base, _id => $uid }, $class); … … 104 110 return; 105 111 }; 106 my $principal = $base->heimdal->makePrincipal($class->uid2prin ($id, $base));112 my $principal = $base->heimdal->makePrincipal($class->uid2principal($id, $base)); 107 113 exists($data{krb5KDCFlags}) or $data{krb5KDCFlags} = 0; 108 114 exists($data{krb5MaxRenew}) or $data{krb5MaxRenew} = 604800; … … 121 127 my $obj = $class->new($base, $uid) or return; 122 128 123 my $code = $base->heimdal->deletePrincipal($class->uid2prin ($uid, $base));129 my $code = $base->heimdal->deletePrincipal($class->uid2principal($uid, $base)); 124 130 125 131 if (!$code) { … … 188 194 189 195 $self->base->heimdal->changePassword( 190 $self->uid2prin (),196 $self->uid2principal(), 191 197 $clear_pass 192 198 ); -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ldap.pm
r792 r1023 83 83 } 84 84 85 sub param {85 sub _param { 86 86 my ($self, $var) = @_; 87 87 return $self->{_param}{$var} 88 88 } 89 90 =head2 object_base_dn ($otype) 91 92 Return the dn of obecjt containers 93 94 =cut 89 95 90 96 sub object_base_dn { 91 97 my ($self, $otype) = @_; 92 98 return join(',', 93 ($self-> param($otype . '_container') || 'cn=Users'),99 ($self->_param($otype . '_container') || 'cn=Users'), 94 100 $self->top_dn, 95 101 ); … … 134 140 ) 135 141 } 142 143 =head2 ldap 144 145 Return the L<Net::LDAP> handle 146 147 =cut 136 148 137 149 sub ldap { … … 235 247 at your option, any later version of Perl 5 you may have available. 236 248 237 238 =cut 249 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ldap/objects.pm
r861 r1023 132 132 } 133 133 134 =head2 ldap 135 136 A shortcut to return the L<Net::LDAP> object 137 138 =cut 139 134 140 sub ldap { 135 141 return $_[0]->base->{_ldap}; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Mail.pm
r861 r1023 10 10 11 11 our $VERSION = (q$Rev: 641 $ =~ /^Rev: (\d+) /)[0]; 12 13 =head1 NAME 14 15 LATMOS::Accounts::Bases::Mail - Base support for mail files 16 17 =head1 DESCRIPTION 18 19 This base is designed to generated aliases/revaliases files used by postfix or 20 sendmail. This allow to centralise all information and to automated alias 21 generation from user real name. 22 23 =cut 12 24 13 25 sub new { … … 160 172 161 173 1; 174 175 __END__ 176 177 =head1 SEE ALSO 178 179 =head1 AUTHOR 180 181 Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt> 182 183 =head1 COPYRIGHT AND LICENSE 184 185 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 186 187 This library is free software; you can redistribute it and/or modify 188 it under the same terms as Perl itself, either Perl version 5.10.0 or, 189 at your option, any later version of Perl 5 you may have available. 190 191 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Mail/Aliases.pm
r861 r1023 8 8 9 9 our $VERSION = (q$Rev: 641 $ =~ /^Rev: (\d+) /)[0]; 10 11 =head1 NAME 12 13 LATMOS::Accounts::Bases::Mail::Aliases - Aliases support for mail base. 14 15 =cut 10 16 11 17 sub new { … … 46 52 47 53 1; 54 55 __END__ 56 57 =head1 SEE ALSO 58 59 L<LATMOS::Accounts::Bases::Mail> 60 61 =head1 AUTHOR 62 63 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 64 65 =head1 COPYRIGHT AND LICENSE 66 67 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 68 69 This library is free software; you can redistribute it and/or modify 70 it under the same terms as Perl itself, either Perl version 5.10.0 or, 71 at your option, any later version of Perl 5 you may have available. 72 73 =cut 74 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Mail/Revaliases.pm
r861 r1023 6 6 use base qw(LATMOS::Accounts::Bases::Mail::objects); 7 7 use LATMOS::Accounts::Log; 8 9 =head1 NAME 10 11 LATMOS::Accounts::Bases::Mail::Revaliases - RevAliases support for Mail base. 12 13 =cut 8 14 9 15 our $VERSION = (q$Rev: 641 $ =~ /^Rev: (\d+) /)[0]; … … 39 45 40 46 1; 47 48 __END__ 49 50 =head1 SEE ALSO 51 52 L<LATMOS::Accounts::Bases::Mail> 53 54 =head1 AUTHOR 55 56 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 57 58 =head1 COPYRIGHT AND LICENSE 59 60 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 61 62 This library is free software; you can redistribute it and/or modify 63 it under the same terms as Perl itself, either Perl version 5.10.0 or, 64 at your option, any later version of Perl 5 you may have available. 65 66 =cut 67 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Mail/objects.pm
r861 r1023 9 9 our $VERSION = (q$Rev: 641 $ =~ /^Rev: (\d+) /)[0]; 10 10 11 =head1 NAME 12 13 LATMOS::Accounts::Bases::Mail::objects - Parent class for Mail base's objects 14 15 =head1 SEE ALSO 16 17 L<LATMOS::Accounts::Bases::Mail> 18 19 =head1 AUTHOR 20 21 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 22 23 =head1 COPYRIGHT AND LICENSE 24 25 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 26 27 This library is free software; you can redistribute it and/or modify 28 it under the same terms as Perl itself, either Perl version 5.10.0 or, 29 at your option, any later version of Perl 5 you may have available. 30 31 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/OCHelper.pm
r861 r1023 5 5 use strict; 6 6 use warnings; 7 8 =head1 NAME 9 10 LATMOS::Accounts::Bases::OCHelper - Object creation helper 11 12 =head1 DESCRIPTION 13 14 This module is designed to be subclassed. 15 16 =head1 FUNCTIONS 17 18 =cut 19 20 =head2 new($base, $otype) 21 22 =cut 7 23 8 24 sub new { … … 14 30 } 15 31 32 =head2 $ochelper->base 33 34 Return base object 35 36 =cut 37 16 38 sub base { $_[0]->{_base} } 39 40 =head2 $ochelper->otype 41 42 Return object type for this OChelper. 43 44 =cut 45 17 46 sub otype { $_[0]->{_otype} } 18 47 19 # return STATUS, $info 20 # info = { 21 # step => 0, 22 # name => { # name of object 23 # ask => 0/1, 24 # content => ... 25 # }, 26 # ask => [ list ], 27 # contents => { name => ... } 28 # } 29 # STATUS => 'NEEDINFO', 'CREATED', 'ERROR', undef (what??) 48 =head2 $ochelper->step($info) 49 50 Process next step by submitting C<$info> and return the status and new 51 information to continue process. 52 53 C<$info> must look like: 54 55 info = { 56 step => 0, 57 name => { # name of object 58 ask => 0/1, 59 content => ... 60 }, 61 ask => [ list ], 62 contents => { name => ... } 63 } 64 65 STATUS will be one of 'NEEDINFO', 'CREATED', 'ERROR', undef. 66 67 =cut 30 68 31 69 sub step { … … 75 113 76 114 1; 115 116 __END__ 117 118 =head1 SEE ALSO 119 120 L<LATMOS::Accounts::Bases>, L<LATMOS::Accounts::Bases::Objects> 121 122 =head1 AUTHOR 123 124 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 125 126 =head1 COPYRIGHT AND LICENSE 127 128 Copyright (C) 2012 CNRS SA/CETP/LATMOS 129 130 This library is free software; you can redistribute it and/or modify 131 it under the same terms as Perl itself, either Perl version 5.10.0 or, 132 at your option, any later version of Perl 5 you may have available. 133 134 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/OCHelper/User.pm
r1014 r1023 10 10 =head1 NAME 11 11 12 13 12 LATMOS::Accounts::Bases::OCHelper::User - 13 Helper to create user in L<LATMOS::Accounts> system 14 14 15 15 =cut … … 105 105 =head1 SEE ALSO 106 106 107 L<LATMOS::Accounts::Bases::OCHelper> 108 107 109 =head1 AUTHOR 108 110 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm
r1014 r1023 22 22 23 23 =head1 FUNCTIONS 24 25 =cut 26 27 =head2 is_supported 28 29 If exists, must return true or false if the object is supported or not 24 30 25 31 =cut … … 136 142 } 137 143 144 =head2 attribute ($attribute) 145 146 Return L<LATMOS::Accounts::Bases::Attributes> object for C<$attribute> 147 148 =cut 149 138 150 sub attribute { 139 151 my ($self, $attribute) = @_; … … 141 153 my $attrinfo; 142 154 if (! ref $attribute) { 143 $attrinfo = $self-> base->get_attr_schema(144 $self-> type, $attribute145 )or return;155 $attrinfo = $self->_get_attr_schema( 156 $self->base)->{$attribute} 157 or return; 146 158 $attrinfo->{name} = $attribute; 147 159 } else { … … 211 223 return ref $res ? @{ $res } : ($res); 212 224 } 225 226 =head2 get_state ($state) 227 228 Return an on fly computed value 229 230 =cut 213 231 214 232 sub get_state { … … 241 259 } 242 260 261 =head2 queryformat ($fmt) 262 263 Return formated string according C<$fmt> 264 265 =cut 266 243 267 sub queryformat { 244 268 my ($self, $fmt) = @_; … … 263 287 =cut 264 288 289 =head2 check_allowed_values ($attr, $values) 290 291 Check if value C<$values> is allowed for attributes C<$attr> 292 293 =cut 294 265 295 sub check_allowed_values { 266 296 my ($self, $attr, $values) = @_; 267 297 $self->base->check_allowed_values($self->type, $attr, $values); 268 298 } 299 300 =head2 attr_allow_values ($attr) 301 302 Return allowed for attribute C<$attr> 303 304 =cut 269 305 270 306 sub attr_allow_values { … … 377 413 } 378 414 415 =head2 check_password ($password) 416 417 Check given password is secure using L<Crypt::Cracklib> 418 419 =cut 420 379 421 sub check_password { 380 422 my ( $self, $password ) = @_; … … 383 425 return fascist_check($password, $dictionary); 384 426 } 427 428 =head2 search ($base, @filter) 429 430 Search object matching C<@filter> 431 432 =cut 385 433 386 434 sub search { … … 444 492 } 445 493 494 =head2 attributes_summary ($base, $attribute) 495 496 Return list of values existing in base for C<$attribute> 497 498 =cut 446 499 447 500 sub attributes_summary { … … 464 517 } 465 518 519 =head2 find_next_numeric_id ($base, $field, $min, $max) 520 521 Find next free uniq id for attribute C<$field> 522 523 =cut 524 466 525 sub find_next_numeric_id { 467 526 my ($class, $base, $field, $min, $max) = @_; … … 491 550 } 492 551 552 =head2 text_dump ($handle, $options, $base) 553 554 Dump object into C<$handle> 555 556 =cut 557 493 558 sub text_dump { 494 559 my ($self, $handle, $options, $base) = @_; … … 496 561 return 1; 497 562 } 563 564 =head2 dump 565 566 Return dump for tihs object 567 568 =cut 498 569 499 570 sub dump { … … 550 621 __END__ 551 622 552 =head1 CANICALS FIELDS553 554 =head2 User class555 556 =head2 Group class557 623 558 624 =head1 SEE ALSO 559 625 560 Mention other useful documentation such as the documentation of 561 related modules or operating system documentation (such as man pages 562 in UNIX), or any relevant external documentation such as RFCs or 563 standards. 564 565 If you have a mailing list set up for your module, mention it here. 566 567 If you have a web site set up for your module, mention it here. 626 L<LATMOS::Accounts::Bases> 568 627 569 628 =head1 AUTHOR -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r983 r1023 60 60 $self->{_db} && $self->{_db}->rollback; 61 61 } 62 63 =head2 db 64 65 Return a L<DBI> handle over database, load it if need. 66 67 =cut 62 68 63 69 sub db { … … 84 90 $self->{_db}->do(q{set DATESTYLE to 'DMY'}); 85 91 $self->log(LA_DEBUG, 'New connection to DB'); 92 $self->{_db}->commit; 86 93 return $self->{_db}; 87 94 } … … 153 160 } 154 161 155 156 # Extra non standard functions 162 =head1 SPECIFICS FUNCTIONS 163 164 =head2 get_global_value ($varname) 165 166 Return global value set into base 167 168 =cut 157 169 158 170 sub get_global_value { … … 167 179 $res->{val} 168 180 } 181 182 =head2 set_global_value ($varname, $value) 183 184 Set global value. 185 186 =cut 169 187 170 188 sub set_global_value { … … 181 199 } 182 200 201 =head2 generate_rsa_key ($password) 202 203 Return public and private peer rsa keys 204 205 =cut 206 183 207 sub generate_rsa_key { 184 208 my ($self, $password) = @_; … … 195 219 } 196 220 221 =head2 private_key ($password) 222 223 Load and return private rsa key 224 225 =cut 226 197 227 sub private_key { 198 228 my ($self, $password) = @_; … … 204 234 $privkey 205 235 } 236 237 =head2 get_rsa_password 238 239 Return hash with peer username => encryptedPassword 240 241 =cut 206 242 207 243 sub get_rsa_password { … … 221 257 } 222 258 259 =head2 store_rsa_key ($public, $private) 260 261 Store public and private RSA key info data base 262 263 =cut 264 223 265 sub store_rsa_key { 224 266 my ($self, $public, $private) = @_; … … 231 273 } 232 274 275 =head2 find_next_expire_users ($expire) 276 277 Search user expiring in C<$expire> delay 278 279 =cut 233 280 234 281 sub find_next_expire_users { … … 252 299 } 253 300 301 =head2 find_expired_users ($expire) 302 303 Return list of user going to expires in C<$expire> delay 304 305 =cut 306 254 307 sub find_expired_users { 255 308 my ($self, $expire) = @_; … … 271 324 } 272 325 326 =head2 rename_nethost ($nethostname, $to, %options) 327 328 Facility function to rename computer to new name 329 330 =cut 331 273 332 sub rename_nethost { 274 333 my ($self, $nethostname, $to, %options) = @_; … … 287 346 return 1; 288 347 } 348 349 =head2 nethost_exchange_ip ($ip1, $ip2) 350 351 Exchange ip1 with ip2 in base 352 353 =cut 289 354 290 355 sub nethost_exchange_ip { … … 316 381 } 317 382 383 =head1 ATTRIBUTES FUNCTIONS 384 385 =head2 register_attribute ($otype, $attribute, $comment) 386 387 Register a new attribute in base 388 389 =cut 390 318 391 sub register_attribute { 319 392 my ($self, $otype, $attribute, $comment) = @_; … … 322 395 } 323 396 397 =head2 is_registered_attribute ($otype, $attribute) 398 399 Return true is attribute already exists 400 401 =cut 402 324 403 sub is_registered_attribute { 325 404 my ($self, $otype, $attribute) = @_; … … 328 407 } 329 408 409 =head2 get_attribute_comment ($otype, $attribute) 410 411 Return the comment associated to attribute 412 413 =cut 414 330 415 sub get_attribute_comment { 331 416 my ($self, $otype, $attribute) = @_; … … 334 419 } 335 420 421 =head2 set_attribute_comment ($otype, $attribute, $comment) 422 423 Set comment to attribute 424 425 =cut 426 336 427 sub set_attribute_comment { 337 428 my ($self, $otype, $attribute, $comment) = @_; … … 340 431 } 341 432 342 sub check_user_manager {433 sub _check_user_manager { 343 434 $_[0]->_handle_by_unexported('user', 'manager', 'active'); 344 435 } 345 436 346 sub check_group_manager {437 sub _check_group_manager { 347 438 $_[0]->_handle_by_unexported('group', 'managedBy'); 348 439 } 349 440 350 sub check_nethost_owner {441 sub _check_nethost_owner { 351 442 $_[0]->_handle_by_unexported('nethost', 'owner', 'active'); 352 443 } … … 372 463 } 373 464 465 =head2 get_datarequest ($id) 466 467 Return user request C<$id> 468 469 =cut 470 374 471 sub get_datarequest { 375 472 my ($self, $id) = @_; … … 388 485 } 389 486 487 =head2 list_requests 488 489 List user request currently waiting in base 490 491 =cut 492 390 493 sub list_requests { 391 494 my ($self) = @_; … … 404 507 @ids 405 508 } 509 510 =head2 list_pending_requests 511 512 List user request to apply 513 514 =cut 406 515 407 516 sub list_pending_requests { … … 422 531 @ids 423 532 } 533 534 =head2 list_auto_pending_requests 535 536 List automatic request 537 538 =cut 424 539 425 540 sub list_auto_pending_requests { -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Accreq.pm
r1014 r1023 95 95 } 96 96 97 =head2 parse_form 98 99 Load C<form> attribute and return reference to data read from YAML data 100 101 =cut 102 97 103 sub parse_form { 98 104 my ($self) = @_; … … 102 108 return { attrs => [] }; 103 109 } 104 }105 106 sub attr_info {107 my ($self, $wanted_attr) = @_;108 109 my $ref = $self->parse_form;110 111 my @attrs = @{ $ref->{attrs} };112 while (my $attr = shift(@attrs)) {113 my $attrname = ref $attr114 ? $attr->{name}115 : $attr;116 if ($wanted_attr eq $attrname) {117 if (ref $attr) {118 return $attr;119 } else {120 return;121 }122 }123 }124 return;125 110 } 126 111 … … 146 131 } 147 132 133 =head2 attr_info($attr) 134 135 Return information for attribute C<$attr> from form. 136 137 =cut 138 139 sub attr_info { 140 my ($self, $wanted_attr) = @_; 141 142 my $ref = $self->parse_form; 143 144 my @attrs = @{ $ref->{attrs} }; 145 while (my $attr = shift(@attrs)) { 146 my $attrname = ref $attr 147 ? $attr->{name} 148 : $attr; 149 if ($wanted_attr eq $attrname) { 150 if (ref $attr) { 151 return $attr; 152 } else { 153 return; 154 } 155 } 156 } 157 return; 158 } 159 160 148 161 1; 149 162 … … 151 164 152 165 =head1 SEE ALSO 166 167 L<LATMOS::Accounts::Bases::Sql> 153 168 154 169 =head1 AUTHOR -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Address.pm
r1014 r1023 11 11 =head1 NAME 12 12 13 LATMOS::Ad - Perl extension for blah blah blah 14 15 =head1 SYNOPSIS 16 17 use LATMOS::Accounts::Bases; 18 my $base = LATMOS::Accounts::Bases->new('sql'); 19 ... 13 LATMOS::Accounts::Bases::Sql::Address - Physical office Adress Support 20 14 21 15 =head1 DESCRIPTION 22 16 23 Account base access over standard unix file format.17 C<Address> objects allow to store user's several office addresses. 24 18 25 =head1 FUNCTIONS 26 27 =cut 28 29 =head2 new(%options) 30 31 Create a new LATMOS::Ad object for windows AD $domain. 32 33 domain / server: either the Ad domain or directly the server 34 35 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 19 Notice most of other bases (Ldap, ...) support only one address. 36 20 37 21 =cut … … 174 158 =head1 SEE ALSO 175 159 160 L<LATMOS::Accounts::Bases::Sql> 161 162 L<LATMOS::Accounts::Bases::Sql::Onlyaddress> 163 176 164 =head1 AUTHOR 177 165 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Aliases.pm
r1014 r1023 12 12 =head1 NAME 13 13 14 LATMOS::Ad - Perl extension for blah blah blah 15 16 =head1 SYNOPSIS 17 18 use LATMOS::Accounts::Bases; 19 my $base = LATMOS::Accounts::Bases->new('sql'); 20 ... 21 22 =head1 DESCRIPTION 23 24 Account base access over standard unix file format. 25 26 =head1 FUNCTIONS 27 28 =cut 29 30 =head2 new(%options) 31 32 Create a new LATMOS::Ad object for windows AD $domain. 33 34 domain / server: either the Ad domain or directly the server 35 36 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 14 LATMOS::Accounts::Bases::Sql::Aliases - Mail alias object 37 15 38 16 =cut … … 175 153 =head1 SEE ALSO 176 154 155 L<LATMOS::Accounts::Bases::Sql> 156 157 L<LATMOS::Accounts::Bases::Sql::Revaliases> 158 177 159 =head1 AUTHOR 178 160 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/DataRequest.pm
r1011 r1023 12 12 =head1 NAME 13 13 14 LATMOS::Accounts::Bases::Sql::DataRequest14 LATMOS::Accounts::Bases::Sql::DataRequest - Object modification request 15 15 16 16 =head1 DESCRIPTION … … 40 40 } 41 41 42 =head2 ar_id 43 44 Return the id of this form 45 46 =cut 47 42 48 sub ar_id { $_[0]->{id} } 43 49 … … 48 54 sub otype { $_[0]->accreq->get_attributes('oType') } 49 55 50 =head2 attributes 56 =head2 attributes ($attr) 57 58 Return the value for attributes C<$attr> of attached C<Accreq>. 59 60 Return attr 51 61 52 62 =cut … … 55 65 $_[0]->accreq->get_attributes('attributes') 56 66 } 67 68 =head2 attribute_info ($attr) 69 70 Return information for attribute C<$attr> of attached C<Accreq>. 71 72 =cut 57 73 58 74 sub attribute_info { … … 60 76 $self->accreq->attr_info($attr); 61 77 } 78 79 =head2 oobject 80 81 Return object attached to this form if any 82 83 =cut 62 84 63 85 sub oobject { … … 70 92 } 71 93 94 =head2 set_ptr_object ($ptr) 95 96 Set the name of attached object, C<$ptr> can either the object name, either the 97 object itself. 98 99 =cut 100 72 101 sub set_ptr_object { 73 102 my ($self, $ptr) = @_; … … 80 109 } 81 110 111 =head2 is_for_new_object 112 113 Return true if the form is about object creation 114 115 =cut 116 82 117 sub is_for_new_object { 83 118 my ($self) = @_; … … 102 137 } 103 138 139 =head2 object_name 140 141 Return the name of attached object 142 143 =cut 144 104 145 sub object_name { 105 146 my ($self) = @_; … … 110 151 } 111 152 153 =head2 user 154 155 Return the user id submiting the request if any 156 157 =cut 158 112 159 sub user { 113 160 my ($self) = @_; … … 115 162 return ($self->_infos || {})->{user}; 116 163 } 164 165 =head2 o_user 166 167 Return the user object, see L</user> 168 169 =cut 117 170 118 171 sub o_user { … … 123 176 } 124 177 178 =head2 apply 179 180 Return the date the form must be validated 181 182 =cut 183 125 184 sub apply { 126 185 my ($self) = @_; … … 129 188 } 130 189 190 =head2 due 191 192 =cut 193 131 194 sub due { 132 195 my ($self) = @_; … … 135 198 } 136 199 200 =head2 automated 201 202 Return true if form is an automated one 203 204 =cut 205 137 206 sub automated { 138 207 my ($self) = @_; … … 141 210 } 142 211 212 =head2 objrev 213 214 Return the object revision at form registration 215 216 =cut 217 143 218 sub objrev { 144 219 my ($self) = @_; … … 146 221 return ($self->_infos || {})->{objrev}; 147 222 } 223 224 =head2 register ($options, %info) 225 226 Register the form. C<%info> must contains submitted informations. 227 228 C<$options> is a hashref where 229 230 =over 4 231 232 =item user 233 234 The username registering this form 235 236 =item auto 237 238 The form must automatically be validated 239 240 =item apply 241 242 The date the form must be validated 243 244 =back 245 246 =cut 148 247 149 248 sub register { … … 225 324 } 226 325 326 =head2 notify 327 328 Send mail when registering 329 330 =cut 331 227 332 sub notify { 228 333 my ($self) = @_; … … 289 394 } 290 395 } 396 397 =head2 get_values 398 399 Return hash with registering value 400 401 =cut 291 402 292 403 sub get_values { … … 330 441 } 331 442 443 =head2 register_discard ($comment) 444 445 Discard the form 446 447 =cut 448 332 449 sub register_discard { 333 450 my ($self, $comment) = @_; … … 356 473 } 357 474 475 =head2 unset_auto 476 477 Set the form has no longer automatic 478 479 =cut 480 358 481 sub unset_auto { 359 482 my ($self) = @_; … … 364 487 return $sth->execute($self->ar_id); 365 488 } 489 490 =head2 auto_apply_to_object ($comment) 491 492 Apply modification automatically 493 494 =cut 366 495 367 496 sub auto_apply_to_object { … … 386 515 $self->apply_to_object($comment); 387 516 } 517 518 =head2 apply_to_object ($comment, %attrs) 519 520 Apply modification to the object, C<%attrs> overload informations from forms. 521 522 =cut 388 523 389 524 sub apply_to_object { … … 523 658 =head1 SEE ALSO 524 659 660 L<LATMOS::Accounts::Bases::Sql>, L<LATMOS::Accounts::Bases::Sql::Accreq> 661 525 662 =head1 AUTHOR 526 663 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm
r1014 r1023 12 12 =head1 NAME 13 13 14 LATMOS::Ad - Perl extension for blah blah blah 15 16 =head1 SYNOPSIS 17 18 use LATMOS::Accounts::Bases; 19 my $base = LATMOS::Accounts::Bases->new('sql'); 20 ... 21 22 =head1 DESCRIPTION 23 24 Account base access over standard unix file format. 25 26 =head1 FUNCTIONS 27 28 =cut 29 30 =head2 new(%options) 31 32 Create a new LATMOS::Ad object for windows AD $domain. 33 34 domain / server: either the Ad domain or directly the server 35 36 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 14 LATMOS::Accounts::Bases::Sql::Group - Groups objects support 37 15 38 16 =cut … … 181 159 =head1 SEE ALSO 182 160 161 L<LATMOS::Accounts::Bases::Sql> 162 183 163 =head1 AUTHOR 184 164 … … 193 173 at your option, any later version of Perl 5 you may have available. 194 174 195 196 175 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Nethost.pm
r1014 r1023 12 12 =head1 NAME 13 13 14 LATMOS::Ad - Perl extension for blah blah blah 15 16 =head1 SYNOPSIS 17 18 use LATMOS::Accounts::Bases; 19 my $base = LATMOS::Accounts::Bases->new('sql'); 20 ... 21 22 =head1 DESCRIPTION 23 24 Account base access over standard unix file format. 25 26 =head1 FUNCTIONS 27 28 =cut 29 30 =head2 new(%options) 31 32 Create a new LATMOS::Ad object for windows AD $domain. 33 34 domain / server: either the Ad domain or directly the server 35 36 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 14 LATMOS::Accounts::Bases::Sql::Nethost - A Network Host entry 37 15 38 16 =cut … … 188 166 =head1 SEE ALSO 189 167 168 L<LATMOS::Accounts::Bases::Sql::Netzones>, L<LATMOS::Accounts::Bases::Sql> 169 190 170 =head1 AUTHOR 191 171 … … 194 174 =head1 COPYRIGHT AND LICENSE 195 175 196 Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS176 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 197 177 198 178 This library is free software; you can redistribute it and/or modify -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Netzone.pm
r1014 r1023 11 11 =head1 NAME 12 12 13 LATMOS::Ad - Perl extension for blah blah blah 14 15 =head1 SYNOPSIS 16 17 use LATMOS::Accounts::Bases; 18 my $base = LATMOS::Accounts::Bases->new('sql'); 19 ... 13 LATMOS::Accounts::Bases::Sql::Netzone - Network management 20 14 21 15 =head1 DESCRIPTION 22 16 23 Account base access over standard unix file format. 24 25 =head1 FUNCTIONS 26 27 =cut 28 29 =head2 new(%options) 30 31 Create a new LATMOS::Ad object for windows AD $domain. 32 33 domain / server: either the Ad domain or directly the server 34 35 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 17 The C<Netzone> object handle information for dns or dhcp management. 36 18 37 19 =cut … … 194 176 =head1 SEE ALSO 195 177 178 L<LATMOS::Accounts::Bases::Sql> 179 L<LATMOS::Accounts::Bases::Sql::Nethost> 180 196 181 =head1 AUTHOR 197 182 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/OCHelper/Accreq.pm
r1012 r1023 5 5 =head1 NAME 6 6 7 8 7 LATMOS::Accounts::Bases::Sql::OCHelper::User - Helper to create accreq 8 object 9 9 10 10 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Onlyaddress.pm
r1014 r1023 7 7 8 8 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 9 10 =head1 NAME 11 12 LATMOS::Accounts::Bases::Sql::Onlyaddress - Secondary office Address support SQL base 13 14 =head1 DESCRIPTION 15 16 This module handle object for office address, allowing to support multiple 17 address per people. 18 19 =cut 9 20 10 21 sub list { … … 78 89 79 90 1; 91 92 __END__ 93 94 =head1 SEE ALSO 95 96 L<LATMOS::Accounts::Bases::Sql> 97 98 L<LATMOS::Accounts::Bases::Sql::Address> 99 100 =head1 AUTHOR 101 102 Thauvin Olivier, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 103 104 =head1 COPYRIGHT AND LICENSE 105 106 Copyright (C) 2009, 2010, 2011, 2012 by Thauvin Olivier 107 108 This library is free software; you can redistribute it and/or modify 109 it under the same terms as Perl itself, either Perl version 5.10.0 or, 110 at your option, any later version of Perl 5 you may have available. 111 112 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Revaliases.pm
r1014 r1023 72 72 =head1 SEE ALSO 73 73 74 L<LATMOS::Accounts::Bases::Sql::Aliases>, L<LATMOS::Accounts::Bases::Sql> 75 74 76 =head1 AUTHOR 75 77 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Site.pm
r1014 r1023 11 11 =head1 NAME 12 12 13 LATMOS::Ad - Perl extension for blah blah blah 14 15 =head1 SYNOPSIS 16 17 use LATMOS::Accounts::Bases; 18 my $base = LATMOS::Accounts::Bases->new('sql'); 19 ... 13 LATMOS::Accounts::Bases::Sql::Site - Common Location/Address object 20 14 21 15 =head1 DESCRIPTION 22 16 23 Account base access over standard unix file format. 24 25 =head1 FUNCTIONS 26 27 =cut 28 29 =head2 new(%options) 30 31 Create a new LATMOS::Ad object for windows AD $domain. 32 33 domain / server: either the Ad domain or directly the server 34 35 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 17 Store common to many people office address (typically building location). 36 18 37 19 =cut … … 86 68 =head1 SEE ALSO 87 69 70 L<LATMOS::Accounts::Bases::Sql> 71 88 72 =head1 AUTHOR 89 73 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Sutype.pm
r1014 r1023 11 11 =head1 NAME 12 12 13 LATMOS::Ad - Perl extension for blah blah blah 14 15 =head1 SYNOPSIS 16 17 use LATMOS::Accounts::Bases; 18 my $base = LATMOS::Accounts::Bases->new('sql'); 19 ... 13 LATMOS::Accounts::Bases::Sql::Sutype - Structural type 20 14 21 15 =head1 DESCRIPTION 22 16 23 Account base access over standard unix file format. 24 25 =head1 FUNCTIONS 26 27 =cut 28 29 =head2 new(%options) 30 31 Create a new LATMOS::Ad object for windows AD $domain. 32 33 domain / server: either the Ad domain or directly the server 34 35 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 17 Type for groups. 36 18 37 19 =cut … … 49 31 =head1 SEE ALSO 50 32 33 L<LATMOS::Accounts::Bases::Sql> 34 51 35 =head1 AUTHOR 52 36 … … 55 39 =head1 COPYRIGHT AND LICENSE 56 40 57 Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS41 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 58 42 59 43 This library is free software; you can redistribute it and/or modify -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r1015 r1023 14 14 =head1 NAME 15 15 16 LATMOS::Ad - Perl extension for blah blah blah 17 18 =head1 SYNOPSIS 19 20 use LATMOS::Accounts::Bases; 21 my $base = LATMOS::Accounts::Bases->new('unix'); 22 ... 23 24 =head1 DESCRIPTION 25 26 Account base access over standard unix file format. 27 28 =cut 29 30 =head1 FUNCTIONS 31 32 =cut 33 34 =head2 new(%options) 35 36 Create a new LATMOS::Ad object for windows AD $domain. 37 38 domain / server: either the Ad domain or directly the server 39 40 ldap_args is an optionnal list of arguments to pass to L<Net::LDAP>. 16 LATMOS::Accounts::Bases::Sql::objects - Parent class for SQL object 41 17 42 18 =cut … … 242 218 } 243 219 220 =head2 db 221 222 Return reference to L<DBI> object. 223 224 =cut 225 244 226 sub db { 245 227 return $_[0]->base->db; 246 228 } 247 229 248 sub quote__object_table {230 sub _quote_object_table { 249 231 my ($self) = @_; 250 232 my $table = $self->_object_table or return; 251 233 $self->db->quote_identifier($table); 252 234 } 253 sub quote__key_field {235 sub _quote_key_field { 254 236 my ($self) = @_; 255 237 my $key_field = $self->_key_field or return; … … 268 250 q{select %s from %s where %s = ?}, 269 251 $self->db->quote_identifier(lc($field)), 270 $self-> quote__object_table,271 $self-> quote__key_field,252 $self->_quote_object_table, 253 $self->_quote_key_field, 272 254 ) 273 255 ); … … 332 314 sprintf( 333 315 q{update %s set %s where %s = ?}, 334 $self-> quote__object_table,316 $self->_quote_object_table, 335 317 join(', ', @fields), 336 $self-> quote__key_field,318 $self->_quote_key_field, 337 319 ) 338 320 ); … … 616 598 } 617 599 600 =head2 register_attribute 601 602 Register attribute into base 603 604 =cut 605 618 606 sub register_attribute { 619 607 my ($class, $base, $attribute, $comment) = @_; … … 632 620 } 633 621 622 =head2 is_registered_attribute ($base, $attribute) 623 624 Return true is attribute is registered into base 625 626 =cut 627 634 628 sub is_registered_attribute { 635 629 my ($class, $base, $attribute) = @_; … … 645 639 return $res ? 1 : 0; 646 640 } 641 642 =head2 get_attribute_comment $base, $attribute) 643 644 Return comment for C<$attribute> 645 646 =cut 647 648 # TODO: get_attribute_comment($attr, $base) { $base ||= $self->base ... 647 649 648 650 sub get_attribute_comment { … … 667 669 } 668 670 671 =head2 set_attribute_comment ($base, $attribute, $comment) 672 673 Set comment to attribute 674 675 =cut 676 669 677 sub set_attribute_comment { 670 678 my ($class, $base, $attribute, $comment) = @_; … … 697 705 =head1 SEE ALSO 698 706 707 L<LATMOS::Accounts::Bases::Sql> 708 709 L<LATMOS::Accounts::Bases::Objects> 710 699 711 =head1 AUTHOR 700 712 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Unix/User.pm
r965 r1023 145 145 =head1 SEE ALSO 146 146 147 L<LATMOS::Accounts::Base::Unix> 148 147 149 =head1 AUTHOR 148 150 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/BuildNet.pm
r921 r1023 15 15 use Net::IPv4Addr; 16 16 use Net::IPv6Addr; 17 18 =head1 NAME 19 20 LATMOS::Accounts::BuildNet - Generate config file from C<Netzone> Object 21 22 =head1 DESCRIPTION 23 24 This contains functions to generate network config file from C<Netzone> and 25 C<Nethost> object. 26 27 These config file can be: 28 29 =over 4 30 31 =item DNS zone files 32 33 A standard DNS zone generated from a header and entries found in bases 34 35 =item DNS reverse zone files 36 37 A reverse DNS zone genarated from a header and entries found in bases 38 39 =item A DHCP host list 40 41 A file well formated host list to be included in dhcpd config file. 42 43 =back 44 45 =cut 17 46 18 47 sub _base { … … 46 75 } 47 76 48 sub write_state_file {77 sub _write_state_file { 49 78 la_log(LA_DEBUG, "Writting status file"); 50 79 $_[0]->_bnet_state->RewriteConfig; 51 80 } 81 82 =head2 gen_all 83 84 Generate all zone file found in base 85 86 =cut 52 87 53 88 sub gen_all { … … 125 160 } 126 161 162 =head2 get_zone_rev ($zone) 163 164 Return next zone revision (DNS). 165 166 This revision is formated from date + incremental serial number. If day change, 167 serial start to 1. If serial goes goes over 99, head build from date is 168 increment. 169 170 The code ensure returned number is always highter that current one. 171 172 =cut 173 127 174 sub get_zone_rev { 128 175 my ($self, $ozone) = @_; … … 197 244 return $textzone; 198 245 } 246 247 =head2 gen_zone($zone, $header) 248 249 Generate zone file C<$zone> with header C<$header> 250 251 =cut 252 253 # TODO what is $header 199 254 200 255 sub gen_zone { … … 241 296 $ozone->id, 'dbrev', 242 297 scalar(localtime)); 243 $self-> write_state_file;298 $self->_write_state_file; 244 299 245 300 } else { … … 682 737 683 738 1; 739 740 __END__ 741 742 =head1 AUTHOR 743 744 Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt> 745 746 =head1 COPYRIGHT AND LICENSE 747 748 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 749 750 This library is free software; you can redistribute it and/or modify 751 it under the same terms as Perl itself, either Perl version 5.10.0 or, 752 at your option, any later version of Perl 5 you may have available. 753 754 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Cli.pm
r861 r1023 11 11 use Getopt::Long; 12 12 13 =head1 NAME 14 15 LATMOS::Accounts::Cli - Command line interface functions 16 17 =head1 DESCRIPTION 18 19 This module handle envirronment and functons for L<la-cli> tools. 20 21 =cut 22 13 23 { 14 24 open (my $fh, "/dev/tty" ) … … 23 33 24 34 my $trans_mode = 0; 35 36 =head1 FUNCTIONS 37 38 =cut 39 40 =head2 globalenv 41 42 Return the main envirronement object 43 44 =cut 25 45 26 46 sub globalenv { … … 219 239 return $env 220 240 } 241 242 =head2 objenv ($labase, $otype, @objs) 243 244 Return a C<cli> envirronment over object. 245 246 =cut 221 247 222 248 sub objenv { … … 661 687 } 662 688 689 =head1 OBJECT FUNCTIONS 690 691 =head2 new ($env, $labase) 692 693 Create an envirronment object. 694 695 C<$env> is functions descriptions. 696 697 =cut 698 663 699 sub new { 664 700 my ($class, $env, $labase) = @_; … … 722 758 } 723 759 760 =head2 base 761 762 Return the attached base object. 763 764 =cut 765 724 766 sub base { $_[0]->{_labase} } 767 768 =head2 cli 769 770 Start the main loop 771 772 =cut 725 773 726 774 sub cli { … … 741 789 } 742 790 791 =head2 prompt 792 793 Wait user to input command 794 795 =cut 796 743 797 sub prompt { 744 798 my ($self) = @_; … … 750 804 } 751 805 806 =head2 add_func ($name, $param) 807 808 Add new function in the envirronment 809 810 =cut 811 812 # TODO: hide this 813 752 814 sub add_func { 753 815 my ($self, $name, $param) = @_; 754 816 $self->{funcs}{$name} = $param; 755 817 } 818 819 =head2 getoption ($opt, @args) 820 821 Parse commmand line 822 823 =cut 824 825 # TODO: hide this 756 826 757 827 sub getoption { … … 764 834 } 765 835 766 sub parse_arg { 836 # TODO: useless ? 837 838 sub _parse_arg { 767 839 my ($self, $name, @args) = @_; 768 840 return @args; 769 841 } 842 843 =head2 complete 844 845 Return possible words according current entered words 846 847 =cut 770 848 771 849 sub complete { … … 777 855 $self->complete($lastw, @{$self->{funcs}{$name}{alias}}, @args); 778 856 } elsif ($self->{funcs}{$name}{completion}) { 779 my @pargs = $self-> parse_arg($name, @args);857 my @pargs = $self->_parse_arg($name, @args); 780 858 return map { my $t = $_; $t =~ s/\s/\\ /g; $t } grep { $_ && /^\Q$lastw\E/ } $self->{funcs}{$name}{completion}->($self, $lastw, @pargs); 781 859 } else { … … 783 861 } 784 862 } 863 864 =head2 run ($name, @args) 865 866 Run functions 867 868 =cut 785 869 786 870 sub run { … … 792 876 $self->run(@{$self->{funcs}{$name}{alias}}, @args); 793 877 } elsif ($self->{funcs}{$name}{code}) { 794 my @pargs = $self-> parse_arg($name, @args);878 my @pargs = $self->_parse_arg($name, @args); 795 879 $self->{funcs}{$name}{code}->($self, @args); 796 880 } else { … … 798 882 } 799 883 } 884 885 =head2 commit 886 887 Call commit to base unelss in transaction mode 888 889 =cut 800 890 801 891 sub commit { … … 812 902 } 813 903 904 =head2 rollback 905 906 Perform rollback unless in transaction mode 907 908 =cut 909 814 910 sub rollback { 815 911 my ($self) = @_; … … 826 922 827 923 1; 924 925 __END__ 926 927 =head1 SEE ALSO 928 929 L<LATMOS::Accounts> 930 931 =head1 AUTHOR 932 933 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 934 935 =head1 COPYRIGHT AND LICENSE 936 937 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 938 939 This library is free software; you can redistribute it and/or modify 940 it under the same terms as Perl itself, either Perl version 5.10.0 or, 941 at your option, any later version of Perl 5 you may have available. 942 943 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Maintenance.pm
r1014 r1023 10 10 11 11 LATMOS::Accounts::Maintenance 12 13 =head1 FUNCTIONS 12 14 13 15 =cut … … 20 22 return $self->{_maintenance_base} = $base 21 23 } 24 25 =head2 find_next_expire_users ($expire) 26 27 Return The list of users going to expire in C<$expire> delay. 28 29 =cut 22 30 23 31 sub find_next_expire_users { … … 155 163 } 156 164 165 =head2 find_expired_users ($expire) 166 167 See L<LATMOS::Accounts::Base/find_expired_users> 168 169 =cut 170 157 171 sub find_expired_users { 158 172 my ($self, $expire) = @_; 159 173 $self->_base->find_expired_users($expire); 160 174 } 175 176 =head2 expired_account_reminder ( %options) 177 178 Search account expired for more than C<$options{delay}> (default is 6 month) 179 send mail to manager and summary to admin to aknoledge destruction. 180 181 =cut 161 182 162 183 sub expired_account_reminder { … … 240 261 241 262 1; 263 264 __END__ 265 266 =head1 SEE ALSO 267 268 L<LATMOS::Accounts::Bases> 269 270 =head1 AUTHOR 271 272 Thauvin Olivier, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 273 274 =head1 COPYRIGHT AND LICENSE 275 276 Copyright (C) 2009, 2010, 2011, 2012 by Thauvin Olivier 277 278 This library is free software; you can redistribute it and/or modify 279 it under the same terms as Perl itself, either Perl version 5.10.0 or, 280 at your option, any later version of Perl 5 you may have available. 281 282 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/SyncManager.pm
r1017 r1023 5 5 use LATMOS::Accounts::Log; 6 6 use LATMOS::Accounts; 7 8 =head1 NAME 9 10 LATMOS::Accounts::SyncManager - Routine task manager 11 12 =head1 DESCRIPTION 13 14 Handle Task process run by L<la-sync-manager> 15 16 =head1 FUNCTIONS 17 18 =cut 19 20 =head2 new($config) 21 22 Instaciate object. 23 24 C<$config> is a path to an alternative configuration file to default one. 25 26 =cut 7 27 8 28 sub new { … … 24 44 } 25 45 46 =head2 ini 47 48 Return a reference to the L<Ini::Files> object handling configuration. 49 50 =cut 51 26 52 sub ini { $_[0]->{ini} } 27 53 54 =head2 dbrev 55 56 Return the current base revision 57 58 =cut 59 28 60 sub dbrev { $_[0]->{lastrev} } 61 62 =head2 updrev 63 64 Update status file with with current base revision as restart point 65 66 =cut 29 67 30 68 sub updrev { … … 37 75 } 38 76 77 =head2 list_modules 78 79 List configured task module 80 81 =cut 82 39 83 sub list_modules { 40 84 my ($self) = @_; 41 85 $self->ini->Sections; 42 86 } 87 88 =head2 process_module($module, $dbrev) 89 90 Process C<$module>. 91 92 =cut 93 94 # TODO what is $dbrev, why is it need here ?? 43 95 44 96 sub process_module { … … 90 142 91 143 1; 144 145 __END__ 146 147 =head1 SEE ALSO 148 149 L<LATMOS::Accountsi::Task> 150 151 =head1 AUTHOR 152 153 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 154 155 =head1 COPYRIGHT AND LICENSE 156 157 Copyright (C) 2012 CNRS SA/CETP/LATMOS 158 159 This library is free software; you can redistribute it and/or modify 160 it under the same terms as Perl itself, either Perl version 5.10.0 or, 161 at your option, any later version of Perl 5 you may have available. 162 163 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/SynchAccess.pm
r619 r1023 8 8 9 9 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 10 11 =head1 NAME 12 13 LATMOS::Accounts::SynchAccess 14 15 =head1 FUNCTIONS 16 17 =cut 18 19 # TODO WTF is difference with LATMOS::Accounts::SynchAccess::base 20 21 =head2 get_object ($otype, $uid) 22 23 Compatibility function: return a set of object for which action must be done. 24 25 =cut 10 26 11 27 sub get_object { … … 33 49 34 50 __END__ 51 52 =head1 AUTHOR 53 54 Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt> 55 56 =head1 COPYRIGHT AND LICENSE 57 58 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 59 60 This library is free software; you can redistribute it and/or modify 61 it under the same terms as Perl itself, either Perl version 5.10.0 or, 62 at your option, any later version of Perl 5 you may have available. 63 64 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/SynchAccess/Objects.pm
r56 r1023 7 7 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 8 8 9 =head1 NAME 10 11 LATMOS::Accounts::SynchAccess::Object - Fake object for sync access 12 13 =head1 DESCRIPTION 14 15 This module fake an object to send same actions tu multiple base. This is 16 used for actions basic synchronisation process cannot handle. 17 18 =cut 19 9 20 1; 10 21 11 22 __END__ 23 24 =head1 SEE ALSO 25 26 L<LATMOS::Accounts>, L<LATMOS::Accounts::Bases> 27 28 =head1 AUTHOR 29 30 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 31 32 =head1 COPYRIGHT AND LICENSE 33 34 Copyright (C) 2012 CNRS SA/CETP/LATMOS 35 36 This library is free software; you can redistribute it and/or modify 37 it under the same terms as Perl itself, either Perl version 5.10.0 or, 38 at your option, any later version of Perl 5 you may have available. 39 40 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/SynchAccess/base.pm
r861 r1023 8 8 9 9 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 10 11 =head1 NAME 12 13 LATMOS::Accounts::SynchAccess::base - Fake base object for sync access 14 15 =head1 DESCRIPTION 16 17 This module fake a base object to send same actions tu multiple base. This is 18 used for actions basic synchronisation process cannot handle. 19 20 =head1 FUNCTIONS 21 22 =cut 10 23 11 24 sub AUTOLOAD { … … 21 34 } 22 35 36 =head2 new( \@bases ) 37 38 Create a new SynchAccess instance over given bases 39 40 =cut 41 23 42 sub new { 24 43 my ($class, $bases) = @_; … … 27 46 }, $class; 28 47 } 48 49 =head2 bases 50 51 Return lists of bases in ths instance. 52 53 =cut 29 54 30 55 sub bases { … … 77 102 78 103 __END__ 104 105 =head1 SEE ALSO 106 107 L<LATMOS::Accounts>, L<LATMOS::Accounts::Bases> 108 109 =head1 AUTHOR 110 111 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 112 113 =head1 COPYRIGHT AND LICENSE 114 115 Copyright (C) 2012 CNRS SA/CETP/LATMOS 116 117 This library is free software; you can redistribute it and/or modify 118 it under the same terms as Perl itself, either Perl version 5.10.0 or, 119 at your option, any later version of Perl 5 you may have available. 120 121 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm
r861 r1023 80 80 } 81 81 82 =head2 name 83 84 Return the name of this synchronisation 85 86 =cut 87 82 88 sub name { 83 89 $_[0]->{options}{name} 84 90 } 85 91 92 =head2 from 93 94 Return the base object source for this synchronisation 95 96 =cut 97 86 98 sub from { 87 99 my ($self) = @_; 88 100 return $self->{from} 89 101 } 102 103 =head2 to 104 105 Return the list of base destination for this synchronisation 106 107 =cut 90 108 91 109 sub to { … … 116 134 return $unloaded; 117 135 } 136 137 =head2 enter_synch_mode 138 139 Configure base for synchronisation 140 141 =cut 118 142 119 143 sub enter_synch_mode { … … 135 159 } 136 160 161 =head2 leave_synch_mode (%state) 162 163 Retore base to previous state 164 165 =cut 166 137 167 sub leave_synch_mode { 138 168 my ($self, %state) = @_; … … 144 174 } 145 175 } 176 177 =head2 lock 178 179 Create a lock to denied another synchronisation to run 180 181 =cut 146 182 147 183 sub lock { … … 161 197 } 162 198 199 =head2 unlock 200 201 Remove lock 202 203 =cut 204 163 205 sub unlock { 164 206 my ($self) = @_; … … 172 214 return; 173 215 } 216 217 =head2 sync_object ($otype, $uid, %options) 218 219 Synchronise object type C<$otype> named C<$uid> 220 221 =cut 174 222 175 223 sub sync_object { … … 202 250 } 203 251 } 252 253 =head2 process 254 255 Run the syncronisation 256 257 =cut 204 258 205 259 sub process { … … 314 368 } 315 369 370 =head2 write_status 371 372 Write savepoint file 373 374 =cut 375 316 376 sub write_status { 317 377 my ($self) = @_; … … 331 391 return 0; 332 392 } 393 394 =head2 run_pre_synchro 395 396 Run task done before synchronisation 397 398 =cut 333 399 334 400 sub run_pre_synchro { … … 360 426 } 361 427 428 =head2 run_post_synchro 429 430 Run task done after synchronisation 431 432 =cut 433 362 434 sub run_post_synchro { 363 435 my ($self, $env) = @_; -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Automatedrequest.pm
r987 r1023 8 8 use LATMOS::Accounts::Log; 9 9 use LATMOS::Accounts::Utils; 10 11 =head1 NAME 12 13 LATMOS::Accounts::Task::Automatedrequest - Task responsible of automatic request 14 validation 15 16 =cut 10 17 11 18 sub init { … … 38 45 39 46 1; 47 48 __END__ 49 50 =head1 SEE ALSO 51 52 L<LATMOS::Accounts::Bases::Sql>, L<LATMOS::Accounts::Bases::Sql::DataRequest> 53 54 =head1 AUTHOR 55 56 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 57 58 =head1 COPYRIGHT AND LICENSE 59 60 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 61 62 This library is free software; you can redistribute it and/or modify 63 it under the same terms as Perl itself, either Perl version 5.10.0 or, 64 at your option, any later version of Perl 5 you may have available. 65 66 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Basessynchro.pm
r861 r1023 6 6 use LATMOS::Accounts; 7 7 use LATMOS::Accounts::Log; 8 9 =head1 NAME 10 11 LATMOS::Accounts::Task::Basessynchro - Synchronize bases 12 13 =head1 DESCRIPTION 14 15 This module is responsible of the copy of object from main base to others 16 17 =cut 8 18 9 19 sub run { … … 38 48 39 49 1; 50 51 =head1 SEE ALSO 52 53 L<LATMOS::Accounts>, L<LATMOS::Accounts::Bases> 54 55 =head1 AUTHOR 56 57 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 58 59 =head1 COPYRIGHT AND LICENSE 60 61 Copyright (C) 2008, 2009 CNRS SA/CETP/LATMOS 62 63 This library is free software; you can redistribute it and/or modify 64 it under the same terms as Perl itself, either Perl version 5.10.0 or, 65 at your option, any later version of Perl 5 you may have available. 66 67 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildlistes.pm
r861 r1023 8 8 use LATMOS::Accounts::Log; 9 9 use LATMOS::Accounts::Utils; 10 11 =head1 NAME 12 13 LATMOS::Accounts::Task::Buildlistes - Task to generate list of mail address 14 usable by mail robot such as mailman. 15 16 =head1 DESCRITPTION 17 18 This module is designed to automatically build mailing list members file. The 19 configuration is handle by F<la-sync-list.ini> file. 20 21 =cut 10 22 11 23 sub init { … … 148 160 149 161 1; 162 163 =head1 SEE ALSO 164 165 Configuraiton file: L<la-sync-list.ini> 166 167 L<LATMOS::Accounts::Task> 168 169 =head1 AUTHOR 170 171 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 172 173 =head1 COPYRIGHT AND LICENSE 174 175 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 176 177 This library is free software; you can redistribute it and/or modify 178 it under the same terms as Perl itself, either Perl version 5.10.0 or, 179 at your option, any later version of Perl 5 you may have available. 180 181 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm
r861 r1023 5 5 use base qw(LATMOS::Accounts::Task); 6 6 use LATMOS::Accounts::BuildNet; 7 8 =head1 NAME 9 10 LATMOS::Accounts::Task::Buildnet - Task to generate network configuration files 11 12 =cut 7 13 8 14 # Always try because depend also on files: … … 22 28 23 29 1; 30 31 __END__ 32 33 =head1 SEE ALSO 34 35 L<LATMOS::Accounts::Task>, L<LATMOS::Accounts::BuildNet> 36 37 =head1 AUTHOR 38 39 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 40 41 =head1 COPYRIGHT AND LICENSE 42 43 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 44 45 This library is free software; you can redistribute it and/or modify 46 it under the same terms as Perl itself, either Perl version 5.10.0 or, 47 at your option, any later version of Perl 5 you may have available. 48 49 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Dummy.pm
r861 r1023 4 4 use warnings; 5 5 use base qw(LATMOS::Accounts::Task); 6 7 =head1 NAME 8 9 LATMOS::Accounts::Task::Dummy - A "do nothing" task for testing purpose 10 11 =head1 DESCRIPTION 12 13 When setup in L<la-sync-manager> this task simulate an activity by waiting 2 14 seconds and just exit successfully. 15 16 =cut 6 17 7 18 sub run { … … 11 22 12 23 1; 24 25 =head1 SEE ALSO 26 27 L<LATMOS::Accounts::Task> 28 29 =head1 AUTHOR 30 31 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 32 33 =head1 COPYRIGHT AND LICENSE 34 35 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 36 37 This library is free software; you can redistribute it and/or modify 38 it under the same terms as Perl itself, either Perl version 5.10.0 or, 39 at your option, any later version of Perl 5 you may have available. 40 41 =cut -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Refreshexpired.pm
r861 r1023 8 8 use LATMOS::Accounts::Log; 9 9 use LATMOS::Accounts::Utils; 10 11 =head1 NAME 12 13 LATMOS::Accounts::Task::Refreshexpired - Task to disable expired users 14 15 =head1 DESCRIPTION 16 17 Some base doesn't handle accounts expiration. One way to do it is to synchronize 18 user with value denying login (wrong UNIX shell, password entry set to false, 19 ...). 20 21 For performance issue, objects are not written at each synchronisation, only 22 when they changes. 23 24 This module find expired user and refresh modification time to ensure 25 propagation to other database. 26 27 =cut 10 28 11 29 sub init { … … 49 67 50 68 1; 69 70 __END__ 71 72 =head1 SEE ALSO 73 74 L<LATMOS::Accounts>, L<LATMOS::Accounts::Task> 75 76 =head1 AUTHOR 77 78 Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 79 80 =head1 COPYRIGHT AND LICENSE 81 82 Copyright (C) 2012 CNRS SA/CETP/LATMOS 83 84 This library is free software; you can redistribute it and/or modify 85 it under the same terms as Perl itself, either Perl version 5.10.0 or, 86 at your option, any later version of Perl 5 you may have available. 87 88 =cut 89 -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm
r959 r1023 11 11 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 12 12 13 =head1 NAME 14 15 LATMOS::Accounts::Utils - Utils functions 16 17 =head1 FUNCTIONS 18 19 =cut 20 13 21 @ISA = qw(Exporter); 14 22 @EXPORT = qw(to_ascii exec_command switch_user run_via_sudo); 15 23 @EXPORT_OK = qw(to_ascii exec_command switch_user run_via_sudo); 24 25 =head2 to_ascii($text) 26 27 Replace in C<$text> non ascii caracters from iso-8859-15 table to ascii 28 equivalent caracter. 29 30 =cut 16 31 17 32 sub to_ascii { … … 26 41 $text 27 42 } 43 44 =head2 exec_command($command, $env) 45 46 Execute C<$command> and redirect output to log system. 47 48 C<$env> is a hashref containing environment variable to set, all variables are 49 prefixed by 'LA_'. 50 51 =cut 28 52 29 53 sub exec_command { … … 80 104 } 81 105 106 =head2 parse_obj_file($handle) 107 108 Read file content from C<$handle> and return hash containing parsed attributes 109 110 =cut 111 82 112 sub parse_obj_file { 83 113 my ($handle) = @_; … … 107 137 } 108 138 139 =head2 dump_read_temp_file($writecb, $readcb) 140 141 Create a temporary file, call C<$writecb()> function, run editor and if file get 142 modified call C<$readcb>. 143 144 =cut 145 109 146 sub dump_read_temp_file { 110 147 my ($writecb, $readcb) = @_; … … 137 174 } 138 175 176 =head2 check_oid_validity($name) 177 178 Check C<$name> is suitable to be used as object identifier. Return the error 179 text, undef if no error. 180 181 =cut 182 139 183 sub check_oid_validity { 140 184 my ($name) = @_; … … 145 189 return; 146 190 } 191 192 =head2 check_ug_validity($name) 193 194 Check C<$name> is suitable to used as user or group identifier. 195 196 =cut 147 197 148 198 sub check_ug_validity { … … 157 207 return check_oid_validity($name); 158 208 } 209 210 =head2 switch_user($runas) 211 212 Switch effective id of the process to user named C<$runas> 213 214 =cut 159 215 160 216 sub switch_user { … … 173 229 } 174 230 231 =head2 run_via_sudo($runas) 232 233 Rerun current programme as C<$runas> user using sudo 234 235 =cut 236 175 237 sub run_via_sudo { 176 238 my ($runas) = @_; … … 186 248 187 249 1; 250 251 __END__ 252 253 =head1 SEE ALSO 254 255 L<sudo> 256 257 =head1 AUTHOR 258 259 Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt> 260 261 =head1 COPYRIGHT AND LICENSE 262 263 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 264 265 This library is free software; you can redistribute it and/or modify 266 it under the same terms as Perl itself, either Perl version 5.10.0 or, 267 at your option, any later version of Perl 5 you may have available. 268 269 =cut
Note: See TracChangeset
for help on using the changeset viewer.