CGI-FileManager

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

  cgiapp_prerun
    Regular CGI::Application method

  redirect
    Just to easily redirect to the home page

  load_tmpl
    Change the default behaviour of CGI::Application by overriding this
    method. By default we'll load the template from within our module.

  message
    Print an arbitrary message to the next page

  login
    Show login form

  login_process
    Processing the login information, checking authentication, configuring
    the session object or giving error message.

  authenticate
    Called without parameter. Returns an objects that is capable to
    authenticate a user.

    By default it returns a CGI::FileManager::Auth object.

    It is planned that this method will be overriden by the user to be able
    to replace the authentication back-end. Currently the requirements from
    the returned object is to have these methods:

     $a->verify(username, password)   returns true/false
     $a->home(username)               return the full path to the home directory of the given user

    WARNING: this interface might change in the future, before we reach
    version 1.00 Check the Changes.

  logout
    logout and mark the session accordingly.

  change_dir
    Changes the current directory and then lists the new current directory

  list_dir
    Listing the content of a directory

  delete_file
    Delete a file from the server

  remove_directory
    Remove a directory

  unzip
    unzip

  rename_form
    Rename file form

  rename
    Rename file

  upload_file
    Upload a file

  create_directory
    Create a directory

  DEFAULT
    To get the default behavior you can write the following code. The module
    will use the built in templates to create the pages.

     #!/usr/bin/perl -wT
     use strict;
 
     use CGI::FileManager;
     my $fm = CGI::FileManager->new(
                            PARAMS => {
                                    AUTH => {
                                            PASSWD_FILE => "/home/user/mypwfile",
                                    }
                            }
                    );
     $fm->run;

    new(OPTIONS)

  META-DATA
    Theoretically we could manage some meta-data about each file in some
    database that can be either outside our virtual file system or can be a
    special file in each directory.

  Limitations
    The user running the web server has to have read/write access on the
    relevant part of the file system in order to carry out all the
    functions.

USE CASES
  Virtual web hosting with no ftp access for one user
    A single user needs authentication and full access to one directory
    tree. This does not work yet.

     #!/usr/bin/perl -T
 
     use CGI::FileManager;
     my $fm = CGI::FileManager->new({
                 ROOT => "/home/gabor/web/client1",
                 AUTH => ["george", "WE#$%^DFRE"],   # the latter is the crypt-ed password we expect
                 });
     $fm->run;

  Virtual web hosting with no ftp access for a number of users
    A number of users need authentication and full access to one directory
    tree per user.

     #!/usr/bin/perl -T
 
     use CGI::FileManager;
     my $fm = CGI::FileManager->new(
                            PARAMS => {
                                    AUTH => {
                                            PASSWD_FILE => "/home/user/mypwfile",
                                    }



( run in 1.233 second using v1.01-cache-2.11-cpan-b16cb0d3907 )