added privilege access handler to storage system

This commit is contained in:
JT Smith 2004-12-31 04:00:24 +00:00
parent 8c77e3dfb7
commit de282a98b5
10 changed files with 124 additions and 10 deletions

View file

@ -878,12 +878,12 @@ sub setRank {
if (isBetween($sibling->getRank, $newRank, $currentRank)) {
$sibling->cascadeLineage($previous);
$previous = $sibling->get("lineage");
$sibling->updateHistory("changed rank");
}
}
$self->cascadeLineage($previous,$temp);
$self->{_properties}{lineage} = $previous;
WebGUI::SQL->commit;
$self->updateHistory("changed rank");
return 1;
}

View file

@ -160,8 +160,11 @@ sub processPropertiesFromFormPost {
$data{url} = $self->getParent->getUrl.'/'.$filename unless ($session{form}{url});
$self->update(\%data);
$self->setSize($storage->getFileSize($filename));
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
} else {
$storage->delete;
my $storage = WebGUI::Storage->get($self->get("storageId"));
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
}
}

View file

@ -25,6 +25,7 @@ use WebGUI::Config;
use WebGUI::ErrorHandler;
use WebGUI::SQL;
use WebGUI::Utility;
use URI::Escape;
our @ISA = qw(Exporter);
our @EXPORT = qw(%session);
@ -344,7 +345,7 @@ sub open {
###----------------------------
### cookies
foreach ($session{cgi}->cookie) {
$session{cookie}{$_} = $session{cgi}->cookie($_);
$session{cookie}{$_} = $session{cgi}->cookie($_);
}
###----------------------------
### session variables

View file

@ -65,6 +65,7 @@ This package provides a mechanism for storing and retrieving files that are not
$store->delete;
$store->deleteFile($filename);
$store->rename($filename, $newFilename);
$store->setPrivileges($userId, $groupIdView, $groupIdEdit);
=head1 METHODS
@ -603,6 +604,36 @@ sub renameFile {
}
#-------------------------------------------------------------------
=head2 setPrivileges ( ownerUserId, groupIdView, groupIdEdit )
Set filesystem level privileges for this file. Used with the uploads access handler.
=head3 ownerUserId
The userId of the owner of this storage location.
=head3 groupIdView
The groupId that is allowed to view the files in this storage location.
=head3 groupIdEdit
The groupId that is allowed to edit the files in this storage location.
=cut
sub setPrivileges {
my $self = shift;
my $owner = shift;
my $viewGroup = shift;
my $editGroup = shift;
$self->addFileFromScalar(".wgaccess",$owner."\n".$viewGroup."\n".$editGroup);
}
#-------------------------------------------------------------------
=head2 tar ( filename )