Dancer2-Plugin-Auth-Extensible-Provider-DBIxClass

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/Auth/Extensible/Provider/DBIxClass.pm  view on Meta::CPAN

package Dancer2::Plugin::Auth::Extensible::Provider::DBIxClass;
use Modern::Perl;
our $VERSION = '0.0902'; # VERSION
our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY
# ABSTRACT: authenticate via the Dancer2::Plugin::DBIx:Class plugin
use Carp;
use Dancer2::Core::Types qw/Bool Int Str/;
use DateTime;
use DBIx::Class::ResultClass::HashRefInflator;
use Scalar::Util qw(blessed);
use String::CamelCase qw(camelize);

use Moo;
with 'Dancer2::Plugin::Auth::Extensible::Role::Provider';
use namespace::clean;


sub deprecated_setting {
   my ( $setting, $replacement ) = @_;
   carp __PACKAGE__, " config setting \"$setting\" is deprecated.",
       " Use \"$replacement\" instead.";
}

sub BUILDARGS {
   my $class = shift;
   my %args  = ref( $_[0] ) eq 'HASH' ? %{ $_[0] } : @_;

   my $app = $args{plugin}->app;

   # backwards compat

   # deprecate the *_source settings, but don't change anything yet
   deprecated_setting( 'users_source', 'users_resultset' )
       if $args{users_source};

   deprecated_setting( 'roles_source', 'roles_resultset' )
       if $args{roles_source};

   deprecated_setting( 'user_roles_source', 'user_roles_resultset' )
       if $args{user_roles_source};

   # deprecate the *_table settings and move them into source, which
   # will be used in the lazy build for the correct *_resultset settings
   if ( $args{users_table} ) {
      deprecated_setting( 'users_table', 'users_resultset' );
      $args{users_source} = delete $args{users_table}
          if !$args{users_source};
   }

   if ( $args{roles_table} ) {
      deprecated_setting( 'roles_table', 'roles_resultset' );
      $args{roles_source} = delete $args{roles_table}
          if !$args{roles_source};
   }

   if ( $args{user_roles_table} ) {
      deprecated_setting( 'user_roles_table', 'user_roles_resultset' );
      $args{user_roles_source} = delete $args{user_roles_table}
          if !$args{user_roles_source};
   }

   return \%args;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.387 second using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )