add config object, connect user system up to lists code
[scpubgit/App-EzPz.git] / lib / App / EzPz / UserStore.pm
index 73669c5..672fec3 100644 (file)
@@ -4,7 +4,13 @@ use Module::Runtime qw(use_module);
 use Scalar::Util 'blessed';
 use Moo;
 
-has ezmlm_bindir => (is => 'ro', required => 1);
+has ezmlm_config => (
+  is => 'ro',
+  coerce => sub {
+    return $_[0] if blessed($_[0]);
+    return use_module('App::EzPz::EzmlmConfig')->new($_[0]);
+  }
+);
 
 has htpasswd_file => (is => 'ro', required => 1);
 
@@ -38,7 +44,7 @@ sub add {
   my $htp_user = $user->_htpasswd_user;
   $htp_file->add_user($htp_user);
   $htp_user->file($htp_file);
-  $user->_set_ezmlm_bindir($self->ezmlm_bindir);
+  $user->_set_ezmlm_config($self->ezmlm_config);
   return $user;
 }
 
@@ -52,7 +58,7 @@ sub _inflate_user {
   my ($self, $htp_user) = @_;
   return use_module('App::EzPz::User')->new(
     htpasswd_user => $htp_user,
-    ezmlm_bindir => $self->ezmlm_bindir,
+    ezmlm_config => $self->ezmlm_config,
   );
 }