2.5. WebTool::ACL

2.5.1. NAME

WebTool::ACL - Access control subsystem for the Guardian Digital Webtool.

2.5.2. SYNOPSIS

use WebTool::ACL;

my $acl       = new WebTool::ACL;
my $rv        = $acl->check_fatal();

2.5.3. DESCRIPTION

This module contains functions for controlling access to parts of the Guardian Digital WebTool. End-user code should never have to call these functions directly -- WebTool::ACL is used internally by the WebTool::UI module when a page is loaded.

Each file in the WebTool is assigned a major/minor number and an access right. If a user does not have the correct privileges to access the given file (when WebTool::UI pulls up the page), an error page is shown.

2.5.4. METHODS

check_fatal()

This function basically checks access rights for the combination of user and file. Function obtains these values from environment. It returns true or false.

Example Usage:

if (check_fatal()) {
  ....
}

err($)

This function receives a custom error message as argument. It returns javascript pop up containing error message with button(BACK button).

Example Usage:

$acl->err($msg);

fetch_module_acl($$)

This function receives a module and script as arguments. Using that module name it reads that module's acl file, and gets/returns a hash reference of values of major,minor,access associated with file.

Example Usage:

my $acl = $acl->fetch_module_acl($module, $file);

process_environment()

This function returns current user, current script and current module from environment(%ENV).

Example Usage:

my ($user, $module, $file) = $self->process_environment();

read_module_acl_file($)

This function takes module name as argument. Basically it reads ACL file of particular module. Hash reference is created associating each file with major,minor and access values and retured.

Example Usage:

my $tst = $acl->read_module_acl_file($module);
$major_value = $tst->{$file}->{'major'};
$minor_value = $tst->{$file}->{'minor'};
$access_value = $tst->{$file}->{'access'};

acl_add($$$$)

This is ACL manipulation method. Basically adding access control list for user. This function takes username,major,minor,access as argument. Value of access argument should be 1 or 2 (1=read only, 2=read/write).

Example Usage:

$acl->acl_add($username, $major, $minor, $access);

acl_clear($)

This function is used to delete the access control list of particular user. This function takes username as argument.

Example Usage:

$acl->acl_clear($username);

acl_get($)

This function is used to get access control list(as hash reference) of particular user. This function takes username as argument. In hash key is formed as $major:$minor and $access is assigned as respective value.

Example Usage:

$acl  = $acl->acl_get($username);

2.5.5. AUTHORS

Ryan W. Maple <ryan@guardiandigital.com>

2.5.6. COPYRIGHT AND LICENSE

Copyright Guardian Digital, Inc., All Rights Reserved