Changeset 1042 for trunk/LATMOS-Accounts


Ignore:
Timestamp:
05/31/12 19:50:39 (12 years ago)
Author:
nanardon
Message:
  • load acl and allowed values automatically if config exists
Location:
trunk/LATMOS-Accounts
Files:
3 edited

Legend:

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

    r1041 r1042  
    2121=cut 
    2222 
    23 #### 
    2423# Return the configuration directory according settings: 
    2524# 
     
    3332=head1 FUNCTION 
    3433 
    35 =head2 new($configdir) 
     34=head2 new($configdir, %options) 
    3635 
    3736Instanciate a new LATMOS::Accounts object. 
    3837 
    39 $configdir if defined is the directory containing files to use, 
     38C<$configdir> if defined is the directory containing files to use, 
    4039default to F</etc/latmos-accounts/>. 
     40 
     41C<%options> can contains: 
     42 
     43=over 4 
     44 
     45=item noacl 
     46 
     47If true, acls configuration are not load and code act like everything is 
     48allowed. 
     49 
     50This flag is usefull for administrative tools, for which no acl must apply. 
     51 
     52=back 
    4153 
    4254=cut 
     
    6072    bless($self, $class); 
    6173 
    62     if (!$options{noacl}) { 
    63         if ($self->val('_default_', 'acls')) { 
    64             $self->{_acls} = LATMOS::Accounts::Acls->new( 
    65                 $self->val('_default_', 'acls') 
    66             ) or do { 
    67                 la_log(LA_ERR, 
    68                     'Cannot load ACL file %s', $self->val('_default_', 'acls') 
    69                 ); 
    70                 return; 
    71             }; 
    72         } elsif (-f (my $aclf = join('/', $self->_configdir, 'la-acls.ini'))) { 
     74    unless ($options{noacl}) { 
     75        if (-f (my $aclf = join('/', $self->_configdir, 'la-acls.ini'))) { 
    7376            $self->{_acls} = LATMOS::Accounts::Acls->new($aclf) or do { 
    7477                la_log(LA_ERR, 'Cannot load ACL file %s', $aclf); 
     
    7881    } 
    7982 
    80     if ($self->val('_default_', 'allowed_values')) { 
    81         $self->{_allowed_values} = Config::IniFiles->new( 
    82             -file => $self->val('_default_', 'allowed_values'), 
    83         ) or do { 
    84             la_log(LA_ERR, 'Cannot load ALLOWED VALUES %s', 
    85                 $self->val('_default_', 'allowed_values')); 
    86             return; 
    87         }; 
    88     } elsif (-f (my $allowf = join('/', $self->_configdir, 
    89                 'la-allowed-values.ini'))) { 
     83    if (-f (my $allowf = join('/', $self->_configdir, 'la-allowed-values.ini'))) { 
    9084        $self->{_allowed_values} = Config::IniFiles->new( 
    9185            -file => $allowf, 
  • trunk/LATMOS-Accounts/man/man5/latmos-accounts.ini.pod

    r1013 r1042  
    4141 
    4242The identity to use in FROM field when sending mail 
    43  
    44 =head3 acls 
    45  
    46 The configuration file to use as ACL list 
    47  
    48 =head3 allowed_values 
    49  
    50 The configuration file containing attributes restriction 
    5143 
    5244=head3 expire_summary_to 
  • trunk/LATMOS-Accounts/sample/latmos-accounts.ini

    r861 r1042  
    77# Default synchro to apply 
    88sync = name 
    9 # The acls file to use to limit access 
    10 #acls = 
    11 # An inifile containing per attributes values restriction 
    12 # allowed_values = 
    139# smtp: the server used to send mail 
    1410smtp = localhost 
Note: See TracChangeset for help on using the changeset viewer.