Add tests for database defined groups to Group.t
Clear cache on set of databaseLinkId or dbQuery in WebGUI::Group.pm. Fix typos, missing module use lines and extra variables in WebGUI::User.pm.
This commit is contained in:
parent
03c79ce1d0
commit
c802e4ddad
3 changed files with 28 additions and 6 deletions
|
|
@ -714,7 +714,7 @@ If you specified "new" for groupId, you can use this property to specify an id y
|
|||
=cut
|
||||
|
||||
sub new {
|
||||
my ($class, $groupId, %default, $value, $key, %group, %profile);
|
||||
my ($class, %group);
|
||||
tie %group, 'Tie::CPHash';
|
||||
$class = shift;
|
||||
my $self = {};
|
||||
|
|
@ -787,6 +787,8 @@ sub dbQuery {
|
|||
my $value = shift;
|
||||
if (defined $value) {
|
||||
$self->set("dbQuery",$value);
|
||||
$self->session->stow->delete("gotGroupsInGroup");
|
||||
$self->session->stow->delete("isInGroup");
|
||||
}
|
||||
return $self->get("dbQuery");
|
||||
}
|
||||
|
|
@ -799,7 +801,7 @@ Returns the databaseLinkId for this group.
|
|||
|
||||
=head3 value
|
||||
|
||||
If specified, the databaseLinkId is set to this value.
|
||||
If specified, the databaseLinkId is set to this value and in-memory cached user and group data is cleared.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -808,6 +810,8 @@ sub databaseLinkId {
|
|||
my $value = shift;
|
||||
if (defined $value) {
|
||||
$self->set("databaseLinkId",$value);
|
||||
$self->session->stow->delete("gotGroupsInGroup");
|
||||
$self->session->stow->delete("isInGroup");
|
||||
}
|
||||
return $self->get("databaseLinkId");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package WebGUI::User;
|
|||
use strict;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::DatabaseLink;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -309,11 +310,11 @@ sub isInGroup {
|
|||
}
|
||||
}
|
||||
### Check external database
|
||||
if ($group->get("dbQuery") && $group->get("databaseLinkId")) {
|
||||
if ($group->get("dbQuery") && defined $group->get("databaseLinkId")) {
|
||||
# skip if not logged in and query contains a User macro
|
||||
unless ($group->get("dbQuery") =~ /\^User/i && $uid eq '1') {
|
||||
my $dbLink = WebGUI::DatabaseLink->new($self->session,$group->get("databaseLinkId"));
|
||||
my $dbh = $dbLink->dbh;
|
||||
my $dbh = $dbLink->db;
|
||||
if (defined $dbh) {
|
||||
if ($group->get("dbQuery") =~ /select 1/i) {
|
||||
my $query = $group->get("dbQuery");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue