summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2010-12-10 22:08:36 +0000
committerivan <ivan>2010-12-10 22:08:36 +0000
commit1318909d7eb16d736cbfb9f641eecccb00d4636c (patch)
tree24eb3ede37c104ea8b4e799013ae2d2d136eb207
parent457da870c23db87fbbc29d7c667a73f41422dd71 (diff)
cardfortress backend support
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/Schema.pm38
-rw-r--r--FS/FS/part_export/cardfortress.pm64
-rw-r--r--FS/FS/svc_acct.pm8
-rwxr-xr-xhttemplate/edit/process/svc_acct.cgi11
-rwxr-xr-xhttemplate/view/svc_acct.cgi6
-rw-r--r--httemplate/view/svc_acct/cardfortress.html27
7 files changed, 154 insertions, 7 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index ebeebb2..a05ad03 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4103,6 +4103,13 @@ and customer address. Include units.',
],
},
+ {
+ 'key' => 'svc_acct-cf_privatekey-message',
+ 'section' => '',
+ 'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
+ 'type' => 'textarea',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 70aab43..b48e5af 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1746,6 +1746,8 @@ sub tables_hashref {
'pbxsvc', 'int', 'NULL', '', '', '',
'last_login', @date_type, '', '',
'last_logout', @date_type, '', '',
+ #cardfortress field(s)
+ 'cf_privatekey', 'text', 'NULL', '', '', '',
#communigate pro fields (quota = MaxAccountSize)
'cgp_aliases', 'varchar', 'NULL', 255, '', '',
#settings
@@ -3094,7 +3096,43 @@ sub tables_hashref {
'unique' => [],
'index' => [], #recnum
},
+
+ 'nms_device' => {
+ 'columns' => [
+ 'nms_devicenum', 'serial', '', '', '', '',
+ #'agentnum', 'int', 'NULL', '', '', '',
+ 'devicename', 'varchar', '', $char_d, '', '',
+ 'ip', 'varchar', '', 15, '', '',
+ 'protocol', 'varchar', '', $char_d, '', '',
+# 'last', 'int', '', '', '', '',
+ ],
+ 'primary_key' => 'nms_devicenum',
+ 'unique' => [],
+ 'index' => [],
+ },
+ 'nms_deviceport' => {
+ 'columns' => [
+ 'portnum', 'serial', '', '', '', '',
+ 'nms_devicenum', 'int', '', '', '', '',
+ 'deviceport', 'int', '', '', '', '',
+ #'ip', 'varchar', 'NULL', 15, '', '',
+ 'svcnum', 'int', 'NULL', '', '', '',
+ ],
+ 'primary_key' => 'portnum',
+ 'unique' => [ [ 'nms_devicenum', 'deviceport' ] ],
+ 'index' => [ [ 'svcnum' ] ],
+ },
+
+ 'svc_port' => {
+ 'columns' => [
+ 'svcnum', 'int', '', '', '', '',
+ ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [], #recnum
+ },
+
# name type nullability length default local
diff --git a/FS/FS/part_export/cardfortress.pm b/FS/FS/part_export/cardfortress.pm
new file mode 100644
index 0000000..4916a6e
--- /dev/null
+++ b/FS/FS/part_export/cardfortress.pm
@@ -0,0 +1,64 @@
+package FS::part_export::cardfortress;
+
+use strict;
+use base 'FS::part_export';
+use vars qw( %info );
+use String::ShellQuote;
+
+#tie my %options, 'Tie::IxHash';
+#;
+
+%info = (
+ 'svc' => 'svc_acct',
+ 'desc' => 'CardFortress',
+ 'options' => {}, #\%options,
+ 'nodomain' => 'Y',
+ 'notes' => '',
+);
+
+sub rebless { shift; }
+
+sub _export_insert {
+ my($self, $svc_acct) = (shift, shift);
+
+ eval "use Net::OpenSSH;";
+ return $@ if $@;
+
+ 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 );
+
+ my $private_key = $ssh->capture(
+ { 'stdin_data' => $svc_acct->_password. "\n" },
+ '/usr/local/bin/merchant_create', map $svc_acct->$_, qw( username finger )
+ );
+ return $ssh->error if $ssh->error;
+
+ $svc_acct->cf_privatekey($private_key);
+
+ $svc_acct->replace;
+
+}
+
+sub _export_replace {
+ my( $self, $new, $old ) = (shift, shift, shift);
+
+ return 'username changes not yet supported'
+ if $old->username ne $new->username;
+
+ return 'password changes not yet supported'
+ if $old->_password ne $new->_password;
+
+ return 'Real name changes not yet supported'
+ if $old->finger ne $new->finger;
+
+ '';
+}
+
+sub _export_delete {
+ #my( $self, $svc_x ) = (shift, shift);
+
+ return 'deletion not yet supproted';
+}
+
+1;
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index f2b13c3..ac336b8 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -1207,16 +1207,19 @@ sub check {
|| $self->ut_enum('_password_encoding', ['',qw(plain crypt ldap)])
|| $self->ut_enum('password_selfchange', [ '', 'Y' ])
|| $self->ut_enum('password_recover', [ '', 'Y' ])
+ #cardfortress
+ || $self->ut_anything('cf_privatekey')
+ #communigate
|| $self->ut_textn('cgp_accessmodes')
|| $self->ut_alphan('cgp_type')
|| $self->ut_textn('cgp_aliases' ) #well
- #settings
+ # settings
|| $self->ut_alphasn('cgp_rulesallowed')
|| $self->ut_enum('cgp_rpopallowed', [ '', 'Y' ])
|| $self->ut_enum('cgp_mailtoall', [ '', 'Y' ])
|| $self->ut_enum('cgp_addmailtrailer', [ '', 'Y' ])
|| $self->ut_snumbern('cgp_archiveafter')
- #preferences
+ # preferences
|| $self->ut_alphasn('cgp_deletemode')
|| $self->ut_enum('cgp_emptytrash', $self->cgp_emptytrash_values)
|| $self->ut_alphan('cgp_language')
@@ -1224,7 +1227,6 @@ sub check {
|| $self->ut_textn('cgp_skinname')
|| $self->ut_textn('cgp_prontoskinname')
|| $self->ut_alphan('cgp_sendmdnmode')
- #XXX RPOP settings
;
return $error if $error;
diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi
index ba21ab4..52701df 100755
--- a/httemplate/edit/process/svc_acct.cgi
+++ b/httemplate/edit/process/svc_acct.cgi
@@ -44,11 +44,14 @@ unless ( $cgi->param('cgp_accessmodes') ) {
}
my %hash = $svcnum ? $old->hash : ();
-map {
+for ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) {
$hash{$_} = scalar($cgi->param($_));
- #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir
- # shell quota slipip)
- } (fields('svc_acct'), qw ( pkgnum svcpart usergroup ));
+}
+if ( $svcnum ) {
+ for ( grep $old->$_, qw( cf_privatekey ) ) {
+ $hash{$_} = $old->$_;
+ }
+}
my $new = new FS::svc_acct ( \%hash );
my $error = '';
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index 9135e67..4e82569 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -56,6 +56,12 @@ Service #<B><% $svcnum %></B>
</FORM>
<BR>
+<% include( 'svc_acct/cardfortress.html',
+ 'svc_acct' => $svc_acct,
+ %gopt,
+ )
+%>
+
<% include( 'svc_acct/hosting.html',
%gopt,
)
diff --git a/httemplate/view/svc_acct/cardfortress.html b/httemplate/view/svc_acct/cardfortress.html
new file mode 100644
index 0000000..d010fcd
--- /dev/null
+++ b/httemplate/view/svc_acct/cardfortress.html
@@ -0,0 +1,27 @@
+% if ( $svc_acct->cf_privatekey ) {
+
+<div class="fscontainer">
+<div class="fsbox">
+<div class="fsbox-title">
+ <span class="left">Card Fortress</span>
+</div>
+
+ <PRE><FONT STYLE="font-family:monospace"><% $svc_acct->cf_privatekey %></FONT></PRE>
+
+ <% $conf->config('svc_acct-cf_privatekey-message') %>
+
+%#XXX and then there should be a remove link to get rid of it
+
+% }
+
+</div>
+</div>
+<%init>
+
+my %opt = @_;
+
+my $svc_acct = $opt{'svc_acct'};
+
+my $conf = new FS::Conf;
+
+</%init>