GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MooseX::AuthorizedMethods(3) User Contributed Perl Documentation MooseX::AuthorizedMethods(3)

MooseX::AuthorizedMethods - Syntax sugar for authorized methods

  package Foo::Bar;
  use MooseX::AuthorizedMethods; # includes Moose
  
  has user => (is => 'ro');
  
  authorized foo => ['foo'], sub {
     # this is going to happen only if the user has the 'foo' role
  };

This method exports the "authorized" declarator that makes a verification if the user has the required permissions before the acual invocation. The default verification method will take the "user" method result and call "roles" to list the roles given to that user.

authorized $name => [qw(required permissions)], $code
This declarator will use the default verifier to check if the user has one of the given roles, it will die otherwise.

The default verifier used is MooseX::Meta::Method::Authorized::CheckRoles, you might send an additional "verifier" option to the declarator with another object or class. A verifier is simply a duck type with the "authorized_do" method that is called as:

  $verifier->authorized_do($method, $code, @_)

It is expected that the verifier code die if the user doesn't fulfill the authorization requests.

Daniel Ruoso <daniel@ruoso.com>

Copyright 2010 by Daniel Ruoso et al

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2010-11-25 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.