Make a nice session object to use for Group->new.
This commit is contained in:
parent
dd9a78d24e
commit
b91a1effa8
1 changed files with 5 additions and 4 deletions
|
|
@ -1113,8 +1113,9 @@ sub new {
|
||||||
$self->{_groupId} = shift;
|
$self->{_groupId} = shift;
|
||||||
my $override = shift;
|
my $override = shift;
|
||||||
my $noAdmin = shift;
|
my $noAdmin = shift;
|
||||||
|
my $session = $self->{_session};
|
||||||
|
|
||||||
my $cached = $self->{_session}->stow->get("groupObj", { noclone => 1});
|
my $cached = $session->stow->get("groupObj", { noclone => 1});
|
||||||
return $cached->{$self->{_groupId}} if ($cached->{$self->{_groupId}});
|
return $cached->{$self->{_groupId}} if ($cached->{$self->{_groupId}});
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
@ -1126,18 +1127,18 @@ sub new {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Check if the groupId is valid. If not return undef
|
# Check if the groupId is valid. If not return undef
|
||||||
my ($groupExists) = $self->{_session}->db->quickArray('select groupId from groups where groupId=?', [
|
my ($groupExists) = $session->db->quickArray('select groupId from groups where groupId=?', [
|
||||||
$self->{_groupId},
|
$self->{_groupId},
|
||||||
]);
|
]);
|
||||||
unless ($groupExists) {
|
unless ($groupExists) {
|
||||||
$self->{_session}->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:'
|
$session->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:'
|
||||||
.'['.$self->{_groupId}.']');
|
.'['.$self->{_groupId}.']');
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cached->{$self->{_groupId}} = $self;
|
$cached->{$self->{_groupId}} = $self;
|
||||||
$self->{_session}->stow->set("groupObj", $cached);
|
$session->stow->set("groupObj", $cached);
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue