- Timestamp:
- 03/17/15 18:31:05 (9 years ago)
- Location:
- branches/4.0
- Files:
-
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0
-
branches/4.0/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm
r1257 r1284 22 22 attrs => [ qw( 23 23 sn givenName description 24 comment 24 25 uid uidNumber gidNumber gecos homeDirectory loginShell 25 26 mail initials nickname … … 102 103 gidNumber 103 104 description label 105 comment 104 106 managedBy 105 107 managedAlsoBy … … 115 117 name 116 118 description 119 comment 117 120 serialNumber 118 121 encryptKey … … 162 165 forward 163 166 expire 167 description 168 comment 164 169 finalpoint 165 170 parents -
branches/4.0/LATMOS-Accounts/Makefile.PL
r1225 r1284 60 60 bin/la-sql-updsshfp 61 61 bin/la-test-mail 62 bin/la-sql-log 62 63 ) ], 63 64 macro => { -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r1135 r1284 637 637 } 638 638 639 sub getobjectlogs { 640 my ($self, $otype, $name) = @_; 641 642 my $sth = $self->db->prepare(q{ 643 select ikey from objectslogs where 644 otype = ? and 645 name = ? 646 group by ikey 647 }); 648 $sth->execute($otype, $name); 649 my @ids; 650 while (my $res = $sth->fetchrow_hashref) { 651 push(@ids, $res->{ikey}); 652 } 653 @ids or return; 654 655 my $sth2 = $self->db->prepare(sprintf( 656 q{ 657 select * from objectslogs where ikey IN (%s) 658 order by logdate asc 659 }, 660 join(',', ('?') x scalar(@ids)) 661 )); 662 663 $sth2->execute(@ids); 664 my @logs; 665 while (my $res = $sth2->fetchrow_hashref) { 666 push(@logs, $res); 667 } 668 669 return @logs; 670 } 671 672 sub getlogs { 673 my ($self) = @_; 674 my $sth2 = $self->db->prepare( 675 q{ 676 select * from objectslogs 677 where logdate > now() - '1 year'::interval 678 order by logdate asc 679 }, 680 ); 681 682 $sth2->execute(); 683 my @logs; 684 while (my $res = $sth2->fetchrow_hashref) { 685 push(@logs, $res); 686 } 687 688 return @logs; 689 } 690 639 691 1; 640 692 -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Aliases.pm
r1161 r1284 33 33 mandatory => 1, 34 34 multiple => 1, 35 notify => 1, 35 36 }, 36 37 finalpoint => { ro => 1, multiple => 1 }, -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Group.pm
r1238 r1284 62 62 groupname => { ro => 1 }, 63 63 managedBy => { 64 notify => 1, 64 65 reference => 'user', 65 66 can_values => sub { … … 71 72 }, 72 73 managedAlsoBy => { 74 notify => 1, 73 75 reference => 'user', 74 76 multiple => 1, … … 83 85 sutype => { 84 86 reference => 'sutype', 87 notify => 1, 85 88 }, 86 89 autoMemberFilter => { -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Nethost.pm
r1225 r1284 32 32 create => { ro => 1, inline => 1, }, 33 33 ip => { 34 notify => 1, 34 35 multiple => 1, 35 36 uniq => 1, … … 48 49 }, 49 50 macaddr => { 51 notify => 1, 50 52 multiple => 1, 51 53 uniq => 1, … … 56 58 }, 57 59 cname => { 60 notify => 1, 58 61 multiple => 1, uniq => 1, 59 62 input => sub { lc($_[0]) } 60 63 }, 61 owner => { 64 owner => { 65 notify => 1, 62 66 reference => 'user', 63 67 delayed => 1, -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Netzone.pm
r1064 r1284 34 34 date => { ro => 1, inline => 1, }, 35 35 create => { ro => 1, inline => 1, }, 36 net => { multiple => 1 },37 netExclude => { multiple => 1 },36 net => { multiple => 1, notify => 1, }, 37 netExclude => { multiple => 1, notify => 1, }, 38 38 group => { hide => 1 }, 39 39 allow_dyn => { -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1219 r1284 51 51 mandatory => 1, 52 52 formopts => { length => 7 }, 53 notify => 1, 53 54 }, 54 55 uidnumber => { inline => 1, hide => 1, }, 55 gidNumber => { 56 gidNumber => { 57 notify => 1, 56 58 inline => 1, 57 59 iname => 'gidnumber', … … 83 85 inline => 1, 84 86 formtype => 'CHECKBOX', 87 notify => 1, 85 88 }, 86 89 locked => { 87 90 formtype => 'CHECKBOX', 88 91 formopts => { rawvalue => 1, }, 89 }, 90 expire => { inline => 1, formtype => 'DATE', }, 92 notify => 1, 93 }, 94 expire => { inline => 1, formtype => 'DATE', notify => 1, }, 91 95 name => { inline => 1, ro => 1, }, 92 96 cn => { … … 144 148 }, 145 149 reference => 'user', 150 notify => 1, 146 151 }, 147 152 department => { … … 149 154 can_values => sub { 150 155 $base->search_objects('group', 'sutype=dpmt') 151 } 156 }, 157 notify => 1, 152 158 }, 153 159 contratType => { … … 155 161 can_values => sub { 156 162 $base->search_objects('group', 'sutype=contrattype') 157 } 163 }, 164 notify => 1, 158 165 }, 159 166 site => { -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r1153 r1284 101 101 } 102 102 } 103 $info->{exported} = { inline => 1, formtype => 'CHECKBOX', hide => 1, };103 $info->{exported} = { inline => 1, formtype => 'CHECKBOX', hide => 1, notify => 1 }; 104 104 $info->{unexported} = { inline => 1, formtype => 'CHECKBOX', }; 105 105 … … 178 178 $sth->execute(map { $first{$_} || undef } sort keys %first) or return; 179 179 180 $class->new($base, $id)->set_fields(%second); 180 my $obj = $class->new($base, $id); 181 $obj->objectlog('Create', 'Object created'); 182 foreach (keys %first) { 183 my $attr = $obj->attribute($_); 184 $obj->objectlog('Attribute', '%s set to %s', $_, ( 185 defined($data{$_}) 186 ? (ref $data{$_} 187 ? join(', ', @{ $data{$_} }) 188 : $data{$_}) 189 : '(none)')) 190 if ($attr->{notify}); 191 } 192 $obj->set_fields(%second); 181 193 182 194 1; … … 185 197 sub _delete { 186 198 my ($class, $base, $id) = @_; 199 200 my $obj = $base->get_object($class->type, $id) 201 or return; 202 $obj->objectlog('Delete', 'Object deleted'); 187 203 188 204 my $sthd = $base->db->prepare_cached( … … 199 215 my ($class, $base, $id, $newid) = @_; 200 216 217 { 218 my $obj = $base->get_object($class->type, $id) 219 or return; 220 $obj->objectlog('Rename', 'Object rename to %s', $newid); 221 } 222 201 223 my $sthr = $base->db->prepare_cached( 202 224 sprintf( … … 214 236 ); 215 237 return; 238 } 239 240 { 241 my $obj = $base->get_object($class->type, $newid) 242 or return; 243 $obj->objectlog('Rename', 'Object renamed from %s', $id); 216 244 } 217 245 1; … … 290 318 sub set_fields { 291 319 my ($self, %data) = @_; 292 my $updated_attributes = 0;320 my @updated_attributes = (); 293 321 my @fields; 294 322 my @vals; … … 309 337 push(@fields, sprintf("%s = ?", $self->db->quote_identifier($field))); 310 338 push(@vals, $data{$field}); 339 push(@updated_attributes, $field); 311 340 } else { 312 341 $ext{$field} = $data{$field}; … … 330 359 return; 331 360 }; 332 $updated_attributes = scalar(@fields);333 361 } 334 362 … … 399 427 $updated++; 400 428 } 401 $updated_attributes++if ($updated);429 push(@updated_attributes, $uattr) if ($updated); 402 430 } else { 403 431 my $res = $sthu->execute($ext{$uattr}, $okey, $uattr); … … 410 438 $self->base->db->errstr 411 439 ); 412 $updated_attributes++;413 440 return; 414 441 }; … … 423 450 $self->base->db->errstr 424 451 ); 425 $updated_attributes++;426 452 return; 427 453 }; 428 454 } 455 push(@updated_attributes, $uattr); 429 456 } 430 457 } else { … … 440 467 }; 441 468 } 442 $updated_attributes++;443 469 } 444 470 } 445 471 446 472 delete($self->base->{__cache}{"_" . $self->type}{$self->id}); 447 $updated_attributes; 473 $self->objectlog('Update', 'Attributes %s where updated', join(', ', @updated_attributes)) 474 if(@updated_attributes); 475 foreach (@updated_attributes) { 476 my $attr = $self->attribute($_); 477 $self->objectlog('Attribute', '%s set to %s', $_, ( 478 defined($data{$_}) 479 ? (ref $data{$_} 480 ? join(', ', @{ $data{$_} }) 481 : $data{$_}) 482 : '(none)')) 483 if ($attr->{notify}); 484 } 485 scalar(@updated_attributes); 448 486 } 449 487 … … 483 521 my $salt = join('', map { $salt_char[rand(scalar(@salt_char))] } (1 .. 8)); 484 522 my $res = $self->set_fields($field, crypt($clear_pass, '$1$' . $salt)); 523 my $asymencrypted = 0; 485 524 if ($res) { 486 525 … … 501 540 return; 502 541 } 542 $asymencrypted = 1; 503 543 } 504 544 $self->base->log(LA_NOTICE, … … 506 546 $self->id 507 547 ); 548 $self->objectlog('Password', 'user password has changed%s', ($asymencrypted ? ' and stored using internal key' : '')); 508 549 return 1; 509 550 } … … 708 749 } 709 750 710 751 =head2 objectlog 752 753 =cut 754 755 sub objectlog { 756 my ($self, $changetype, $message, @args) = @_; 757 758 my $sth = $self->base->db->prepare(q{ 759 INSERT into objectslogs (ikey, otype, name, changetype, username, message) 760 VALUES (?,?,?,?,?,?) 761 }); 762 763 $sth->execute( 764 $self->_get_ikey, 765 $self->type, 766 $self->id, 767 $changetype, 768 $self->base->user || '@Console', 769 sprintf($message, @args), 770 ); 771 } 711 772 712 773 1; -
branches/4.0/LATMOS-Accounts/sqldata/attributes.csv
r1258 r1284 107 107 "user","halReference","Identifiant dans la base HAL" 108 108 "user","wWWHomePage","Site web personnel" 109 "user","comment","Comment" 110 "group","comment","Comment" 111 "nethost","comment","Comment" 112 "aliases","comment","Comment" -
branches/4.0/LATMOS-Accounts/templates/mail/account_expire.mail
r1267 r1284 10 10 de contacter svp@latmos.ipsl.fr afin de nous donner la nouvelle date. 11 11 12 13 Cas d'un nouvel arrivant: 14 12 15 Si vous êtes un nouvel arrivant, veuillez réaliser votre circuit d'entrée et 13 16 remettre la fiche à Brigitte Fromager (Guyancourt - bureau 2421) ou Irina … … 15 18 Si vous rencontrez des difficultés, n'hésitez pas à vous adresser à votre 16 19 responsable, ou à Brigitte et Irina. 20 21 22 Votre statut: 17 23 18 24 Société: [% obj.get_c_field('company') %] … … 34 40 svp@latmos.ipsl.fr to give us a new expiration date. 35 41 42 43 If you are new in laboratory: 44 36 45 If you are a newcomer, please make your entrance circuit and pass on the sheet 37 46 to Brigitte Fromager (Guyancourt - office 2421) or Irina Tchoumakova (Jussieu - … … 39 48 If you meet difficulties, don't hesitate to deal with your manager, or with 40 49 Brigitte and Irina. 50 51 52 Your status: 41 53 42 54 Company: [% obj.get_c_field('company') %]
Note: See TracChangeset
for help on using the changeset viewer.