per wobject privileges

This commit is contained in:
JT Smith 2003-06-22 16:15:49 +00:00
parent 4612a88f96
commit 3f4e5f3fbd
17 changed files with 2623 additions and 2444 deletions

View file

@ -24,7 +24,11 @@ our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy);
#-------------------------------------------------------------------
sub _duplicateWobjects {
my ($sth, $wobject, $cmd, %hash, $extra, $w);
my ($sth, $wobject, $cmd, %hash, $extra, $w, %properties, $page);
tie %properties, 'Tie::CPHash';
#-- Added by Frank Dillon. Get page privilege information for the package
$page = WebGUI::SQL->quickHashRef("select ownerId,groupIdView,groupIdEdit from page where pageId=".quote($_[0]));
#-- End Changes
$sth = WebGUI::SQL->read("select * from wobject where pageId=$_[0] order by sequenceNumber");
while ($wobject = $sth->hashRef) {
$extra = WebGUI::SQL->quickHashRef("select * from ${$wobject}{namespace} where wobjectId=${$wobject}{wobjectId}");
@ -34,6 +38,13 @@ sub _duplicateWobjects {
$cmd = "WebGUI::Wobject::".${$wobject}{namespace};
$w = $cmd->new($wobject);
$w->duplicate($_[1]);
#-- Added by Frank Dillon. Set privileges for newly duplicated wobjects
%properties=();
$properties{ownerId} = ${$page}{ownerId};
$properties{groupIdView} = ${$page}{groupIdView};
$properties{groupIdEdit} = ${$page}{groupIdEdit};
$w->set(\%properties);
#-- End Changes
}
$sth->finish;
}

View file

@ -32,10 +32,25 @@ our @EXPORT = qw(&www_viewPageTree &www_movePageUp &www_movePageDown
&www_editPageSave &www_pastePage &www_moveTreePageUp
&www_moveTreePageDown &www_moveTreePageLeft &www_moveTreePageRight);
#Method Added By Frank Dillon - Changes Wobject Privileges on a page
#-------------------------------------------------------------------
sub _changeWobjectPrivileges {
my($wobject,$sth);
$sth = WebGUI::SQL->read("select wobjectId from wobject where pageId=".quote($_[0]));
while ($wobject = $sth->hashRef) {
if (WebGUI::Privilege::canEditWobject($wobject->{wobjectId})) {
WebGUI::SQL->write("update wobject set startDate=$session{form}{startDate}, endDate=$session{form}{endDate}, ownerId=$session{form}{ownerId}, groupIdView=$session{form}{groupIdView}, groupIdEdit=$session{form}{groupIdEdit} where wobjectId=".quote($wobject->{wobjectId}));
}
}
}
#-------------------------------------------------------------------
sub _recursivelyChangePrivileges {
my ($sth, $pageId);
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
#--Added By Frank Dillon - Change the Wobject Privileges on the current page
_changeWobjectPrivileges($_[0]);
#--End Changes
while (($pageId) = $sth->array) {
if (WebGUI::Privilege::canEditPage($pageId)) {
WebGUI::SQL->write("update page set startDate=$session{form}{startDate},

View file

@ -123,6 +123,7 @@ sub www_editContentSettings {
-intervalValue=>$data[0],
-unitsValue=>$data[1]
);
$f->yesNo("wobjectPrivileges",WebGUI::International::get(979),$session{setting}{wobjectPrivileges});
$f->submit;
$output .= $f->print;
return _submenu($output);