The constant DB_SLAVE, deprecated in 1.28, has been removed. Use DB_REPLICA.
PrivatePageProtection.php
$dbr = wfGetDB( DB_SLAVE ); # OLD
$dbr = wfGetDB( DB_REPLICA ); # NEW
The constant DB_SLAVE, deprecated in 1.28, has been removed. Use DB_REPLICA.
PrivatePageProtection.php
$dbr = wfGetDB( DB_SLAVE ); # OLD
$dbr = wfGetDB( DB_REPLICA ); # NEW
it resolved it self
Hi All,
I'm not a php developer and I know this extension is no longer maintained but I was wondering if anyone knew how to use the allow-group to protect a page that only 1 group of users can see (e.g. using "#allow-groups:mycustomgroup" at the top of a page) and still have visual editor work on this page? The Parsoid user that runs VisualEditor is a member of all the groups in existence and I know it's this thats restricting the page as when I remove the "#allow-groups:mycustomgroup" it works.
Many thanks in Advance
Open PrivatePageProtection.php
under the function:
function privateppGetAccessError( $groups, $user ) {
under line 115:
if ( is_string( $groups ) ) $groups = explode('|', $groups);
add
if(! is_string( $groups ) && strpos($groups[0], '|') !== false) $groups = explode('|', $groups[0]);
then the extension works fine.
I'm about to remove obsolete ArticleSave-hook an replace it with PageContentSave, but got two problems:
$wgHooks['PageContentSave'][] = 'privateppPageContentSave'; ... function privateppPageContentSave( $wikiPage, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $status) { # prevent users from saving a page with access restrictions that # would lock them out of the page. $article=Article::newFromId($wikiPage->getId()); $text = $content->getNativeData(); #XXX: calling prepareTextForEdit() causes the text to be parsed, because it is not parsed # yet: groups is empty # $parserOutput=$article->getParserOutput(); # $groups = $parserOutput->getProperty('ppp_allowed_groups'); $editInfo = $article->prepareTextForEdit( $text, null, $user ); $groups = $editInfo->output->getProperty('ppp_allowed_groups'); $err = privateppGetAccessError( $groups, $user ); if ( $err ) { $status->fatal('privatepp-lockout-prevented',$groups,0); return false; } #XXX does not store the groups into page_props # $editInfo->output->setProperty('ppp_allowed_groups', $groups); /* set */ $row = [ 'pp_value' => $groups ]; /* where */ $conditions = [ 'pp_page' => $wikiPage->getId(), 'pp_propname' => 'ppp_allowed_groups' ]; $dbw = wfGetDB( DB_MASTER ); if(!isset($groups) || strlen($groups) == 0 ) { $dbw->delete( 'page_props', $conditions, __METHOD__ ); } else { $dbw->update( 'page_props', $row, $conditions, __METHOD__ ); if($result = $dbw->affectedRows() < 1) { $row = [ 'pp_page' => $wikiPage->getId(), 'pp_propname' => 'ppp_allowed_groups', 'pp_value' => $groups ] ; $dbw->insert( 'page_props', $row, __METHOD__, 'IGNORE' ); } } return true; }
Hi, I have 2 groups which might have access to specific pages but I can't get it to work.
If I enter
{{#allow-groups:Trusted}}
when logged on as the Admin-user who also belongs to the Trusted group after saving the page I get:
You do not have permission to edit this page, for the following reason:
<privatepp-lockout-prevented>
Same when I use
{{#allow-groups:sysop}} or {{#allow-groups:sysop|Trusted}}
Hi.
It appears you cannot capitalize the user group. If you change it to "trusted" then it will work. In fact, if there are capitals anywhere, the entire statement seems to fail.
You also need to apply the patch listed a few posts below.
Just seeing this now, but a 'long time ago' we opted for the accesscontrol-plugin.
Can't find snapshot on provided link.
Is there any change in name or this extension is just removed from mediawiki repo?
Hi. I followed the installation instructions. PrivatePageProtection is shown under the Special Pages:Version section.
This is the test I made:
Users: User A: administrator User B: non-administrator
I created a page and added: {{#allow-groups:sysop}}
User B can still access the page. Not sure what I'm doing wrong here..
I also created a new group called group1 by adding this line to LocalSettins.php:
wgGroupPermissions['group1']['read'] = false;
I added User A to group1, and then tried to restrict access to the page by including:
{{#allow-groups:group1}}
However, I can't even save the page.. seems like the extension doesn't recognize this custom-made group.
Please help.
Thanks!
Hi, I think it should be wgGroupPermissions['group1']['read'] = true;
. Cheers,
Hi,
what do you think about an information in the footer, telling me the allowed groups permanently? Currently I have to edit the page each time, to find out the allowed groups. It will be great, if you can show it for example in the footer or elsewhere. Perhaps you can tell me, how to get it.
Thank you!
Hello Duesentrieb,
there is a bug in your actual code. The db result from privateppGetAllowedGroups returns as an array, but the calling methods expect a string. After fixing this problem (return $result[0] instead of return $result), the extension runs fine.
Ver: MW 1.18.1 OS: Windows and Linux
It doesn't work. You can goto https://offgridops.org/foreclosurepedia/index.php/A2ZFS to better understand. In the view source it posts:
{{#allow-groups:fcpd}}
You do not have permission to edit this page, for the following reasons: The action you have requested is limited to users in one of the groups: Users, fcpd. The action you have requested is limited to users in the group: fcpd.
Yes, I set the group up:
$wgGroupPermissions['fcpd']['move'] = true; $wgGroupPermissions['fcpd']['move-subpages'] = true; $wgGroupPermissions['fcpd']['move-rootuserpages'] = true; // can move root userpages //$wgGroupPermissions['user']['movefile'] = true; // Disabled for now due to possible bugs and security concerns $wgGroupPermissions['fcpd']['read'] = true; $wgGroupPermissions['fcpd']['edit'] = true; $wgGroupPermissions['fcpd']['createpage'] = true; $wgGroupPermissions['fcpd']['createtalk'] = true; $wgGroupPermissions['fcpd']['writeapi'] = true; $wgGroupPermissions['fcpd']['upload'] = true; $wgGroupPermissions['fcpd']['reupload'] = true; $wgGroupPermissions['fcpd']['reupload-shared'] = true; $wgGroupPermissions['fcpd']['minoredit'] = true; $wgGroupPermissions['fcpd']['purge'] = true; // can use ?action=purge without clicking "ok" $wgGroupPermissions['fcpd']['sendemail'] = true;