Changeset 825

Show
Ignore:
Timestamp:
09/25/09 08:08:35 (2 months ago)
Author:
hachi
Message:

Make AccessControl plugin capable of dumping config.

This reverts commit b71936415bce1e20b2c402c3fd290500c6bd0083.

(and another double-revert, but this is the last one)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Perlbal/Plugin/AccessControl.pm

    r758 r825  
    178178} 
    179179 
     180sub dumpconfig { 
     181    my ($class, $svc) = @_; 
     182 
     183    my @return; 
     184 
     185    my $cfg = $svc->{extra_config}->{_access} ||= {}; 
     186    my $rules = $cfg->{rules} || []; 
     187 
     188    foreach my $rule (@$rules) { 
     189        my $action = uc $rule->[0]; 
     190        my $type   = uc $rule->[1]; 
     191        my $value  = $rule->[2]; 
     192        push @return, "ACCESS $action $type $value"; 
     193    } 
     194 
     195    my $default_action = $cfg->{deny_default} ? "DENY" : "ALLOW"; 
     196    push @return, "ACCESS POLICY $default_action"; 
     197 
     198    return @return; 
     199} 
     200 
    1802011;