Changeset 2156


Ignore:
Timestamp:
11/30/18 23:21:16 (6 years ago)
Author:
nanardon
Message:

Add an option 'endCircuitdontExpire' to disable endcircuit attribute behavior

Location:
trunk/LATMOS-Accounts
Files:
3 edited

Legend:

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

    r2041 r2156  
    105105 
    106106sub config { 
    107     my ($self, $opt) = @_; 
    108     return $self->{_options}{$opt}; 
     107    my ($self, $opt, $default) = @_; 
     108    return defined($self->{_options}{$opt}) ? $self->{_options}{$opt} : $default; 
    109109} 
    110110 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r2155 r2156  
    964964                    my $sth = $obj->db->prepare_cached( 
    965965                        sprintf( 
    966                             q{select extract(epoch from COALESCE(endcircuit,  expire)) + 11644474161 as expire 
     966                            q{select extract(epoch from %s) + 11644474161 as expire 
    967967                            from %s where %s = ?}, 
     968                            $base->config('endCircuitdontExpire') ? 'expire' : 'COALESCE(endcircuit,  expire)', 
    968969                            $obj->db->quote_identifier($obj->_object_table), 
    969970                            $obj->db->quote_identifier($obj->_key_field), 
     
    984985                    my $sth = $obj->db->prepare_cached( 
    985986                        sprintf( 
    986                             q{select justify_hours(COALESCE(endcircuit,  expire) - '1/1/1970'::timestamp) as expire 
     987                            q{select justify_hours(%s - '1/1/1970'::timestamp) as expire 
    987988                            from %s where %s = ?}, 
     989                            $base->config('endCircuitdontExpire') ? 'expire' : 'COALESCE(endcircuit,  expire)', 
    988990                            $obj->db->quote_identifier($obj->_object_table), 
    989991                            $obj->db->quote_identifier($obj->_key_field), 
     
    11221124                    my $sth = $obj->db->prepare_cached( 
    11231125                        sprintf( 
    1124                             q{select to_char(COALESCE(endcircuit,  expire), 'YYYY/MM/DD') as expire 
     1126                            q{select to_char(%s, 'YYYY/MM/DD') as expire 
    11251127                            from %s where %s = ?}, 
     1128                            $base->config('endCircuitdontExpire') ? 'expire' : 'COALESCE(endcircuit,  expire)', 
    11261129                            $obj->db->quote_identifier($obj->_object_table), 
    11271130                            $obj->db->quote_identifier($obj->_key_field), 
     
    12071210                        my $sth = $obj->db->prepare_cached( 
    12081211                            sprintf( 
    1209                                 q{select to_char(COALESCE(endcircuit,  expire) AT TIME ZONE 'Z', 'YYYYMMDDHH24MISSZ') as expire 
     1212                                q{select to_char(%s AT TIME ZONE 'Z', 'YYYYMMDDHH24MISSZ') as expire 
    12101213                                from %s where %s = ? and expire < now()}, 
     1214                                $base->config('endCircuitdontExpire') ? 'expire' : 'COALESCE(endcircuit,  expire)', 
    12111215                                $obj->db->quote_identifier($obj->_object_table), 
    12121216                                $obj->db->quote_identifier($obj->_key_field), 
  • trunk/LATMOS-Accounts/man/man8/latmos-accounts-base-sql.pod

    r1937 r2156  
    8888attributes (C<accountExpires> for Active Directory). 
    8989 
     90Setting C<endCircuitdontExpire> option to the database disable this behavior and 
     91C<endcircuit> attribute become informationnal only. 
     92 
    9093=head2 User Employment 
    9194 
Note: See TracChangeset for help on using the changeset viewer.