CGI::Application::Plugin::Authorization

CGI::Application::Plugin::Authorization is an authorization framework for CGI::Application.
Download

CGI::Application::Plugin::Authorization Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Cees Hek
  • Publisher web site:
  • http://search.cpan.org/~ceeshek/CGI-Application-Plugin-TT-1.04/lib/CGI/Application/Plugin/TT.pm

CGI::Application::Plugin::Authorization Tags


CGI::Application::Plugin::Authorization Description

CGI::Application::Plugin::Authorization is an authorization framework for CGI::Application. CGI::Application::Plugin::Authorization is an authorization framework for CGI::Application.SYNOPSIS use base qw(CGI::Application); use CGI::Application::Plugin::Authentication; use CGI::Application::Plugin::Authorization; # default config for runmode authorization __PACKAGE__->authz->config( DRIVER => , ); # Using a named configuration to distinguish it from # the above configuration __PACKAGE__->authz('dbaccess')->config( DRIVER => , JOIN_ON => 'user.id = access.user_id', CONSTRAINTS => { 'user.name' => '__USERNAME__', 'access.table' => '__PARAM_1__', 'access.item_id' => '__PARAM_2__' } ], ); sub admin_runmode { my $self = shift; # User must be in the admin group to have access to this runmode return $self->authz->forbidden unless $self->authz->authorize('admin'); # rest of the runmode ... } sub update_widget { my $self = shift; my $widget = $self->query->param('widget_id'); # Can this user edit this widget in the widgets table? return $self->authz->forbidden unless $self->authz('dbaccess')->authorize(widgets => $widget); # save changes to the widget ... }CGI::Application::Plugin::Authorization adds the ability to authorize users for specific tasks. Once a user has been authenticated and you know who you are dealing with, you can then use this plugin to control what that user has access to. It imports two methods (authz and authorization) into your CGI::Application module. Both of these methods are interchangeable, so you should choose one and use it consistently throughout your code. Through the authz method you can call all the methods of the CGI::Application::Plugin::Authorization plugin.amed ConfigurationsThere could be multiple ways that you may want to authorize actions in different parts of your code. These differences may conflict with each other. For example you may have runmode level authorization that requires that the user belongs to a certain group. But secondly, you may have row level database authorization that requires that the username column of the table contains the name of the current user. These configurations would conflict with each other since they are authorizing using different information. To solve this you can create multiple named configurations, by specifying a unique name to the c< authz > method. __PACKAGE__->authz('dbaccess')->config( DRIVER => , ); # later $self->authz('dbaccess')->authorize(widgets => $widget_id); Requirements: · Perl


CGI::Application::Plugin::Authorization Related Software