fix 11768 Edit Branch does not update wgaccess

I can't seem to reproduce this problem in the tests...
This commit is contained in:
Doug Bell 2010-08-10 18:21:16 -05:00
parent b45c693802
commit bd4e7a2ec0
3 changed files with 41 additions and 3 deletions

View file

@ -12,6 +12,7 @@
- fixed #11771: Default Newsletter template not set
- fixed #11432: DataTable date input
- fixed #11772: Metadata in Post doesn't set default value correctly
- fixed #11768: Edit Branch does not update File wgaccess permissions
7.9.10
- fixed #11721: spamStopWords not in WebGUI.conf.original

View file

@ -59,6 +59,7 @@ sub addRevision {
if ($newSelf->get("storageId") && $newSelf->get("storageId") eq $self->get('storageId')) {
my $newStorage = $self->getStorageClass->get($self->session,$self->get("storageId"))->copy;
$newSelf->update({storageId => $newStorage->getId});
$newSelf->applyConstraints;
}
return $newSelf;

View file

@ -21,10 +21,11 @@ use WebGUI::Test;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset::File;
use JSON;
use Test::More; # increment this value for each test you create
use Test::Deep;
plan tests => 10;
plan tests => 13;
#TODO: This script tests certain aspects of WebGUI::Storage and it should not
@ -47,7 +48,7 @@ cmp_bag($storage->getFiles, ['someScalarFile.txt'], 'Only 1 file in storage with
$session->user({userId=>3});
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"File Asset test"});
my $guard1 = cleanupGuard($versionTag);
my $guard1 = WebGUI::Test::addToCleanup($versionTag);
my $properties = {
# '1234567890123456789012'
id => 'FileAssetTest000000012',
@ -85,11 +86,46 @@ $versionTag->commit;
############################################
my $fileStorage = WebGUI::Storage->create($session);
my $guard2 = cleanupGuard($fileStorage);
WebGUI::Test::addToCleanup($fileStorage);
$mocker->set_always('getValue', $fileStorage->getId);
my $fileFormStorage = $asset->getStorageFromPost();
isa_ok($fileFormStorage, 'WebGUI::Storage', 'Asset::File::getStorageFromPost');
#----------------------------------------------------------------------------
# Test override of update to set permissions
$asset->update({ ownerUserId => '3', groupIdView => '3' });
my $privs = JSON->new->decode( $asset->getStorageLocation->getFileContentsAsScalar('.wgaccess') );
cmp_deeply(
$privs,
{
"assets" => [],
"groups" => superbagof( "3" ),
"users" => ["3"],
},
'update sets the correct permissions in wgaccess',
);
#----------------------------------------------------------------------------
# Add another new revision, changing the privs
my $newRev = $asset->addRevision( { ownerUserId => '3', groupIdView => '3' }, time + 5 );
WebGUI::Test::addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
$privs = JSON->new->decode( $newRev->getStorageLocation->getFileContentsAsScalar('.wgaccess') );
cmp_deeply(
$privs,
{
"assets" => [],
"groups" => superbagof( "3" ),
"users" => ["3"],
},
'addRevision sets the correct permissions in wgaccess',
);
# Add a new revision, changing the privs
my $newRev = $asset->addRevision( { groupIdView => '7' }, time + 8 );
WebGUI::Test::addToCleanup( WebGUI::VersionTag->getWorking( $session ) );
is( $newRev->getStorageLocation->getFileContentsAsScalar('.wgaccess'), undef, "wgaccess doesn't exist" );
note( @{ $newRev->getStorageLocation->getFiles() } );
############################################
#
# www_view