Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'hotfix/adduser'

  • Loading branch information...
commit 23eb67be4ff6d77f308e90c974e367d5969952c4 2 parents 13a58e0 + d09a5b2
@szabgab authored
Showing with 61 additions and 0 deletions.
  1. +1 −0  Changes
  2. +1 −0  Makefile.PL
  3. +59 −0 script/dwimmer
View
1  Changes
@@ -1,4 +1,5 @@
+ Add script/dwimmer to enable adding user from the command line.
Enable some special characters in the filename: space ( ), dot (.), $, @ and %.
Eliminate cache from the Ajax get requests as IE (both 8 and 9) would cache by default.
View
1  Makefile.PL
@@ -55,6 +55,7 @@ bugtracker 'http://github.com/szabgab/dwimmer';
repository 'http://github.com/szabgab/dwimmer';
install_script 'script/dwimmer_setup.pl';
+install_script 'script/dwimmer';
# Copy files to share before installing (but it is not included in the distribution)
foreach my $module (qw(File::Copy::Recursive File::Spec)) {
View
59 script/dwimmer
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use Data::Dumper;
+use Getopt::Long qw(GetOptions);
+use Pod::Usage qw(pod2usage);
+
+my %opt;
+GetOptions(\%opt,
+ 'url=s',
+ 'username=s',
+ 'password=s',
+) or pod2usage();
+
+$opt{username} ||= 'admin';
+pod2usage() if not $opt{url} or not $opt{username} or not $opt{password};
+
+my %commands = (
+ add_user => [qw(uname email password)],
+);
+
+use Dwimmer::Client;
+
+
+my $cmd = shift;
+
+pod2usage() if not $cmd or $cmd eq 'help';
+
+if ($commands{$cmd}) {
+ my %data;
+ my @fields = @{ $commands{$cmd} };
+ @data{ @fields } = @ARGV;
+ # TODO check if all the params are available
+
+ if ($cmd eq 'add_user') {
+ $data{verify} = 'verified';
+ }
+
+ my $dw = Dwimmer::Client->new( host => $opt{url} );
+ $dw->login( $opt{username}, $opt{password} );
+ my $r = $dw->$cmd(%data);
+ print Dumper $r;
+} else {
+ pod2usage();
+}
+
+=head1 SYNOPSIS
+
+REQUIRED PARAMETERS:
+
+ add_user USERNAME EMAIL PASSWORD
+
+ --username OF_CURRENT_USER (admin by default)
+ --password OF_CURRENT_USER
+ --url OF_DWIMMER_SITE
+
+=cut
+
Please sign in to comment.
Something went wrong with that request. Please try again.