summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-09-04 17:52:56 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-09-04 17:52:56 (GMT)
commit8a54dd745f6bf2b5a0c38b5777f36621e3d40c3d (patch)
tree3d52ac9a74d8995ba88df88c241ebb0de83be946
parentd60ac079e1d725b042cdf1b49cbd3d75710679e0 (diff)
added support for full name for rd-user add
-rwxr-xr-xlib/RHRD/rddb.pm9
-rwxr-xr-xutils/rd-user5
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 6a1d925..1e021ef 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -118,16 +118,19 @@ sub check_token
sub add_user
{
- my ($dbh, $username, $token) = @_;
+ my ($dbh, $username, $token, $fullname) = @_;
if(!defined $token || $token eq '') {
return (undef, 'ERROR', "empty token is not allowed")
}
+ if(!defined $fullname) {
+ $fullname = '';
+ }
- my $sql = qq{insert into USERS (LOGIN_NAME, FULL_NAME, PHONE_NUMBER, DESCRIPTION, PASSWORD, ENABLE_WEB, ADMIN_USERS_PRIV, ADMIN_CONFIG_PRIV, CREATE_CARTS_PRIV, DELETE_CARTS_PRIV, MODIFY_CARTS_PRIV, EDIT_AUDIO_PRIV, ASSIGN_CART_PRIV, CREATE_LOG_PRIV, DELETE_LOG_PRIV, DELETE_REC_PRIV, PLAYOUT_LOG_PRIV, ARRANGE_LOG_PRIV, MODIFY_TEMPLATE_PRIV, ADDTO_LOG_PRIV, REMOVEFROM_LOG_PRIV, CONFIG_PANELS_PRIV, VOICETRACK_LOG_PRIV, EDIT_CATCHES_PRIV, ADD_PODCAST_PRIV, EDIT_PODCAST_PRIV, DELETE_PODCAST_PRIV) values ( ?, "", "", "", ? , "N", "N", "N", "Y", "Y", "Y", "Y", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N");};
+ my $sql = qq{insert into USERS (LOGIN_NAME, FULL_NAME, PHONE_NUMBER, DESCRIPTION, PASSWORD, ENABLE_WEB, ADMIN_USERS_PRIV, ADMIN_CONFIG_PRIV, CREATE_CARTS_PRIV, DELETE_CARTS_PRIV, MODIFY_CARTS_PRIV, EDIT_AUDIO_PRIV, ASSIGN_CART_PRIV, CREATE_LOG_PRIV, DELETE_LOG_PRIV, DELETE_REC_PRIV, PLAYOUT_LOG_PRIV, ARRANGE_LOG_PRIV, MODIFY_TEMPLATE_PRIV, ADDTO_LOG_PRIV, REMOVEFROM_LOG_PRIV, CONFIG_PANELS_PRIV, VOICETRACK_LOG_PRIV, EDIT_CATCHES_PRIV, ADD_PODCAST_PRIV, EDIT_PODCAST_PRIV, DELETE_PODCAST_PRIV) values ( ?, ?, "", "", ? , "N", "N", "N", "Y", "Y", "Y", "Y", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N");};
my $sth = $dbh->prepare($sql)
or return (undef, 'ERROR', "Database Error: " . $dbh->errstr);
- my $cnt = $sth->execute($username, $token)
+ my $cnt = $sth->execute($username, $token, $fullname)
or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
$sth->finish();
diff --git a/utils/rd-user b/utils/rd-user
index 019f004..c891985 100755
--- a/utils/rd-user
+++ b/utils/rd-user
@@ -32,12 +32,13 @@ if ($> != 0 ) {
my $num_args = $#ARGV + 1;
if ($num_args != 2) {
- print STDERR "Usage: rd-user (check|add|remove) <username>\n";
+ print STDERR "Usage: rd-user (check|add|remove) <username> [ fullname ]\n";
exit 1;
}
my $cmd = $ARGV[0];
my $username = $ARGV[1];
+my $fullname = $ARGV[2];
my ($dbh, undef, $errorstring) = RHRD::rddb::opendb();
if(defined $dbh) {
@@ -48,7 +49,7 @@ if(defined $dbh) {
exit $result;
} elsif($cmd eq "add") {
my $token = mkpasswd(-length => 16, -minnum => 3, -minupper => 3, -minspecial => 0);
- (my $cnt, undef, $errorstring) = RHRD::rddb::add_user($dbh, $username, $token);
+ (my $cnt, undef, $errorstring) = RHRD::rddb::add_user($dbh, $username, $token, $fullname);
unless(defined $cnt) {
print "$errorstring\n";
RHRD::rddb::closedb($dbh);