Extension talk:Semantic ACL
This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
Setting up a whitelist
editHi Werdna, just to make sure on how to set up a whitelist:
I will have to insert
The allowed values for this property are: * [[Allows value::User:Werdna]] * [[Allows value::User:Kghbln]]
on page [[Property:Editable by]] to provide edit rights to these two users for the pages containing the property [[Editable by::whitelist]].
Cheers [[kgh]] 21:55, 25 May 2011 (UTC)
- My understanding is that the whitelist should be on the page that one is protecting (or included into it, in a template). So you'd have: I don't think setting these on the property itself does anything. Samwilson (talk) 08:23, 27 June 2012 (UTC)
[[Editable by::whitelist]] [[Editable by user::User:Werdna]] [[Editable by user::User:Kghbln]]
- Heiya Samwilson, thank you for your reply. I just tried your approach with success. I totally misunderstood the instructions provided. I did not grasp that the so called "main" property with one of its values public/users/whitelist is indeed a kind of "parameter" property indicating the contents of the e.g. whitelist
[[Editable by::whitelist]]
likeetc.[[Editable by group::trusted users]] [[Editable by user::User:Kghbln]]
- In case you do not set this "parameter" property one will add groups or users without any result. This is what I have done. Admittedly I would never have guessed this. Do not ask me why. O_o Thank you for helping me out on this one. :) Cheers [[kgh]] (talk) 00:16, 10 July 2012 (UTC)
- Heiya Samwilson, thank you for your reply. I just tried your approach with success. I totally misunderstood the instructions provided. I did not grasp that the so called "main" property with one of its values public/users/whitelist is indeed a kind of "parameter" property indicating the contents of the e.g. whitelist
Display of credits
editHi,
all extensions to Semantic MediaWiki moved to a new section on the version list of MediaWiki on Special:Version specially created for them. For consistency reasons it would be nice to see this one there too. I have looked at the source code of another semantic extension to see how it is done there:
$wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'other']
Thank you and cheers [[kgh]] 16:47, 6 June 2011 (UTC)
It does not work
editHi, I just tested this extension and learned that it does not work. The failsafe does not work since even sysops are not allowed to view and edit pages. Even if I set the permissions on a page for group sysop I am not allowed to view and edit. The same applied after I set a specific user (=me). I tried both English and localised words (User - Benutzer, Sysop - Administrator). I am using SMW 1.5.6 on MW 1.16.5. I would love to see this extension work. Cheers [[kgh]] 22:06, 6 June 2011 (UTC)
- I don't know if things have changed since you wrote, but it seems to be working correctly now. Sam Wilson 08:24, 27 June 2012 (UTC)
- Yeah, I do not know what I did back then. Perhaps it was me, perhaps the extension. I have a feeling that it might very well have been me. :| [[kgh]] (talk) 00:25, 10 July 2012 (UTC)
Promising extension
editThis extension looks very promising. I hope it doesn't get abandoned! Badon 04:00, 7 September 2011 (UTC)
"Editable by" can't be used as a property name on this wiki
editI got this message when trying this extension on this page of my wiki
My conf is (More details):
- MediaWiki 1.21.2
- PHP 5.4.30 (fpm-fcgi)
- MySQL 5.5.14
Had someone the same problem ?
Thanks Nicolas NALLET (talk) 19:49, 17 July 2014 (UTC)
- I have, the same problem, do you have any idea to how fix that?
- in my wiki only works the properties: Visible to, Visible to user; Visible to group... CrystianMarquez (talk) 16:17, 18 December 2014 (UTC)
Use in an added namespace
editRESOLVED | |
Works for any namespaces that are configured for semantic data. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Is there something I can do to get this to work in another namespace? Legaulph (talk) 19:13, 30 June 2016 (UTC)
- If this extension still works it should probably work as soon as this other namespace was enabled for holding semantic data. [[kgh]] (talk) 19:38, 30 June 2016 (UTC)
- That was it
- Thanks 148.177.65.215 (talk) 13:42, 1 July 2016 (UTC)
Not working in mediawiki 1.27.1
editI had an issue when upgrading to 1.27.1 and I was unable to edit anything or get access to admin tools. I disabled the extension and everything is working now. Legaulph (talk) 11:04, 21 September 2016 (UTC)
- Unfortunately I came to this page to report the same thing. Sadly since it's marked unmaintained I expect it's done. The issue seems to be similar to the issue that Extension:Lockdown had before someone patched it.
- @Werdna if this extension was marked wrongly and you're still around it would be awesome if you can fix it. thanks
- @Kghbln turns I mistakenly assumed Lockdown 1.27 was the problem when it was this extension (since the problem was the same as the one described in the talk page for Lockdown). btw, thanks for making the note I added to Semantic Mediawiki about Compatibility Mode (when running Cargo also) much more noticeable. Christharp (talk) 19:35, 17 October 2016 (UTC)
- Thanks Chris for the feedback. Yeah, this extension provides just a first line against curiosity but ... Would be nice to see this come to life again. [[kgh]] (talk) 21:24, 17 October 2016 (UTC)
Download doesn't work with SMW 3.0.0
editRESOLVED | |
Should be fixed, if not download from master. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Currently, the extension is advertised to work with SMW 3.0.0. But the "Download extension" version breaks the wiki, complaining about missing methods.
The Git master seems to work.
Some clarity about which versions are intended to be supported would be helpful. Smith.dan (talk) 06:14, 13 January 2020 (UTC)
- I get it, the tags used to point to a specific version of MediaWiki are behind. I'll try to fix this.
- You can use the master branch for now and it should work. Tinss (talk) 20:30, 13 January 2020 (UTC)
- I've made all release branches from REL1_31 onwoards to point to master. Thanks for pointing that bug out. Tinss (talk) 20:41, 13 January 2020 (UTC)
Query for accessible pages/files
editRESOLVED | |
Filed an RFE. Implemented in most recent version. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
I've got some SMW queries that display image thumbnails and that just show a page link where the image is inaccessible to the current user. Is there a way to filter these queries, so they only select accessible images? If not, is this a feature that could be added? Smith.dan (talk) 00:21, 14 January 2020 (UTC)
- What you seem to want is a page property that informs whether a page is visible to the current user or not. Am I correct?
- Can you give me an example of a query? Tinss (talk) 00:41, 14 January 2020 (UTC)
- Yep.
- {{#ask: [[Category::Photo]] [[is accessible::true]] }}
- Problems with this are 1) the most natural way to do it is with a negation,
![[is restricted:true]]
, which isn't supported, and 2) not sure there's any infrastructure for queries whose results change depending on the current user. So maybe not easily achievable... Smith.dan (talk) 01:32, 14 January 2020 (UTC) - Adding the
is_accessible
system defined page property is easy. There probably is a way to capture with a SMW hook which property is being queried and prevent MediaWiki from caching the page whenis_accessible
is detected. - Can you create a feature request in Phabricator? I'll try to implement this next time I do some maintenance and improvements on the extension. Tinss (talk) 01:50, 14 January 2020 (UTC)
- I've made a patch adding the feature you requested. Any chance you can take it for a spin soon? Tinss (talk) 16:45, 11 February 2020 (UTC)
- I decided to go ahead and approve the change. The most recent version of the extension includes the patch. Tinss (talk) 18:47, 18 February 2020 (UTC)
Using capital letters in group names breaks ACL
editRESOLVED | |
Fixed in Gerrit change 582204. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Just a warning: It took me two hours to discover that the reason that I couldn't get SemanticACL to recognize some additional groups I had added was that those groups used capital letters.
I had followed the instructions at Manual:User rights and Manual:$wgGroupPermissions to add a group to LocalSettings.php:
$wgGroupPermissions['My-Group']['read'] = false;
The pages in question give examples that use capital letters, so I assumed that would work. Unfortunately SemanticACL will not recognize such groups.
This does work:
$wgGroupPermissions['my-group']['read'] = false;
It would be nice if this could be fixed.
Also, SemanticACL uses group names as provided in the configuration file, e.g. it will not recognize 'interface-administrator' as a group because this is actually configured as 'interface-admin'. 81.204.62.80 (talk) 15:29, 9 March 2020 (UTC)
- Thanks a lot. This was a really nasty issue. To additionally help others I added a tip for a generally recommended procedure which was unfortunately not explicitly stated. [[kgh]] (talk) 16:12, 9 March 2020 (UTC)
- Sorry about that. Is this a bug on the MediaWiki side or is there anything in this extension that can be fixed so it does not happen in the future? Tinss (talk) 17:54, 9 March 2020 (UTC)
- I cannot tell exactly since I am not a programmer. Perhaps there is a way for the extension to normalize the group names to small letters no matter what. [[kgh]] (talk) 22:21, 9 March 2020 (UTC)
- Since MediaWiki does not specify whether groups are case sensitive or not but seems to be handling them in a case sensitive way, I've decided like you suggested to normalize the name of the groups when doing a comparison.
- See Gerrit change 582204. Tinss (talk) 21:48, 20 March 2020 (UTC)
Including more than two transclusions on single page gives too few restriction messages
editHello,
I'm trying to create a page that includes three transclusions on it. Each is used to provide a group-specific link for a different user group. The objective is that if someone from group A goes to the page, he does not see the links for groups B and C, someone from group B does not see the links for groups A and C, and so on. The groups are correctly set on each of the source pages.
What I notice is that all three transclusions are indeed included on the page, but only one is hidden from view instead of two. The viewing restriction is only applied to the first transclusion where the group does not match the user's group.
Am I missing something, or is this a bug? 2001:1C00:250C:FAF0:14DE:3A83:4451:356E (talk) 11:58, 27 March 2020 (UTC)
- First, can you do a blank edit (saving the page with no changes to it's content) first on A, B and C and then on the page where the transclusions are? Tell me if it solves your problem.
- Otherwise I'll be happy to investigate the bug.
Tinss (talk) 22:16, 27 March 2020 (UTC)- Unfortunately it does not resolve the issue. 2001:1C00:250C:FAF0:34DD:80B0:8340:ABFA (talk) 07:53, 30 March 2020 (UTC)
- Ok, I'll investigate and work on a fix promptly. Sorry for the inconvenience and thanks for reporting this issue. Tinss (talk) 14:18, 30 March 2020 (UTC)
- I've fixed it in Gerrit change 582411, can you update your extension and give it a go? Tinss (talk) 06:12, 31 March 2020 (UTC)
- I assume I have to use the master version from github for this? If I download the regular release I end up with the version I already have...
- Anyway, the master fails on MW1.34 with an Exception "MWException from line 183 of /var/lib/mediawiki/includes/MagicWord.php: Error: invalid magic word 'SEMANTICACL_PRIVATE_LINK'". Tried running update.php from the MW maintenance folder and it fails with the same error. :(
2001:1C00:250C:FAF0:B012:BB05:1DD9:ACCC (talk) 13:11, 2 April 2020 (UTC)- Thanks for pointing that out, I've updated the releases with the most recent fixes. REL1_34 is now up to master.
- Everything works on my setup, so I suspect on yours it's an issue with localisation.
- Can you try running
php rebuildLocalisationCache.php --force
? - Which language are you using for your wiki? Tinss (talk) 17:57, 2 April 2020 (UTC)
- Can you try running
VisualEditor error message on pages with Semantic ACL properties
editRESOLVED | |
Add to LocalSettings.php: $wgSemanticACLWhitelistIPs = ['127.0.0.1', '::1']; // Or the IP your Parsoid service is connecting from. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Hey,
We have a mediawiki with the Semantic ACL extension and the VisualEditor extension (parsoid). When adding properties like[[Visible to::whitelist]] [[Visible to group::GROUPNAME]]to a page the visual editor stops working. It shows an error message ("Error loading data from server: apierror-visualeditor-docserver-http: HTTP 500. Would you like to retry?"). Source editor works fine.
Without the Semantic ACL text everything works again.
Anyone have an idea how to fix this? 80.108.62.103 (talk) 14:54, 19 May 2020 (UTC)
- I can't seem to replicate the error on my setup. Can you run Parsoid from a console (
node bin/server.js config.yaml
) to get more info on that 500 error? Tinss (talk) 23:47, 19 May 2020 (UTC) - Thank you for your answer! I ran Parsoid from console and got this error:(I've edited out the hostnames)
{"name":"parsoid","hostname":"xxx","pid":10786,"level":60,"logType":"fatal/request","wiki":"wiki$0","title":"Permissions_Test_page","oldId":null,"reqId":null,"userAgent":"VisualEditor-MediaWiki/1.34.1","msg":"API response Error for TemplateRequest: request=; error={\"code\":\"accessdenied\",\"info\":\"You are not allowed to view Permissions Test page.\",\"*\":\"See https://xxx/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.\"}","stack":"Error: API response Error for TemplateRequest: request=; error={\"code\":\"accessdenied\",\"info\":\"You are not allowed to view Permissions Test page.\",\"*\":\"See https://xxx/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.\"}\n at TemplateRequest.ApiRequest._errorObj (/usr/local/www/parsoid/lib/mw/ApiRequest.js:342:9)\n at TemplateRequest._handleJSON (/usr/local/www/parsoid/lib/mw/ApiRequest.js:554:16)\n at TemplateRequest.ApiRequest._logWarningsAndHandleJSON (/usr/local/www/parsoid/lib/mw/ApiRequest.js:447:7)\n at TemplateRequest.ApiRequest._handleBody (/usr/local/www/parsoid/lib/mw/ApiRequest.js:483:7)\n at TemplateRequest.ApiRequest._requestCB (/usr/local/www/parsoid/lib/mw/ApiRequest.js:420:8)\n at Request._callback (/usr/local/www/parsoid/lib/mw/ApiRequest.js:332:35)\n at Request.self.callback (/usr/local/www/parsoid/node_modules/request/request.js:185:22)\n at Request.emit (events.js:315:20)\n at Request.<anonymous> (/usr/local/www/parsoid/node_modules/request/request.js:1157:10)\n at Request.emit (events.js:315:20)\n at IncomingMessage.<anonymous> (/usr/local/www/parsoid/node_modules/request/request.js:1079:12)\n at Object.onceWrapper (events.js:421:28)\n at IncomingMessage.emit (events.js:327:22)\n at endReadableNT (_stream_readable.js:1201:12)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)","longMsg":"API response Error for TemplateRequest: request=; error={\"code\":\"accessdenied\",\"info\":\"You are not allowed to view Permissions Test page.\",\"*\":\"See https://xxx/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.\"}","levelPath":"fatal/request","time":"2020-05-20T08:57:32.612Z","v":0}
- Mediawiki v. 1.34.1, Semantic ACL 0.2b, Semantic Mediawiki 3.1.6, VisualEditor 0.1.1
- I made sure the user is in the whitelisted group but the result is the same if I just whitelist one user and try it like that.
- Does this help? 84.113.230.143 (talk) 09:09, 20 May 2020 (UTC)
- It helps tremendously :) By the looks of it it seem your Parsoid server is being denied access to the page because of it's permissions. Parsoid being a standalone service, it makes requests to the server using it's own PHP session data and not that of your user.
- Can you add this to LocalSettings.php and see what it does?
$wgSemanticACLWhitelistIPs = ['127.0.0.1', '::1']; // Or the IP your Parsoid service is connecting from.
Tinss (talk) 04:01, 21 May 2020 (UTC)- That did the trick! Thank you very much for your help! 80.108.62.103 (talk) 13:21, 25 May 2020 (UTC)
VisualEditor error message on pages with Semantic
editHello,
I got error from parsoid when i user Semaric ACL. Tinss said to put parsoid ip to $wgSemanticACLWhitelistIPs = ['127.0.0.1', '::1']; // Or the IP your Parsoid service is connecting from. I have question can i put the ip with subnet to this properties (192.168.0.0/24). Wiki-wiwat (talk) 09:57, 19 June 2020 (UTC)
- Sorry, you can't specify a subnet. That would be interesting feature to add and easy to implement. Tinss (talk) 03:50, 21 June 2020 (UTC)
Probably my fault, but it's not working
editRESOLVED | |
Visible to::whitelist needed to be added. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Hi.
I followed the installation instructions on Extension:Semantic ACL#Installation. First I installed Semantic Media Wiki an then Semantic ACL.
The Special:Version shows Semantic Media Wiki (3.1.6) and SemanticACL (0.2b) as installed on my MediaWiki (1.34.2), so it seems to be OK.
But when I insert [[Visible to user::User:MyUserName]] all that happens is, that it shows "User:MyUserName" on the page.
Sorry, but I don't get it...did I miss some step setting it up? Could the language maybe be a problem? MW is running in german here?
I would be grateful for help.
Thanks in advance.
HG HGx2007 (talk) 20:51, 24 June 2020 (UTC)
- OK...as I thought...my fault.
- I missunderstood, that Visible to::whitelist has to be there too...as shown in the example. Stupid me. :-( HGx2007 (talk) 12:51, 26 June 2020 (UTC)
- No worries. It's not that obvious, I would have done without it but it was how the extension previously worked so I kept it for compatibility reasons. Tinss (talk) 03:03, 17 July 2020 (UTC)
Recent Changes new page
editHi, I love this extension. One issue I am running in to is that the initial page creation shows a snipped of the text in recent changes. Is there anyway to fix this? ShinyComputers (talk) 20:27, 27 September 2020 (UTC)
- Thank you!
- Yes, it would be possible using these two hooks:
- Can you submit a feature request in phabricator? I'll try adding that feature in the next version. Tinss (talk) 05:23, 6 October 2020 (UTC)
PSA: Lockdown + SemanticACL + SimpleBatchUpload = Private Content in MW
editThis is just a PSA for those wanting a way of providing a protected namespace for private content that is also able to automatically protect files uploaded from a page in that namespace. The goal on my site was to give management a place to upload sensitive management files that are not available to non-management users. Here's how I did it:
- Create a custom namespace called "Management"
- Create a custom rights group called "management"
- Use "Extension:Lockdown" to protect the "Management" namespace for user in the "management" right group
- Use "Extension:SimpleBatchUpload" in a page in the Management namespace to provide the methods of uploading files with a template of
{{Upload|viewedonlyby=management}}
- Modify Template:Upload to test (#ifeq) for property
{{{viewonlyby|}}}
in{{Uploads}}
,- if so, then add
[[Visible to group::management]]
to all files uploaded with that template where|viewonlyby=management
.
- if so, then add
- Use Extension:Semantic_ACL to limit access to the file by group management per the presence of
[[Visible to group::management]]
.
In summary: Custom Namespace + Lockdown + SimpleBatchUpload + SemanticACL produces the overall effect.
Within the security limitations noted by MW, this method provides a very nice way of allowing management to add content that is not visible to non-management users.. a very handy thing for an enterprise site! Revansx (talk) 22:37, 8 October 2020 (UTC)
- The wikitext
{{#batchupload:Upload|viewonlyby=management}}
will create an upload button in a page that will automatically protect any files uploaded by it as long asTemplate:Upload
containsRevansx (talk) 22:49, 8 October 2020 (UTC){{#ifeq:{{{viewonlyby|}}}|management | [[Visible to group::management]] | }}
- Thank you for sharing your tips! Tinss (talk) 11:44, 9 October 2020 (UTC)
page shows whitelisted users
editRESOLVED | |
Use a hidden div or #set.<div style="display:none">[[Visible to::whitelist]]</div> {{#set:Visible to group=moderator}} |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Hello,
unfortunately the pages with restricted access shows
"Test whitelist ehtest whitelist ehtest"
in source editor, I used [[visible to:: whitelist]] [[visible to group:: ehtest]] [[editable by::whitelist]] [[editable by group:: ehtest]]
used only small letters in group name because I read that big letters and spaces may cause trouble
any suggestion or correction to my "code"? 87.163.146.147 (talk) 13:16, 11 November 2020 (UTC)
- Your code is correct. The values are shown in case the ACL status of a page needs to be displayed. To hide it, wrap them in a hidden div:
<div style="display:none;">[[visible to:: whitelist]] [[visible to group:: ehtest]] [[editable by::whitelist]] [[editable by group:: ehtest]]</div>
- Hope this helps. Tinss (talk) 19:54, 11 November 2020 (UTC)
- thank you very much :-)
- ideally, this hidden div woraround would be mentioned in the install explanation 87.163.146.147 (talk) 10:12, 12 November 2020 (UTC)
- Done! Juste remembered you also had the option of using #setTinss (talk) 13:56, 12 November 2020 (UTC)
> <div style="display:none">[[Visible to::whitelist]]</div> {{#set:Visible to group=moderator}}
Semantic ACL doesn't work due to Whitelist?
editHello,
i have installed the Semantic Media Wiki and the SemanticACL extensions today. Sadly i didn't get it to work properly, which is probable my fault. What i have done so far:
1. Added following lines to the LocalSettings.php
- wfLoadExtension( 'SemanticACL' );
require_once "$IP/extensions/SemanticACL/SemanticACL.php"; (i tried both lines)
enableSemantics( 'Wikiname' );
$smwgNamespacesWithSemanticLinks[NS_MAIN] = true; $smwgNamespacesWithSemanticLinks[NS_Test1] = true;
2. I created a page inside the main namespace which contains the following lines:
The User Acltest has normally no rights to edit a page in this namespace and my hope was to give him the rights on this page using your extension. But it doesn't work for me. I also gave him the SMW-Administrator and SMW-Kurator rights but nothing changed. I think it has to do with the whitelist because i can't understand for what this line is used. Is it a page inside the wiki or a special param? Does anybody have an idea what went wrong? Thx in advance. 91.96.129.199 (talk) 15:04, 5 January 2021 (UTC)
- Hello,
- You say that the user Acltest has no rights to edit the page. What is the feature that prevents the user from editing? Is it another extension? A MediaWiki feature?
- Please also provide the wikicode you used to whitelist that user for editing the page. Tinss (talk) 15:11, 5 January 2021 (UTC)
- Sorry forget that code:The feature that prevent the user from editing should be this LocalSetting param: $wgGroupPermissions['user']['edit'] = false; 178.142.109.88 (talk) 15:20, 5 January 2021 (UTC)
<div style="display:none"> [[Editable by ::whitelist]] [[Editable by user::User:Acltest]] </div>
- The code you provided is correct.
- However, I'm pretty sure restrictions from MediaWiki will override those of SemanticACL. I don't really know how one would go about preventing edit access to all pages but one. MediaWiki's design is more toward's openness rather than restriction.
- Maybe if you can define basic rights in Extension:Header Footer so they can apply to all pages? Be careful though, this will disable caching for all pages in your wiki. Tinss (talk) 15:47, 5 January 2021 (UTC)
- Thx for your help, Tinss. I will have to take a look into that Extension. 178.142.109.88 (talk) 16:14, 5 January 2021 (UTC)
Recursive Protection
editIs there a way to protect pages with Semantic ACL recursively?
I want to add the code for protection in the wiki/firstpage page and when a new page e.g. wiki/firstpage/newpage is created it is supposed to be protected too. How is this configurable? 134.60.112.70 (talk) 12:54, 29 June 2021 (UTC)
- Hello,
- It's not possible at the moment, but it's a feature I've wanted to implement for some time. You can check back here in a couple of months to see if this has been done or if you are versed in PHP programming you can definitely contribute a feature to the extension. Tinss (talk) 04:02, 30 June 2021 (UTC)
Output of Pages that are Restricted for Reading
editRESOLVED | |
Set $wgEnablePrivateLinks = false when using MediaWiki 1.31 |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Hello,
Mediawiki:1.31
PHP: 7.2
Ubuntu 18.04
SemanticACL: 0.2b (7b98339)
First of all I want to say thank you for creating this extension. It is easy to install, easy to use and works well 10/10 points on that.
My question is about the output that is shown to users that are not allowed to read a page.
On my wiki when accessing those pages a Internal error is returned:
[ce31e7dd85c22f9f4b3a1d91] /pmbd/index.php/Requirements_directory Error from line 376 of /var/www/html/pmbd/extensions/SemanticACL/SemanticACL.class.php: Call to undefined method MediaWiki\MediaWikiServices::getParserFactory()
Backtrace:
#0 /var/www/html/pmbd/extensions/SemanticACL/SemanticACL.class.php(88): MediaWiki\Extension\SemanticACL\SemanticACL::hasPermission(Title, string, User, boolean)
#1 /var/www/html/pmbd/includes/Hooks.php(177): MediaWiki\Extension\SemanticACL\SemanticACL::onSMWStoreAfterQueryResultLookupComplete(SMW\SQLStore\SQLStore, SMW\Query\QueryResult)
#2 /var/www/html/pmbd/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#3 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(366): Hooks::run(string, array)
#4 /var/www/html/pmbd/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(338): SMW\SQLStore\SQLStore->getQueryResult(SMWQuery)
#5 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(364): SMWQueryProcessor::getResultFromQuery(SMWQuery, array, integer, integer)
#6 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(197): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters(array, array)
#7 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse(array)
#8 /var/www/html/pmbd/includes/parser/Parser.php(3426): SMW\ParserFunctionFactory->SMW\{closure}(Parser, string, string, string, string, string, string, string)
#9 /var/www/html/pmbd/includes/parser/Parser.php(3127): Parser->callParserFunction(PPFrame_DOM, string, array)
#10 /var/www/html/pmbd/includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPFrame_DOM)
#11 /var/www/html/pmbd/includes/parser/Parser.php(2942): PPFrame_DOM->expand(DOMElement, integer)
#12 /var/www/html/pmbd/includes/parser/Parser.php(1293): Parser->replaceVariables(string)
#13 /var/www/html/pmbd/includes/parser/Parser.php(443): Parser->internalParse(string)
#14 /var/www/html/pmbd/includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#15 /var/www/html/pmbd/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#16 /var/www/html/pmbd/includes/poolcounter/PoolWorkArticleView.php(144): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#17 /var/www/html/pmbd/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#18 /var/www/html/pmbd/includes/page/Article.php(604): PoolCounterWork->execute()
#19 /var/www/html/pmbd/includes/actions/ViewAction.php(68): Article->view()
#20 /var/www/html/pmbd/includes/MediaWiki.php(500): ViewAction->show()
#21 /var/www/html/pmbd/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#22 /var/www/html/pmbd/includes/MediaWiki.php(861): MediaWiki->performRequest()
#23 /var/www/html/pmbd/includes/MediaWiki.php(524): MediaWiki->main()
#24 /var/www/html/pmbd/index.php(42): MediaWiki->run()
#25 {main}
Is this the default message or is there a way to output a more user-friendly message when a user without permission is trying to access a page? Or maybe the error is on my side?
Thank you and Best Regards AID-PMBD (talk) 08:50, 2 July 2021 (UTC)
- Thanks for the comments. It's supposed to show a clean message and not a dump like that. The problem is the
MediaWiki\MediaWikiServices::getParserFactory()
call which is only defined in MediaWiki 1.32, which makes this extension incompatible with 1.31. - Can you easily upgrade you MediaWiki installation? Tinss (talk) 22:25, 2 July 2021 (UTC)
- Thank you for the quick reply, outstanding support compared to other extensions I had trouble with.
- Unfortunately I can't easily upgrade my mediawiki due to multiple extensions that are not supported on newer versions. I guess there is no easy workaround for that issue, right? AID-PMBD (talk) 07:22, 5 July 2021 (UTC)
- Is there another way to solve this issue? AID-PMBD (talk) 14:51, 7 July 2021 (UTC)
- I've dug into it and the faulty line is used only for private links. If you do not need that feature, set
$wgEnablePrivateLinks = false
in youLocalSettings.php
. - Then, just comment out line 376 in /var/www/html/pmbd/extensions/SemanticACL/SemanticACL.class.php
- Tell me if that works. Tinss (talk) 01:20, 9 July 2021 (UTC)
- Hello Tinss,
- Thank you for taking the time to look into this.
- So I tried your approach and when commenting out line 376 of the SemanticACL.class.php ( "$parser = \MediaWiki\MediaWikiServices::getInstance()->getParserFactory()->create(); // Use a new parser to avoid interfering with the current parser.") it doesn't work. The wiki returns a white page.
- What worked however, was just setting
$wgEnablePrivateLinks = false
in my LocalSettings.php. - Thanks again for the support. AID-PMBD (talk) 09:08, 13 July 2021 (UTC)
- You're welcome! Tinss (talk) 02:30, 14 July 2021 (UTC)
wgParser has been depricated
editRESOLVED | |
Corrected. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Upgrading to MediaWiki 1361, and getting this error:
Use of $wgParser was deprecated in MediaWiki 1.32. [Called from MediaWiki\Extension\SemanticACL\SemanticACL::hasPermission in /var/www/mediawiki1362/extensions/SemanticACL/SemanticACL.class.php at line 303]
Per the mediawiki manual (Manual:$wgParser), it's a simple change.
I've replaced:
global $wgParser;
with:
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
However, I don't know where to send a pull request to.
-Mitch TazzyTazzy (talk) 05:18, 10 October 2021 (UTC)
- Hello Mitch,
- Thanks for pointing this out.
- Per Manual:$wgParser, you should rather use
\MediaWiki\MediaWikiServices::getInstance()->getParser()
. - Morevover the code for this extension si hosted in Wikimedia's gerrit. Any change you could push a commit for review there? Tinss (talk) 23:15, 12 October 2021 (UTC)
- I'll tackle these after vacation. :-) TazzyTazzy (talk) 23:31, 19 October 2021 (UTC)
Internal Error: Call to a member function getOutput() on null
editRESOLVED | |
Changes pushed after this comment were made resolved the problem :) |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Hello! On 1.39.1 with SMW installed, and I can't import the extension! I get this whenever I have it imported in my LocalSettings:
any tips?8a0b56731bb396857f5ce546] /Main_Page Error: Call to a member function getOutput() on null Backtrace: from /var/www/html/mediawiki/extensions/SemanticACL/SemanticACL.class.php(464) #0 /var/www/html/mediawiki/extensions/SemanticACL/SemanticACL.class.php(321): MediaWiki\Extension\SemanticACL\SemanticACL::disableCaching() #1 /var/www/html/mediawiki/extensions/SemanticACL/SemanticACL.class.php(164): MediaWiki\Extension\SemanticACL\SemanticACL::hasPermission() #2 /var/www/html/mediawiki/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\SemanticACL\SemanticACL::onBadImage() #3 /var/www/html/mediawiki/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook() #4 /var/www/html/mediawiki/includes/HookContainer/HookRunner.php(914): MediaWiki\HookContainer\HookContainer->run() #5 /var/www/html/mediawiki/includes/BadFileLookup.php(80): MediaWiki\HookContainer\HookRunner->onBadImage() #6 /var/www/html/mediawiki/includes/parser/Parser.php(2699): MediaWiki\BadFileLookup->isBadFile() #7 /var/www/html/mediawiki/includes/parser/Parser.php(2458): Parser->handleInternalLinks2() #8 /var/www/html/mediawiki/includes/parser/Parser.php(1639): Parser->handleInternalLinks() #9 /var/www/html/mediawiki/includes/parser/Parser.php(724): Parser->internalParse() #10 /var/www/html/mediawiki/includes/content/WikitextContentHandler.php(301): Parser->parse() #11 /var/www/html/mediawiki/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput() #12 /var/www/html/mediawiki/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput() #13 /var/www/html/mediawiki/includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput() #14 /var/www/html/mediawiki/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached() #15 /var/www/html/mediawiki/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput() #16 /var/www/html/mediawiki/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput() #17 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}() #18 /var/www/html/mediawiki/includes/Revision/RenderedRevision.php(199): call_user_func() #19 /var/www/html/mediawiki/includes/poolcounter/PoolWorkArticleView.php(91): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput() #20 /var/www/html/mediawiki/includes/poolcounter/PoolWorkArticleViewCurrent.php(97): PoolWorkArticleView->renderRevision() #21 /var/www/html/mediawiki/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleViewCurrent->doWork() #22 /var/www/html/mediawiki/includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute() #23 /var/www/html/mediawiki/includes/page/Article.php(714): MediaWiki\Page\ParserOutputAccess->getParserOutput() #24 /var/www/html/mediawiki/includes/page/Article.php(528): Article->generateContentOutput() #25 /var/www/html/mediawiki/includes/actions/ViewAction.php(78): Article->view() #26 /var/www/html/mediawiki/includes/MediaWiki.php(542): ViewAction->show() #27 /var/www/html/mediawiki/includes/MediaWiki.php(322): MediaWiki->performAction() #28 /var/www/html/mediawiki/includes/MediaWiki.php(904): MediaWiki->performRequest() #29 /var/www/html/mediawiki/includes/MediaWiki.php(562): MediaWiki->main() #30 /var/www/html/mediawiki/index.php(50): MediaWiki->run() #31 /var/www/html/mediawiki/index.php(46): wfIndexMain() #32 {main}Sneakers-the-rat (talk) 23:01, 29 March 2023 (UTC)
- This fixes the error, but the extension is not working (on a private wiki, making a page visible to public :(
- https://github.com/sneakers-the-rat/mediawiki-extensions-SemanticACL/commit/d8f526096babe846130c0e6c64dcab2bc3642754 Sneakers-the-rat (talk) 23:33, 29 March 2023 (UTC)
- The error was fixed on a commit dated march 24 but thanks for pointing it out. Tinss (talk) 21:56, 18 April 2023 (UTC)
- Hello ! A user has provided a fix which I need to commit to the codebase. I'll let you know when this is done. Don't hesitate to send me a reminder in two weeks or so in case I forget. Tinss (talk) 01:08, 30 March 2023 (UTC)
- The fix it seems is unrelated. Did you get the extension to work ? Is this a new install or an upgrade ? Tinss (talk) 21:56, 18 April 2023 (UTC)
- Sorry I haven't checked in, Thanks for the quick response! I will try it again tomorrow :) Sneakers-the-rat (talk) 10:27, 29 September 2023 (UTC)
- I'm working on upgrading my wiki to 1.40 and in the process I have fixed many a bug on the extension. The new code should be available in the next weeks. Tinss (talk) 04:06, 1 October 2023 (UTC)
- Whoops, didn't realize i need to mark this as resolved - the problem of not being able to allow pages from a default private wiki remains - https://www.mediawiki.org/w/index.php?title=Topic:Xfa7amqvfghkrno0&topic_showPostId=xfa7amqvfkfmzrm8#flow-post-xfa7amqvfkfmzrm8
- but the install issues are fixed. thanks! Sneakers-the-rat (talk) 23:22, 7 March 2024 (UTC)
Override mediawiki group permissions on private wikis?
editHello again! The extension works great for removing permissions on public wikis (making some pages private), but I can't get the opposite to work - making some pages public on a default private wiki (mw 1.39.1 but i can upgrade!).
I've made the wiki private in the standard way - $wgGroupPermissions['*']['read'] = false;
I've gone through and confirmed that the extension is correctly computing the permission and the expected hooks are called, but still no dice. From reading the PermissionManager.php source, it seems like negative permissions are handled differently - eg. if there is any single check that says permission is denied, then that overrides the rest of them saying permission should be granted.
I know that Lockdown also says that it can only be used to restrict, not grant permissions, but I just have to believe that there is some way to override the permissions checking process! Maybe we would want to put that behind a config variable to check "yes i want Semantic ACL to completely override the rest of the permissions checking process."
Barring that, it should also be possible to remove the GroupPermissions
setting if there was a way of setting a default ACL setting - so Semantic ACL controls all permissions, but by default (when unspecified) pages are set to [[Visible to::user]]
(or whatever one sets the default permission to be).
Let me know if this is possible! I am willing to PR as well :) Sneakers-the-rat (talk) 23:21, 7 March 2024 (UTC)
- Browsing through
PermissionManager.php
, it seems there are enough hooks around to maybe do that. Howerver, I cannot say for sure without actually trying... - The other option would actually be to replace that class with one that is custom to this extension and overrides any method that gets in the way of managing permissions the way we want. That will however make the extension harder to maintain and more prone to breaking when they make updates to MW's core.
- That being said, my MW installation defaults to public, so I would not have an easy way to test that code.
- Would you be willing to provide a patch ? I will be willing to make sure it does not break existing functionnalities and validate your code. Tinss (talk) 23:45, 8 March 2024 (UTC)
- Sorry i am yet again seeing this four months later - i'll try again on a patch since permissions have been modified in recent mediawiki versions :) Sneakers-the-rat (talk) 21:27, 9 July 2024 (UTC)
- Let me know when you're ready for review. Tinss (talk) 17:58, 18 July 2024 (UTC)
Please address deprecated code
editRESOLVED | |
Deprecated code has been patched. |
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
i.e phab:T347127, phab:T304760.
It seems like we've ended up in a situation in which a Phabricator project was created despite Phabricator not serving as the canonical issue tracker, which seems unideal and almost led me to mark this as unmaintained when I found it in Category:ParserFetchTemplate extensions * Pppery * it has begun 20:24, 16 June 2024 (UTC)
- I'm the maintainer and there are no other issue trackers. I'll get to it (as there are other upgrades I want to make).
- Can I tag you on gerrit for code review ? Tinss (talk) 20:35, 16 June 2024 (UTC)
- I don't have the right to merge patches anywhere, but sure I'm willing to look at some.
- (I'm not actually running this extension anywhere, just trying to make MediaWiki.org look more up to date by cleaning Category:Extensions using removed hooks) * Pppery * it has begun 20:36, 16 June 2024 (UTC)
- Thanks for doing that underlooked but nonetheless very important task ;)
- I'll let you know when patches are up for review. Tinss (talk) 21:40, 16 June 2024 (UTC)
- The patches for phab:T347127 and phab:T304760 have been applied. Tinss (talk) 04:08, 23 August 2024 (UTC)
- Left some feedback on the patch. Thanks. * Pppery * it has begun 04:33, 23 August 2024 (UTC)