rolling in some donorware changes
This commit is contained in:
parent
b6568d8346
commit
4149d8eb5c
4 changed files with 21 additions and 7 deletions
|
|
@ -83,7 +83,7 @@ sub _setupSessionVars {
|
|||
WebGUI::SQL->write("update userSession set lastPageView="._time().", lastIP='$session{env}{REMOTE_ADDR}',
|
||||
expires=".(_time()+$session{setting}{sessionTimeout})." where sessionId='$_[0]'");
|
||||
} else {
|
||||
start(1,$_[0]);
|
||||
$vars{sessionId} = start(1,$_[0]);
|
||||
}
|
||||
}
|
||||
$session{var} = \%vars;
|
||||
|
|
@ -474,6 +474,7 @@ sub start {
|
|||
-path=>'/'
|
||||
);
|
||||
refreshSessionVars($sessionId);
|
||||
return $sessionId;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -59,8 +59,7 @@ These methods are available from this class:
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _create {
|
||||
my ($userId);
|
||||
$userId = WebGUI::Id::generate();
|
||||
my $userId = shift || WebGUI::Id::generate();
|
||||
WebGUI::SQL->write("insert into users (userId,dateCreated) values (".quote($userId).",".time().")");
|
||||
WebGUI::Grouping::addUsersToGroups([$userId],[2,7]);
|
||||
return $userId;
|
||||
|
|
@ -218,13 +217,17 @@ sub lastUpdated {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( userId )
|
||||
=head2 new ( userId [, overrideId ] )
|
||||
|
||||
Constructor.
|
||||
|
||||
=head3 userId
|
||||
|
||||
The userId of the user you're creating an object reference for. If left blank it will default to "1" (Visitor). If specified as "new" then a new user account will be created and assigned the next available userId.
|
||||
The userId of the user you're creating an object reference for. If left blank it will default to "1" (Visitor). If specified as "new" then a new user account will be created and assigned the next available userId.
|
||||
|
||||
=head3 overrideId
|
||||
|
||||
A unique ID to use instead of the ID that WebGUI will generate for you. It must be absolutely unique and can be up to 22 alpha numeric characters long.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -233,7 +236,8 @@ sub new {
|
|||
tie %user, 'Tie::CPHash';
|
||||
$class = shift;
|
||||
$userId = shift || 1;
|
||||
$userId = _create() if ($userId eq "new");
|
||||
my $overrideId = shift;
|
||||
$userId = _create($overrideId) if ($userId eq "new");
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId=".quote($userId));
|
||||
%profile = WebGUI::SQL->buildHash("select userProfileField.fieldName, userProfileData.fieldData
|
||||
from userProfileField, userProfileData where userProfileField.fieldName=userProfileData.fieldName and
|
||||
|
|
|
|||
|
|
@ -264,6 +264,9 @@ sub www_view {
|
|||
if ($self->get('preprocessMacros')) {
|
||||
$call = WebGUI::Macro::process($self->get("callMethod"));
|
||||
$param_str = WebGUI::Macro::process($self->get("params"));
|
||||
} else {
|
||||
$call = $self->get('callMethod');
|
||||
$param_str = $self->get('params');
|
||||
}
|
||||
|
||||
# see if we can shortcircuit this whole process
|
||||
|
|
|
|||
|
|
@ -157,6 +157,9 @@ Special Cases:
|
|||
|
||||
-Blank lines will be ignored.
|
||||
|
||||
-If userId is specified for an import record, that userId
|
||||
be used instead of generating one.
|
||||
|
||||
STOP
|
||||
exit;
|
||||
}
|
||||
|
|
@ -222,13 +225,16 @@ while(<FILE>) {
|
|||
|
||||
# process user
|
||||
my ($duplicate) = WebGUI::SQL->quickArray("select count(*) from users where username=".quote($user{username}));
|
||||
my ($duplicateId) = WebGUI::SQL->quickArray("select count(*) from users where userId=".quote($user{userId})) if $user{userId};
|
||||
if ($user{username} eq "") {
|
||||
print "Skipping line $lineNumber.\n" unless ($quiet);
|
||||
} elsif ($duplicate) {
|
||||
print "User $user{username} already exists. Skipping.\n" unless ($quiet);
|
||||
} elsif ($duplicateId) {
|
||||
print "ID $user{userId} already exists. Skipping.\n" unless ($quiet);
|
||||
} else {
|
||||
print "Adding user $user{username}\n" unless ($quiet);
|
||||
my $u = WebGUI::User->new("new");
|
||||
my $u = WebGUI::User->new("new", $user{userId});
|
||||
$u->username($user{username});
|
||||
$u->authMethod($user{authMethod});
|
||||
$u->status($user{status});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue