add a create/user command
authorDirk Koopman <djk@tobit.co.uk>
Mon, 19 Nov 2007 13:47:23 +0000 (13:47 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Mon, 19 Nov 2007 13:47:23 +0000 (13:47 +0000)
Which is a big can of worms. Had a good shift around and changed
set/user to be a real command (rather than an alias), renamed the
existing command (which on I use) to set/uservar and sorted the
Aliases so that unset/node still works.

Changes
cmd/Aliases
cmd/Commands_en.hlp
cmd/create/user.pl [new file with mode: 0644]
cmd/set/user.pl
cmd/set/uservar.pl [new file with mode: 0644]
cmd/unset/node.pl [deleted file]
perl/Messages
perl/Version.pm

diff --git a/Changes b/Changes
index f19c7b95785c941e1a9541e62d175122eabcae4f..5394d7a41f25c4043960ebf323a485bbe41b4cc4 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 19Nov07=======================================================================
 1. change MRTG graphs to be based on GMT, not localtime. This allows one to
 more easily compare debug data with traffic graphs.
+2. Add a create/user command to just add a plain user.
 17Nov07=======================================================================
 1. Add Local::ann() as requested by Felipe PY1NB.
 16Nov07=======================================================================
index 1ea0c7873aea6e93b815e924ab8051037c5f5129..84b4c18276b71f7d854f22ebd4ee62e53d65fc30 100644 (file)
@@ -111,7 +111,6 @@ package CmdAlias;
          '^set/nota', 'unset/talk', 'unset/talk',
          '^set/noww', 'unset/wwv', 'unset/wwv',
          '^set/nowx', 'unset/wx', 'unset/wx',
-      '^set/user', 'unset/node', 'unset/node',
        '^set$', 'apropos set', 'apropos',
          '^sho?w?/u$', 'show/user', 'show/user',
          '^sho?w?/bul', 'show/files bulletins', 'show/files',
@@ -154,6 +153,7 @@ package CmdAlias;
        ],
        'u' => [
        '^uns?e?t?$', 'apropos unset', 'apropos',
+       '^uns?e?t?/node$', 'set/user', 'set/user',
        ],
        'v' => [
        ],
index 30c6aea54b06d84bedcc233c2f32bb7e94ed879e..4382ba754513a9cec504e809bb2cbb307d723eac 100644 (file)
@@ -406,6 +406,11 @@ DX cluster <callsign>. This process creates a new 'client' process which will
 use the script in /spider/connect/<callsign> to effect the 'chat' exchange
 necessary to traverse the network(s) to logon to the cluster <callsign>.
 
+=== 5^CREATE/USER <callsign> ...^Create this user from the User Database
+This command will create one or more new users. None of the fields
+like name, qth etc will be filled in. It is just a new entry in the user
+database to which one can add more stuff like SET/PASSWORD or by SPOOF.
+
 === 9^DELETE/USDB <callsign> ...^Delete this user from the US State Database
 This command will completely remove a one or more callsigns
 from the US States database.
diff --git a/cmd/create/user.pl b/cmd/create/user.pl
new file mode 100644 (file)
index 0000000..4eeece8
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# create a user
+#
+# Please note that this is only effective if the user is not on-line
+#
+# Copyright (c) 1998 - Dirk Koopman
+#
+#
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my $call;
+my @out;
+my $user;
+my $create;
+
+return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd;
+
+foreach $call (@args) {
+       $call = uc $call;
+       $user = DXUser->get($call);
+       unless ($user) {
+               $user = DXUser->new($call);
+               $user->sort('U');
+               $user->homenode($main::mycall);
+               $user->close();
+               push @out, $self->msg('creuser', $call);
+       } else {
+               push @out, $self->msg('hasha', $call, 'Users');
+       }
+}
+return (1, @out);
+
+
+
+
+
+
+
+
+
+
index afe67c7ed896df9d3576f7f46282e26e120ed3df..832dcac68037b66debf737e01ea66ed6860fc455 100644 (file)
@@ -1,34 +1,34 @@
 #
-# set any variable in the User file
+# set back to user
 #
-# This is a hack - use the UTMOST CAUTION!!!!!!!!
+# Please note that this is only effective if the user is not on-line
 #
-# Copyright (c) 1999 Dirk Koopman G1TLH
+# Copyright (c) 1998 - Dirk Koopman
 #
 #
 #
-my ($self, $line) = @_;
-return (1, $self->msg('e5')) if $self->priv < 9;
 
