Changeset 2262


Ignore:
Timestamp:
06/07/19 17:59:53 (5 years ago)
Author:
nanardon
Message:

Precompute more attribute

Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases
Files:
4 edited

Legend:

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

    r2260 r2262  
    3232        : (undef, $base_or_object, $maybe_otype); 
    3333 
     34    my $attr_info = {}; 
    3435    if (ref $attributes) { 
    35         $attributes->{_base} = $base; 
    36         $attributes->{_object} = $object; 
    37         $attributes->{_name} = $attributes->{name}; 
    38         $attributes->{_otype} = $otype; 
    39         $attributes->{monitored} ||= $base->config('monitored')->{ lc( $otype . '.' . $attributes->{name} ) }; 
    40  
    41         return bless($attributes, $class); 
    42     } else { 
    43         my $attr_info = $base->get_attr_schema($otype, $attributes) or return; 
    44  
    45         $attr_info->{_base} = $base; 
    46         $attr_info->{_object} = $object; 
     36        $attr_info = $attributes; 
     37        $attr_info->{_name} = $attributes->{name}; 
     38    } else { 
     39        $attr_info = $base->get_attr_schema($otype, $attributes) or return; 
    4740        $attr_info->{_name} = $attributes; 
    48         $attr_info->{_otype} = $otype; 
    49         $attr_info->{monitored} ||= $base->config('monitored')->{ lc( $otype . '.' . $attributes ) }; 
    50  
    51         return bless($attr_info, $class); 
    52     } 
     41    } 
     42 
     43    $attr_info->{_base}       = $base; 
     44    $attr_info->{_object}     = $object; 
     45    $attr_info->{_otype}      = $otype; 
     46    $attr_info->{monitored} ||= $base->config('monitored')->{ lc( $otype . '.' . $attributes ) }; 
     47    $attr_info->{ro}          = 1 if ($attr_info->{auto}); 
     48 
     49    return bless($attr_info, $class); 
    5350} 
    5451 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm

    r2256 r2262  
    1818our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
    1919 
    20 sub SCHEMA_VERSION { 33 }; 
     20sub SCHEMA_VERSION { 34 }; 
    2121 
    2222=head1 NAME 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r2228 r2262  
    951951            }, 
    952952            sAMAccountName => { 
    953                 ro => 1, 
    954953                auto => 1, 
    955954            }, 
     
    10201019            }, 
    10211020            directReports => { 
     1021                auto => 1, 
     1022                ro => 1, 
     1023            }, 
     1024            _directReports => { 
    10221025                reference => 'user', 
    10231026                ro => 1, 
     1027                hide => 1, 
    10241028                delayed => 1, 
    10251029                get => sub { 
     
    10661070            otheraddress => { 
    10671071                ro => 1, 
     1072                auto => 1, 
     1073            }, 
     1074            _otheraddress => { 
     1075                ro => 1, 
     1076                hide => 1, 
    10681077                reference => 'address', 
    10691078                get => sub { 
     
    10851094                }, 
    10861095            }, 
    1087             mainaddress => { 
     1096            mainaddress => { auto => 1 }, 
     1097            _mainaddress => { 
     1098                hide => 1, 
    10881099                ro => 1, 
    10891100                reference => 'address', 
     
    11001111                }, 
    11011112            }, 
    1102             postalAddress => { 
     1113            postalAddress => { auto => 1 }, 
     1114            _postalAddress => { 
     1115                hide => 1, 
    11031116                ro => 1, 
    11041117                get => sub { 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/upgrade.pm

    r2256 r2262  
    12561256            ], 
    12571257        }, 
     1258        { 
     1259            ver => 34, 
     1260            code => sub { return 1 }, 
     1261            recompute => 1, 
     1262        }, 
    12581263    ); 
    12591264 
     
    12901295            $maj->{ver}, 'schema_version' 
    12911296        ); 
     1297 
     1298        if ($maj->{code}) { 
     1299            $maj->{code}->() or return; 
     1300        } 
    12921301    } 
    12931302 
Note: See TracChangeset for help on using the changeset viewer.