Catalyst::ActionRole::RequireSSL::Role - Roles.


Catalyst-ActionRole-RequireSSL documentation Contained in the Catalyst-ActionRole-RequireSSL distribution.

Index


Code Index:

NAME

Top

Catalyst::ActionRole::RequireSSL::Role - Roles.

VERSION

Top

version 0.06

SYNOPSIS

Top


Catalyst-ActionRole-RequireSSL documentation Contained in the Catalyst-ActionRole-RequireSSL distribution.

package Catalyst::ActionRole::RequireSSL::Role;

use Moose::Role;
use namespace::autoclean;
our $VERSION = '0.06';

my @ignore_chain = qw/Catalyst::ActionRole::NoSSL Catalyst::ActionRole::RequireSSL/;

#check we are most relevant action
sub check_chain {
  my ($self,$c) = @_;
  return $c->config->{require_ssl}->{path_cache}->{$c->action->private_path} 
    eq $self->private_path
      if $c->config->{require_ssl}->{path_cache}->{$c->action->private_path};
  if($c->action->can('chain')) {
    foreach my $action (reverse @{$c->action->chain}) {
      foreach my $role (@{$action->attributes->{Does}}) {
        if(grep {$role eq $_} @ignore_chain ) {
          $c->config->{require_ssl}->{path_cache}->{$action->private_path}
            = $action->private_path;
          return $action->private_path eq $self->private_path;
        }
      }
    }  
  }
  return 1;
}

1;