This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git] / FS / FS / part_export / shellcommands_withdomain.pm
1 package FS::part_export::shellcommands_withdomain;
2
3 use vars qw(@ISA %info);
4 use Tie::IxHash;
5 use FS::part_export::shellcommands;
6
7 @ISA = qw(FS::part_export::shellcommands);
8
9 tie my %options, 'Tie::IxHash',
10   'user' => { label=>'Remote username', default=>'root' },
11   'useradd' => { label=>'Insert command',
12                  #default=>''
13                },
14   'useradd_stdin' => { label=>'Insert command STDIN',
15                        type =>'textarea',
16                        #default=>"$_password\n$_password\n",
17                      },
18   'userdel' => { label=>'Delete command',
19                  #default=>'',
20                },
21   'userdel_stdin' => { label=>'Delete command STDIN',
22                        type =>'textarea',
23                        #default=>'',
24                      },
25   'usermod' => { label=>'Modify command',
26                  default=>'',
27                },
28   'usermod_stdin' => { label=>'Modify command STDIN',
29                        type =>'textarea',
30                        #default=>"$_password\n$_password\n",
31                      },
32   'usermod_pwonly' => { label=>'Disallow username changes',
33                         type =>'checkbox',
34                       },
35   'suspend' => { label=>'Suspension command',
36                  default=>'',
37                },
38   'suspend_stdin' => { label=>'Suspension command STDIN',
39                        default=>'',
40                      },
41   'unsuspend' => { label=>'Unsuspension command',
42                    default=>'',
43                  },
44   'unsuspend_stdin' => { label=>'Unsuspension command STDIN',
45                          default=>'',
46                        },
47   'crypt' => { label   => 'Default password encryption',
48                type=>'select', options=>[qw(crypt md5)],
49                default => 'crypt',
50              },
51 ;
52
53 %info = (
54   'svc'     => 'svc_acct',
55   'desc'    => 'Real-time export via remote SSH (vpopmail, ISPMan)',
56   'options' => \%options,
57   'notes'   => <<'END'
58 Run remote commands via SSH.  username@domain (rather than just usernames) are
59 considered unique (also see shellcommands).  You probably want this if the
60 commands you are running will accept a domain as a parameter, and will allow
61 the same username with different domains.  You will need to
62 <a href="../docs/ssh.html">setup SSH for unattended operation</a>.
63
64 <BR><BR>Use these buttons for some useful presets:
65 <UL>
66   <LI><INPUT TYPE="button" VALUE="vpopmail" onClick='
67     this.form.useradd.value = "/home/vpopmail/bin/vadduser $username\\\@$domain $quoted_password";
68     this.form.useradd_stdin.value = "";
69     this.form.userdel.value = "/home/vpopmail/bin/vdeluser $username\\\@$domain";
70     this.form.userdel_stdin.value="";
71     this.form.usermod.value = "/home/vpopmail/bin/vpasswd $new_username\\\@$new_domain $new_quoted_password";
72     this.form.usermod_stdin.value = "";
73     this.form.usermod_pwonly.checked = true;
74   '>
75   <LI><INPUT TYPE="button" VALUE="ISPMan CLI" onClick='
76     this.form.useradd.value = "/usr/local/ispman/bin/ispman.addUser -d $domain -f $first -l $last -q $quota -p $quoted_password $username";
77     this.form.useradd_stdin.value = "";
78     this.form.userdel.value = "/usr/local/ispman/bin/ispman.delUser -d $domain $username";
79     this.form.userdel_stdin.value="";
80     this.form.usermod.value = "/usr/local/ispman/bin/ispman.passwd.user $new_username\\\@$new_domain $new_quoted_password";
81     this.form.usermod_stdin.value = "";
82     this.form.usermod_pwonly.checked = true;
83   '>
84 </UL>
85
86 The following variables are available for interpolation (prefixed with
87 <code>new_</code> or <code>old_</code> for replace operations):
88 <UL>
89   <LI><code>$username</code>
90   <LI><code>$domain</code>
91   <LI><code>$_password</code>
92   <LI><code>$quoted_password</code> - unencrypted password quoted for the shell
93   <LI><code>$crypt_password</code> - encrypted password (quoted for the shell)
94   <LI><code>$uid</code>
95   <LI><code>$gid</code>
96   <LI><code>$finger</code> - GECOS, already quoted for the shell (do not add additional quotes)
97   <LI><code>$first</code> - First name of GECOS, already quoted for the shell (do not add additional quotes)
98   <LI><code>$last</code> - Last name of GECOS, already quoted for the shell (do not add additional quotes)
99   <LI><code>$dir</code> - home directory
100   <LI><code>$shell</code>
101   <LI><code>$quota</code>
102   <LI><code>@radius_groups</code>
103   <LI>All other fields in <a href="../docs/schema.html#svc_acct">svc_acct</a> are also available.
104 </UL>
105 END
106 );
107
108 1;
109