Ignore:
Timestamp:
12/30/15 16:57:00 (8 years ago)
Author:
nanardon
Message:

Check permission in summary* function

File:
1 edited

Legend:

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

    r1567 r1569  
    647647sub attributes_summary { 
    648648    my ($class, $base, $attribute) = @_; 
     649    my $attr = $base->attribute($class->type, $attribute) or do { 
     650        $base->log(LA_ERR, "Cannot instantiate %s attribute", $attribute); 
     651        return; 
     652    }; 
     653    if (!$attr->readable) { 
     654        $base->log(LA_WARN, l('Attribute %s is not readable', $attribute)); 
     655        return; 
     656    } 
     657    if (!$base->check_acl($class->type, $attribute, 'r')) { 
     658        $base->log(LA_WARN, l('Permission denied to read attribute %s', $attribute)); 
     659        return; 
     660    } 
    649661    my %values; 
    650662    foreach my $id ($base->list_objects($class->type)) { 
     
    672684sub attributes_summary_by_object { 
    673685    my ($class, $base, $attribute) = @_; 
     686    my $attr = $base->attribute($class->type, $attribute) or do { 
     687        $base->log(LA_ERR, "Cannot instantiate %s attribute", $attribute); 
     688        return; 
     689    }; 
     690    if (!$attr->readable) { 
     691        $base->log(LA_WARN, l('Attribute %s is not readable', $attribute)); 
     692        return; 
     693    } 
     694    if (!$base->check_acl($class->type, $attribute, 'r')) { 
     695        $base->log(LA_WARN, l('Permission denied to read attribute %s', $attribute)); 
     696        return; 
     697    } 
    674698    my %values; 
    675699    foreach my $id ($base->list_objects($class->type)) { 
Note: See TracChangeset for help on using the changeset viewer.