Changeset 2320 for trunk


Ignore:
Timestamp:
12/09/19 11:46:19 (4 years ago)
Author:
nanardon
Message:

Add LA_ACL_DEBUG env. var.

Location:
trunk/LATMOS-Accounts
Files:
3 edited

Legend:

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

    r2310 r2320  
    7676    bless($self, $class); 
    7777 
    78     unless ($options{noacl}) { 
     78    unless ($options{noacl} || $ENV{LA_USERNAME}) { 
    7979        if (-f (my $aclf = join('/', $self->_configdir, 'la-acls.ini'))) { 
    8080            $self->{_acls} = LATMOS::Accounts::Acls->new($aclf) or do { 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Acls.pm

    r2317 r2320  
    177177    foreach my $acl (@{$self->{_acls}}, @{$self->{_default_acls}}) { 
    178178        my $res = $acl->match($obj, $attr, $perm, $who, $groups); 
    179         defined($res) and return $res; 
    180     } 
    181  
     179        if ( defined($res) ) { 
     180            if ( $ENV{LA_ACL_DEBUG} ) { 
     181                la_log( 
     182                    LA_DEBUG, 
     183                    "Acl: %s %s for %s => %s :\n%s", 
     184                    ref $obj ? $obj->type . '/' . $obj->id : $obj, 
     185                    $attr, 
     186                    $perm, 
     187                    $res, 
     188                    $acl->dump, 
     189                ); 
     190            } 
     191            return $res; 
     192        } 
     193    } 
     194 
     195    if ( $ENV{LA_ACL_DEBUG} ) { 
     196        la_log( 
     197            LA_DEBUG, 
     198            "Acl: %s %s for %s => No match", 
     199            ref $obj ? $obj->type . '/' . $obj->id : $obj, 
     200            $attr, 
     201            $perm, 
     202        ) 
     203    } 
    182204    return 0; 
    183205} 
     206 
    184207 
    185208=head2 dump 
  • trunk/LATMOS-Accounts/man/man8/latmos-accounts.pod

    r1992 r2320  
    334334=back 
    335335 
     336=head1 ENVIRONMENT VARIABLES 
     337 
     338=head2 LA_DEBUG 
     339 
     340When set print a lot of debug message 
     341 
     342=head2 LA_ACL_DEBUG 
     343 
     344Print debug message about ACL processing. LA_DEBUG must be set to see 
     345ACL messages 
     346 
     347=head2 LA_USERNAME 
     348 
     349The user UID set into this variable will be used as logged user. 
     350If set ACL will always be used. 
     351 
     352=head2 LA_NO_COMMIT 
     353 
     354If set no commit will be done in the database. 
     355 
    336356=head1 BUGS 
    337357 
Note: See TracChangeset for help on using the changeset viewer.