- Timestamp:
- 03/20/15 12:31:05 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm
r1278 r1286 128 128 my ($self) = @_; 129 129 $self->{_id} 130 } 131 132 133 =head2 Iid 134 135 Return internal id if different from Id 136 137 =cut 138 139 sub Iid { 140 my ($self) = @_; 141 $self->id 130 142 } 131 143 … … 368 380 return 0; 369 381 }; 370 $res += ($attribute->set($cdata{$cfield}) || 0); 371 372 } 373 $res 382 } 383 384 my %updated = (); 385 foreach my $cfield (keys %cdata) { 386 my $attribute = $self->attribute($cfield) or do { 387 $self->base->log(LA_ERR, 388 "Cannot set unsupported attribute %s to %s (%s)", 389 $cfield, $self->id, $self->type 390 ); 391 return; 392 }; 393 if ($attribute->set($cdata{$cfield})) { 394 $updated{$cfield} = $attribute->{notify}; 395 } 396 } 397 398 if (keys %updated) { 399 $self->ReportChange('Update', 'Attributes %s where updated', join(', ', sort keys %updated)); 400 foreach (sort keys %updated) { 401 $self->ReportChange('Attributes', '%s set to %s', $_, 402 (ref $cdata{$_} 403 ? join(', ', @{ $cdata{$_} }) 404 : $cdata{$_}) || '(none)') 405 if ($updated{$_}); 406 } 407 } 408 return scalar(keys %updated); 374 409 } 375 410 … … 390 425 my ($self, $clear_pass) = @_; 391 426 if ($self->base->check_acl($self, 'userPassword', 'w')) { 392 return $self->_set_password($clear_pass); 427 if ($self->_set_password($clear_pass)) { 428 $self->ReportChange('Password', 'user password has changed'); 429 return 1; 430 } else { 431 return; 432 } 393 433 } else { 394 434 $self->base->log(LA_ERROR, "Permission denied for %s to change its password", … … 623 663 } 624 664 665 =head2 ReportChange($changetype, $message, @args) 666 667 Possible per database way to log changes 668 669 =cut 670 671 sub ReportChange { 672 my ($self, $changetype, $message, @args) = @_; 673 674 $self->base->ReportChange( 675 $self->type, 676 $self->id, 677 $self->Iid, 678 $changetype, $message, @args 679 ) 680 } 681 625 682 1; 626 683
Note: See TracChangeset
for help on using the changeset viewer.