SourceForge Logo

NAME

Boucherot::Users - A class to identifie users and groups

SYNOPSIS

  use Boucherot::Users;
  my $users=new Boucherot::Users;
  $users->add_password("McGoogan","Patrick"); # Won't have effect, McGoogan doesn't exists

  $users->add_user("McGoogan");
  $users->add_password("McGoogan","Patrick"); # Will associate McGoogan to Patrick
  $users->password("McGoogan","Patrick") # returns true...
  $users->password("McGoogan","6")       # returns false...

  $users->add_mask("McGoogan", mask => '.*@.*village.*' );
  $users->mask("McGoogan",'number6!mcgoogan@village.portmeirion.uk'); # return true...
  $users->mask("McGoogan",'number6!mcgoogan@portmeirion.uk'); # return false...
  $users->add_mask("McGoogan", mirc_mask => '*!*@*village*' );
  # same as:
  $users->add_mask("McGoogan", mask => '^.*!.*@.*village.*$' );

  $users->add_mask("McGoogan", host => "village.mine.nu");
  # return true if "portmeirion.uk" has the same IP as "village.mine.nu"  
  $users->mask("McGoogan",'number6!mcgoogan@portmeirion.uk');
  $users->add_mask("McGoogan", host => "village.mine.nu", mirc_mask => '*!mc*@*');
  # return true if "portmeirion.uk" has the same IP as "village.mine.nu" :
  $users->mask("McGoogan",'number6!mcgoogan@portmeirion.uk'); 
  # return false :
  $users->mask("McGoogan",'number6!fcgoogan@portmeirion.uk');

In fact, each method can take a third argument, that is degree of truth. The default is 100 (Full truth). As 100 is true and 0 is false, the value returns by $users->mask or $users->password is the degree.

  $users->add_mask("McGoogan", mask => '.*@.*village.*',2);
  $users->password("McGoogan",'Number6',100);

  if ($users->mask("McGoogan",'number6!mcgoogan@village.portmeirion.uk')<50)
  {
    # Here I won't believe you
  }
  else
  {
    # Here I will
  }

For exemple, to say ``Hello McGoogan'', you'll need a degree 10, but to let McGoogan be the bot's master, you'll expect a degree 100.

DESCRIPTION

This class is a subset of Boucherot, and is the class that manage the users. You can add rules to find a user.

You can also write :


  $users->mask("McGoogan",'number6!mcgoogan@village.portmeirion.uk',50)

that mean

  $users->mask("McGoogan",'number6!mcgoogan@village.portmeirion.uk')>=50

but is faster.

GISSUML MODEL

class Boucherot::Users

Methods:

   Constructor
 +$ new ( ) : Boucherot::Users

   Write

 +  add_user( user : SCALAR ) :
 +  add_password( user : SCALAR, password : SCALAR, level=100 : SCALAR ) :
 +  add_mask( user : SCALAR, args : HASH ) :
   Read
 +  password( user : SCALAR, password : SCALAR, level=100 : SCALAR ) : SCALAR
 +  mask( user : SCALAR, mask : SCALAR, level=100 : SCALAR ) : SCALAR
   File
 +  save(  ) :
 +  restore( ) :

 -  DESTROY ( ) :

Methods

new

 +$ new ( ) : Boucherot::Users

add_user

 +  add_user( user : SCALAR ) :

add_password

 +  add_password( user : SCALAR, password : SCALAR, level=100 : SCALAR ) :

add_mask

 +  add_mask( user : SCALAR, args : HASH ) :

add_mirc_mask

 +  add_mirc_mask( user : SCALAR, mirc_mask : SCALAR, level=100 : SCALAR )

add_host

 +  add_host( user : SCALAR, host : SCALAR, level=100 : SCALAR )

password

 +  password( user : SCALAR, password : SCALAR, level=0 : SCALAR ) : SCALAR

mask

 +  mask( user : SCALAR, mask : SCALAR, level=0 : SCALAR ) : SCALAR

save

 +  save ( ) :

restore

 +  restore ( ) :

restore

 -  DESTROY ( ) :

AUTHORS

This class was written by Arthibus Gissehel <gissehel@vachefolle.com> in 2001.

NOTES

This class is part of the Boucherot project.