+my ($self, $line) = @_;
 my @args = split /\s+/, $line;
-return (1, $self->msg('suser1')) if @args < 3;
-
-my $call = uc $args[0];
-my $ref = DXUser->get_current($call);
-my $field = $args[1];
-my $value = $args[2];
-
-return (1, $self->msg('suser2', $call)) unless $ref;
-return (1, $self->msg('suser4', $field)) unless $ref->field_prompt($field);
+my $call;
 my @out;
+my $user;
+my $create;
 
-# set it (dates and silly things like that can come later)
-
-my $oldvalue = $ref->{$field};
-$ref->{$field} = $value;
-$ref->put();
-
-push @out, $self->msg('suser3', $field, $oldvalue, $value);
-push  @out, print_all_fields($self, $ref, "User Information $call");
+return (1, $self->msg('e5')) if $self->priv < 5;
 
+foreach $call (@args) {
+       $call = uc $call;
+       my $chan = DXChannel::get($call);
+       if ($chan) {
+               push @out, $self->msg('nodee1', $call);
+       } else {
+               $user = DXUser->get($call);
+               return (1, $self->msg('usernf', $call)) if !$user;
+               $user->sort('U');
+               $user->priv(0);
+               $user->close();
+               push @out, $self->msg('nodeu', $call);
+       }
+}
 return (1, @out);
diff --git a/cmd/set/uservar.pl b/cmd/set/uservar.pl
new file mode 100644 (file)
index 0000000..c5e39fb
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# set any variable in the User file
+#
+# This is a hack - use the UTMOST CAUTION!!!!!!!!
+#
+# Copyright (c) 1999 Dirk Koopman G1TLH
+#
+#
+#
+my ($self, $line) = @_;
+
+my @args = split /\s+/, $line;
+return (1, $self->msg('suser1')) if @args < 3;
+
+
+my $call = uc $args[0];
+my $ref = DXUser->get_current($call);
+my $field = $args[1];
+my $value = $args[2];
+
+return (1, $self->msg('suser2', $call)) unless $ref;
+return (1, $self->msg('suser4', $field)) unless $ref->field_prompt($field);
+my @out;
+
+# set it (dates and silly things like that can come later)
+
+if ($self->priv < 9 || $self->remotecmd || $self->inscript) {
+       Log('DXCommand', $self->call . " attempted to set user var $field=$value on $call remotely");
+       push @out, $self->msg('sorry');
+}
+
+my $oldvalue = $ref->{$field};
+$ref->{$field} = $value;
+$ref->put();
+
+push @out, $self->msg('suser3', $field, $oldvalue, $value);
+push  @out, print_all_fields($self, $ref, "User Information $call");
+
+return (1, @out);
diff --git a/cmd/unset/node.pl b/cmd/unset/node.pl
deleted file mode 100644 (file)
index b560e6e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# set user type BACK TO  'U' (user)
-#
-# Please note that this is only effective if the user is not on-line
-#
-# Copyright (c) 1998 - Dirk Koopman
-#
-#
-#
-
-my ($self, $line) = @_;
-my @args = split /\s+/, $line;
-my $call;
-my @out;
-my $user;
-my $create;
-
-return (1, $self->msg('e5')) if $self->priv < 5;
-
-foreach $call (@args) {
-       $call = uc $call;
-       my $chan = DXChannel::get($call);
-       if ($chan) {
-               push @out, $self->msg('nodee1', $call);
-       } else {
-               $user = DXUser->get($call);
-               return (1, $self->msg('usernf', $call)) if !$user; 
-               $user->sort('U');
-               $user->priv(0);
-               $user->close();
-               push @out, $self->msg('nodeu', $call);
-       }
-}
-return (1, @out);
index 7e811a1d73223421f7f11671bb4f99a359406dcf..3b0db325a752cff45b74b65ccf5ecb855c317788 100644 (file)
@@ -38,6 +38,7 @@ package DXM;
                                confail => 'connection to $_[0] failed ($_[1])',
                                constart => 'connection to $_[0] started',
                                conbump => 'Reconnected as $_[0] at $_[1], this instance is disconnected',
+                               creuser => 'User $_[0] has been created',
                                deluser => 'User $_[0] has been deleted',
                                db1 => 'This database is hosted at $_[0]',
                                db2 => 'Sorry, but key: $_[0] was not found in $_[1]',
index 4d7bf1c56420502902f2a3bac4c7d8f07f083244..b96932ad6d24a1e42a8966ece5e60516f52c51fb 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '191';
+$build = '192';
 
 1;