Topic: Suggested patch of userapi_getPub to enable editing of onw publication that are not online
Converted
avatar
12
Posts: 0

Posted:
29.Aug 2008 - 10:02

Hi,

It's been a while since I posted here. Working on a site where a publication gets created containing a user 'profile' and allowing users to change their own publications I ran into a problem in the getPub function in the userapi. I've patched this (6.3.0.0 pnuserapi.php from line 656):

Code

$getOwnOnly = false;



if (!pnSecAuthAction(0, 'pagesetter::', "$tid:$pid:", pagesetterAccessEditor))

if ($useRestrictions === false)

$useRestrictions = true;



if ($id == null)

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid:$pid:", ACCESS_READ))

return pagesetterErrorApi(__FILE__, __LINE__, _PGNOAUTH);



if ($useRestrictions === null)

$useRestrictions = true;



$referenceType = 'pid';

}

else

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid::", pagesetterAccessAuthor))

return pagesetterErrorApi(__FILE__, __LINE__, _PGNOAUTH);



if ($pubInfo['publication']['enableEditOwn'])

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid::", pagesetterAccessEditor))

$getOwnOnly = true;

}

else

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid::", pagesetterAccessEditor))

return pagesetterErrorApi(__FILE__, __LINE__, _PGNOAUTH);

}



if ($useRestrictions === null)

$useRestrictions = false;



$referenceType = 'id';

}


to this

Code

$editOwnEnabled = $pubInfo['publication']['enableEditOwn'];

$getOwnOnly = false;



if (!pnSecAuthAction(0, 'pagesetter::', "$tid:$pid:", pagesetterAccessEditor))

{

if ($useRestrictions === false)

{

if (!$editOwnEnabled)

$useRestrictions = true;

}

}



if ($id == null)

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid:$pid:", ACCESS_READ))

return pagesetterErrorApi(__FILE__, __LINE__, _PGNOAUTH);



if ($useRestrictions === null)

{

if (!$editOwnEnabled)

$useRestrictions = true;

}



$referenceType = 'pid';

}

else

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid::", pagesetterAccessAuthor))

return pagesetterErrorApi(__FILE__, __LINE__, _PGNOAUTH);



if ($pubInfo['publication']['enableEditOwn'])

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid::", pagesetterAccessEditor))

$getOwnOnly = true;

}

else

{

if (!pnSecAuthAction(0, 'pagesetter::', "$tid::", pagesetterAccessEditor))

return pagesetterErrorApi(__FILE__, __LINE__, _PGNOAUTH);

}



if ($useRestrictions === null)

$useRestrictions = false;



$referenceType = 'id';

}


Hope this might be of assistance.



edited by: BertRoefs, Aug 29, 2008 - 02:06 PM