Changeset 1628 for trunk


Ignore:
Timestamp:
01/11/16 16:08:29 (9 years ago)
Author:
nanardon
Message:

Add remove_old_dpmt parameter: remove user from previous department group

Location:
trunk/LATMOS-Accounts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r1625 r1628  
    13111311} 
    13121312 
     1313sub set_fields { 
     1314    my ($self, %data) = @_; 
     1315 
     1316    my $old; 
     1317    if (exists($data{department})) { 
     1318        $old = $self->_get_attributes('department'); 
     1319    } 
     1320    if (($data{department} || '') eq ($old || '')) { 
     1321        # We do not remove the group, there is no change 
     1322        $old = undef; 
     1323    } 
     1324 
     1325    my $res = $self->SUPER::set_fields(%data) or return; 
     1326 
     1327    if ($self->base->config('remove_old_dpmt') && $old) { 
     1328        $self->base->log(LA_DEBUG, 
     1329            "Removing %s from group %s (department change to %s)", 
     1330            $self->id, 
     1331            $old, 
     1332            $data{department} || ''); 
     1333        $self->_delAttributeValue('memberOf', $old) or return; 
     1334        $res++; 
     1335    } 
     1336 
     1337    $res 
     1338} 
     1339 
    13131340=head2 listEmployment 
    13141341 
  • trunk/LATMOS-Accounts/man/man8/latmos-accounts-base-sql.pod

    r1590 r1628  
    99The C<libpq> connection parameters, eg a semin colon separated paramaters 
    1010containing the server, the database name, user and password, etc... 
     11 
     12=head2 remove_old_dpmt 
     13 
     14By default when the department is changed on a user account it remains in the 
     15department group as a secondary department. 
     16 
     17Setting C<remove_old_dpmt> to true in the config will force user removal from 
     18the group when department is changed. 
     19The user can still be added back later. 
    1120 
    1221=head1 FEATURES 
Note: See TracChangeset for help on using the changeset viewer.