fixed: Collab groupToEditPost shouldn't be empty

fixed: WebGUI::User->isInGroup has bad defaulting behavior
This commit is contained in:
Doug Bell 2009-02-17 23:21:30 +00:00
parent ffdb86de81
commit 30158b7f8d
3 changed files with 24 additions and 3 deletions

View file

@ -11,6 +11,8 @@
- fixed #9749: Account Manager: AIM link
- fixed #9751: Account Manager: problem sorting in Contributions
- fixed #9750: Account Manager: Inbox Messages per Page [TEMPLATE]
- fixed: Collaboration groupToEditPost should not be blank
- fixed: WebGUI::User->isInGroup had bad default groupId
7.6.11
- fixed: Asset Manager can generate URLs that are too long

View file

@ -32,6 +32,7 @@ my $quiet; # this line required
my $session = start(); # this line required
addAssetDiscoveryServiceAgain( $session );
changeMatrixAttributeIndexing( $session );
fixCollaborationGroupToEditPost( $session );
# upgrade functions go here
@ -75,6 +76,23 @@ sub changeMatrixAttributeIndexing {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Fix the groupToEditPost in the Collaboration (should not be "")
sub fixCollaborationGroupToEditPost {
my $session = shift;
print "\tFixing group to edit post in Collaboration..." unless $quiet;
# and here's our code
$session->db->write(<<'SQL');
UPDATE Collaboration
SET groupToEditPost= (
SELECT groupIdEdit FROM assetData
WHERE assetData.assetId=Collaboration.assetId
AND assetData.revisionDate = Collaboration.revisionDate
)
WHERE groupToEditPost = "";
SQL
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------

View file

@ -636,7 +636,7 @@ The group that you wish to verify against the user. Defaults to group with Id 3
sub isInGroup {
my (@data, $groupId);
my ($self, $gid, $secondRun) = @_;
$gid = 3 unless (defined $gid);
$gid = 3 unless $gid;
my $uid = $self->userId;
### The following several checks are to increase performance. If this section were removed, everything would continue to work as normal.
#my $eh = $self->session->errorHandler;
@ -650,8 +650,9 @@ sub isInGroup {
return $isInGroup->{$uid}{$gid} if exists $isInGroup->{$uid}{$gid};
### Lookup the actual groupings.
my $group = WebGUI::Group->new($self->session,$gid);
# Cope with non-existant groups. Default to the admin group if the groupId is invalid.
$group = WebGUI::Group->new($self->session, 3) unless $group;
if ( !$group ) {
$group = WebGUI::Group->new($self->session,3);
}
### Check for groups of groups.
my $users = $group->getAllUsers();
foreach my $user (@{$users}) {