suspend/unsuspend CF users
authorIvan Kohler <ivan@freeside.biz>
Sun, 25 Sep 2016 18:01:35 +0000 (11:01 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 25 Sep 2016 18:01:35 +0000 (11:01 -0700)
FS/FS/part_export/cardfortress.pm

index 8c94135..ae8e296 100644 (file)
@@ -55,10 +55,15 @@ sub _export_replace {
   '';
 }
 
   '';
 }
 
-sub _export_delete {
-  my( $self, $svc_acct ) = (shift, shift);
+#well, we're just going to disable them for now, but there you go
+sub _export_delete    { shift->merchant_disable(@_) }
+
+sub _export_suspend   { shift->merchant_disable(@_) }
 
 
-  #well, we're just going to disable them for now, but there you go
+sub _export_unsuspend { shift->merchant_enable(@_) }
+
+sub merchant_disable {
+  my( $self, $svc_acct ) = (shift, shift);
 
   open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
   my $ssh = Net::OpenSSH->new( $self->machine,
 
   open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
   my $ssh = Net::OpenSSH->new( $self->machine,
@@ -74,4 +79,21 @@ sub _export_delete {
 
 }
 
 
 }
 
+sub merchant_enable {
+  my( $self, $svc_acct ) = (shift, shift);
+
+  open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
+  my $ssh = Net::OpenSSH->new( $self->machine,
+                               default_stdin_fh => $def_in );
+
+  #capture2 and return STDERR, its probably useful if there's a problem
+  my $unused_output = $ssh->capture(
+    '/usr/local/bin/merchant_enable', map $svc_acct->$_, qw( username )
+  );
+  return $ssh->error if $ssh->error;
+
+  '';
+
+}
+
 1;
 1;