NAME

Aut::Ticket - Authorization Framework for wxPerl - Tickets

SYNOPSIS

use Aut::Backend::SQL;
use Aut;
use Aut::Login;
use DBI;
use Lang::SQL;
use Lang;

package testApp;

use base 'Wx::App';

sub OnInit {
  my $dbname="zclass";
  my $host="localhost";
  my $user="zclass";
  my $pass="";
  my $dsn="dbi:Pg:dbname=$dbname;host=$host";

  Lang::init(new Lang::SQL("dbi:Pg:dbname=$dbname;host=$host",$user,$pass));

  my $backend=Aut::Backend::SQL->new($dsn,$user,$pass);
  my $auth=Aut->new($backend);

  my $login=Aut::Login->new($auth,"test application");

  my $ticket=$login->login();
  $ticket->log();

  $ticket=Aut::Ticket->new(ADMIN => 1);
  $ticket->log();
  $auth->create_account("admin","test",$ticket);

  print "login with admin, pass=test\n";

  $ticket=$login->login();

  $ticket->log();

  $login->Destroy;

  return 0;
}

package main;

my $a= new testApp;
$a->MainLoop();

ABSTRACT

'Aut::Ticket' is part of the authorization framework that can be used in conjunction with wxPerl. It provides the ticket authorization system.

DESCRIPTION

new(ADMIN = 0/1, MUTATE => 0/1, VIEW => 0/1, VALID => 0/1, FROM => string)> --> Aut::Ticket

This method initializes a ticket with given values for ADMIN, MUTATE, VIEW and VALID; or let's it initialize from the 'FROM' argument, that has earlier been created with the to_string function.

invalidate() --> void

This method invalidates the ticket it's called on, e.g:

my $ticket=new Aut::Ticket(ADMIN => 1);

(...)

$ticket->invalidate();

valid() --> boolean

This method returns 'true' for a valid ticket and 'false' for an invalid one.

admin() --> boolean

This method returns true if the ticket it's called on has ADMIN => 1.

mutate() --> boolean

This method returns true if the ticket it's called on has MUTATE => 1.

view() --> boolean

This method returns true if the ticket it's called on has VIEW => 1.

log() --> void

This method prints the internals of an Aut::Ticket object (with function 'print').

to_string() --> string

This method converts an Aut::Ticket object to a string. The Aut::Ticket class provides a way to instantiate a new Aut::Ticket object from such a string (using the 'FROM' keyword with method 'new').

SEE ALSO

http://wxperl.sf.net, Lang framework, Aut framework, Aut::Login, Aut::Backend::SQL.

AUTHOR

Hans Oesterholt-Dijkema <oesterhol@cpan.org>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under LGPL terms.