1 package FS::part_export::cardfortress;
4 use base 'FS::part_export';
6 use String::ShellQuote;
9 #tie my %options, 'Tie::IxHash';
14 'desc' => 'CardFortress',
15 'options' => {}, #\%options,
20 sub rebless { shift; }
23 my($self, $svc_acct) = (shift, shift);
26 open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
27 my $ssh = Net::OpenSSH->new( $self->machine,
28 default_stdin_fh => $def_in );
30 #capture2 and return STDERR, its probably useful if there's a problem
31 my $private_key = $ssh->capture(
32 { 'stdin_data' => $svc_acct->_password. "\n" },
33 '/usr/local/bin/merchant_create', map $svc_acct->$_, qw( username finger )
35 return $ssh->error if $ssh->error;
37 $svc_acct->cf_privatekey($private_key);
44 my( $self, $new, $old ) = (shift, shift, shift);
46 return 'username changes not yet supported'
47 if $old->username ne $new->username;
49 return 'password changes not yet supported'
50 if $old->_password ne $new->_password;
52 return 'Real name changes not yet supported'
53 if $old->finger ne $new->finger;
58 #well, we're just going to disable them for now, but there you go
59 sub _export_delete { shift->merchant_disable(@_) }
61 sub _export_suspend { shift->merchant_disable(@_) }
63 sub _export_unsuspend { shift->merchant_enable(@_) }
65 sub merchant_disable {
66 my( $self, $svc_acct ) = (shift, shift);
68 open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
69 my $ssh = Net::OpenSSH->new( $self->machine,
70 default_stdin_fh => $def_in );
72 #capture2 and return STDERR, its probably useful if there's a problem
73 my $unused_output = $ssh->capture(
74 '/usr/local/bin/merchant_disable', map $svc_acct->$_, qw( username )
76 return $ssh->error if $ssh->error;
83 my( $self, $svc_acct ) = (shift, shift);
85 open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
86 my $ssh = Net::OpenSSH->new( $self->machine,
87 default_stdin_fh => $def_in );
89 #capture2 and return STDERR, its probably useful if there's a problem
90 my $unused_output = $ssh->capture(
91 '/usr/local/bin/merchant_enable', map $svc_acct->$_, qw( username )
93 return $ssh->error if $ssh->error;