Changeset 576


Ignore:
Timestamp:
Feb 15, 2011, 7:19:18 PM (10 years ago)
Author:
zerodeux
Message:

BearMail::Backend firt draft: autorization part is not documented, and thus some API might be lacking - see #22

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bearmail/lib/BearMail/Backend.pm

    r574 r576  
    1111
    1212    use BearMail::Backend;
     13    use BearMail::Account;
    1314   
    1415    my $bb = BearMail::Backend->new();
    15     $bb->login('root');
    16    
    17     my @domains = $bb->get_domains(search => '*bear*', range => [0, 9]);
    18     my @account = $bb->get_account(search => '*@bearstech.com', range => [30, 39]);
    1916
    20     ...
     17    $bb->su('admin') || $bb->login('vcaron@bearstech.com', 'paaassw0rd');
     18    printf "Using '%s' account credentials\n", $bb->user();
     19
     20    my $domain  = $bb->get_domain('bearstech.com');
     21    my @domains = $bb->get_domains(filter => '*bear*', range => [0, 9]);
     22
     23    my $account = $bb->get_account
     24    my @account = $bb->get_accounts(filter => '*@bearstech.com', range => [30, 39]);
     25
     26    my $account = new BearMail::Account(
     27        address => 'test@bearstech.com',
     28        target  => BearMail::Target->alias('vcaron@bearstech.com')
     29    );
     30    $bb->create_account($account);
     31
     32    $account->password('n3w_paaass');
     33    $bb->update_account($account);
     34 
     35    $bb->delete_account('test@bearstech.com');
     36    $bb->delete_accounts(filter => 'vcaron@*');
     37
     38    # $bb->log()
     39    # $bb->get_log(filter => , date_range => ?, limit => 100)
    2140
    2241
     
    3554interface, you might prefer the C<BearMail::Backend::SQL> interface.
    3655
    37 TODO: describe account, targets, autorization model.
     56TODO: describe accounts, targets, autorization model.
    3857
    3958
     
    7493this constructor will return C<undef>.
    7594
     95Next step is to C<su> or C<login> to setup an autorization context.
     96
     97=head2 su
     98
     99Endorse some identity without authentication (root power !).
     100
     101=head2 login
     102
     103Endorse some identity with authentication check via the current
     104backend.
     105
     106=head2 user
     107
     108Retrieve current endorsed identity.
     109
    76110
    77111=head1 SUPPORT
Note: See TracChangeset for help on using the changeset viewer.