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}',
|
WebGUI::SQL->write("update userSession set lastPageView="._time().", lastIP='$session{env}{REMOTE_ADDR}',
|
||||||
expires=".(_time()+$session{setting}{sessionTimeout})." where sessionId='$_[0]'");
|
expires=".(_time()+$session{setting}{sessionTimeout})." where sessionId='$_[0]'");
|
||||||
} else {
|
} else {
|
||||||
start(1,$_[0]);
|
$vars{sessionId} = start(1,$_[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$session{var} = \%vars;
|
$session{var} = \%vars;
|
||||||
|
|
@ -474,6 +474,7 @@ sub start {
|
||||||
-path=>'/'
|
-path=>'/'
|
||||||
);
|
);
|
||||||
refreshSessionVars($sessionId);
|
refreshSessionVars($sessionId);
|
||||||
|
return $sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,7 @@ These methods are available from this class:
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub _create {
|
sub _create {
|
||||||
my ($userId);
|
my $userId = shift || WebGUI::Id::generate();
|
||||||
$userId = WebGUI::Id::generate();
|
|
||||||
WebGUI::SQL->write("insert into users (userId,dateCreated) values (".quote($userId).",".time().")");
|
WebGUI::SQL->write("insert into users (userId,dateCreated) values (".quote($userId).",".time().")");
|
||||||
WebGUI::Grouping::addUsersToGroups([$userId],[2,7]);
|
WebGUI::Grouping::addUsersToGroups([$userId],[2,7]);
|
||||||
return $userId;
|
return $userId;
|
||||||
|
|
@ -218,7 +217,7 @@ sub lastUpdated {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 new ( userId )
|
=head2 new ( userId [, overrideId ] )
|
||||||
|
|
||||||
Constructor.
|
Constructor.
|
||||||
|
|
||||||
|
|
@ -226,6 +225,10 @@ Constructor.
|
||||||
|
|
||||||
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
|
=cut
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
|
@ -233,7 +236,8 @@ sub new {
|
||||||
tie %user, 'Tie::CPHash';
|
tie %user, 'Tie::CPHash';
|
||||||
$class = shift;
|
$class = shift;
|
||||||
$userId = shift || 1;
|
$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));
|
%user = WebGUI::SQL->quickHash("select * from users where userId=".quote($userId));
|
||||||
%profile = WebGUI::SQL->buildHash("select userProfileField.fieldName, userProfileData.fieldData
|
%profile = WebGUI::SQL->buildHash("select userProfileField.fieldName, userProfileData.fieldData
|
||||||
from userProfileField, userProfileData where userProfileField.fieldName=userProfileData.fieldName and
|
from userProfileField, userProfileData where userProfileField.fieldName=userProfileData.fieldName and
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,9 @@ sub www_view {
|
||||||
if ($self->get('preprocessMacros')) {
|
if ($self->get('preprocessMacros')) {
|
||||||
$call = WebGUI::Macro::process($self->get("callMethod"));
|
$call = WebGUI::Macro::process($self->get("callMethod"));
|
||||||
$param_str = WebGUI::Macro::process($self->get("params"));
|
$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
|
# see if we can shortcircuit this whole process
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,9 @@ Special Cases:
|
||||||
|
|
||||||
-Blank lines will be ignored.
|
-Blank lines will be ignored.
|
||||||
|
|
||||||
|
-If userId is specified for an import record, that userId
|
||||||
|
be used instead of generating one.
|
||||||
|
|
||||||
STOP
|
STOP
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
@ -222,13 +225,16 @@ while(<FILE>) {
|
||||||
|
|
||||||
# process user
|
# process user
|
||||||
my ($duplicate) = WebGUI::SQL->quickArray("select count(*) from users where username=".quote($user{username}));
|
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 "") {
|
if ($user{username} eq "") {
|
||||||
print "Skipping line $lineNumber.\n" unless ($quiet);
|
print "Skipping line $lineNumber.\n" unless ($quiet);
|
||||||
} elsif ($duplicate) {
|
} elsif ($duplicate) {
|
||||||
print "User $user{username} already exists. Skipping.\n" unless ($quiet);
|
print "User $user{username} already exists. Skipping.\n" unless ($quiet);
|
||||||
|
} elsif ($duplicateId) {
|
||||||
|
print "ID $user{userId} already exists. Skipping.\n" unless ($quiet);
|
||||||
} else {
|
} else {
|
||||||
print "Adding user $user{username}\n" unless ($quiet);
|
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->username($user{username});
|
||||||
$u->authMethod($user{authMethod});
|
$u->authMethod($user{authMethod});
|
||||||
$u->status($user{status});
|
$u->status($user{status});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue