There's a protect link available in articles. Clicking on that link lists only "block unregistered users" and "Sysops". Why the other mediawiki user groups are not listed there?
Regards,
Jack
This electronic mail (including any attachment thereto) may be confidential and privileged and is intended only for the individual or entity named above. Any unauthorized use, printing, copying, disclosure or dissemination of this communication may be subject to legal restriction or sanction. Accordingly, if you are not the intended recipient, please notify the sender by replying to this email immediately and delete this email (and any attachment thereto) from your computer system...Thank You
Hi All:
Can somebody please explain how the namespace protection works in v1.10 and how to implement it?
I have several namespaces defined in my LocalSettings.php (see code below). I want to be able to create user groups for each namespace and allow only that group associated with the namespace (and sysops of course) permission to edit pages (still allow others to read).
# # Custom Namespaces #
$wgExtraNamespaces = array(100 => "CSE",101 => "CSE_talk", 102 => "IT",103 => "IT_talk", 104 => "MarCom",105 => "MarCom_talk", 106 => "OPS",107 => "OPS_talk", 108 => "Sales",109 => "Sales_talk", );
# # End Custom Namespaces #
Also, is there a way to allow a specific user group read permission to only the main namespace and an additional namespace (ex. only Main & Sales)?
I just need to be pointed in the right direction. I've read the meta pages and I guess I just don't understand...
Thanks guys!
----------------------------- Jason Spirko Systems Administrator Xoran Technologies Inc.
.................................................................................... This message (including any attachments) contains confidential and proprietary information intended only for the addressee. If you are not the intended recipient, please notify the sender immediately by responding to this e-mail, and delete this message and attachments from your system. If you have any questions about this e-mail please notify the sender immediately. Any unauthorized disclosure, copying, distribution or reliance on the contents of this information is strictly prohibited and may constitute a violation of law.
Jason Spirko wrote:
Hi All:
Can somebody please explain how the namespace protection works in v1.10 and how to implement it?
You need an extension to protect per namespace, thus the method used will greatly vary with the extension chosen.
I have several namespaces defined in my LocalSettings.php (see code below). I want to be able to create user groups for each namespace and allow only that group associated with the namespace (and sysops of course) permission to edit pages (still allow others to read).
# # Custom Namespaces #
$wgExtraNamespaces = array(100 => "CSE",101 => "CSE_talk", 102 => "IT",103 => "IT_talk", 104 => "MarCom",105 => "MarCom_talk", 106 => "OPS",107 => "OPS_talk", 108 => "Sales",109 => "Sales_talk", );
# # End Custom Namespaces #
Also, is there a way to allow a specific user group read permission
to only
the main namespace and an additional namespace (ex. only Main & Sales)?
Grant everybody else a permission to read the other namespaces.
I just need to be pointed in the right direction. I've read the meta pages and I guess I just don't understand...
Your could use a code like this:
$wgPrivateNamespaces = array(); $wgHooks['userCan'][] = 'wfCheckNamespace';
function wfCheckNamespace( $title, $user, $action, &$result) { global $wgPrivateNamespaces; if ( $action == 'read' ) { if ( in_array( $title->getNamespace(), $wgPrivateNamespacesRead ) ) { if ( !$user->isAllowed( $wgPrivateNamespacesRead[ $title->getNamespace() ] ) ) { $result = false; return false; } } } else if ( in_array( $title->getNamespace(), $wgPrivateNamespaces ) ) { if ( !$user->isAllowed( $wgPrivateNamespaces[ $title->getNamespace() ] ) ) { $result = false; return false; } } } return true; }
$wgPrivateNamespaces[100] = 'editCSE'; $wgPrivateNamespaces[101] = 'editCSE'; $wgPrivateNamespaces[102] = 'editIT'; $wgPrivateNamespaces[103] = 'editIT'; $wgPrivateNamespaces[104] = 'editMarCom'; ...
$wgGroupPermissions['CSE']['editCSE'] = true; $wgGroupPermissions['IT']['editIT'] = true; $wgGroupPermissions['MarCom']['editMarCom'] = true; ...
$wgGroupPermissions['sysop']['editCSE'] = true; $wgGroupPermissions['sysop']['editIT'] = true; $wgGroupPermissions['sysop']['editMarCom'] = true;
...
//Restrict reading of CSE, IT, MarCom and OPS (and talk) namespaces $wgPrivateNamespacesRead[100] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[101] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[102] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[103] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[104] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[105] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[106] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[107] = 'readMoreNamespaces';
//to read them you need to be registered $wgGroupPermissions['user' ]['readMoreNamespaces'] = true;
I practically copied PrivateNamespaces extension by amidaniel. Use at your own risk. If you know a bit of PHP, you should be able to customize it to do whatever you want.
I thought the new version of MediaWiki provides namespace protection which is supposed to define who is able to edit a namespace. Am I just misunderstanding the purpose of this?
http://www.mediawiki.org/wiki/Manual:$wgNamespaceProtection
In regards to the code below, should I be able to make a separate PHP file and call it from LocalSettings.php?
Thanks again!
----------------------------------- Jason Spirko Systems Administrator Xoran Technologies
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Platonides Sent: Wednesday, July 25, 2007 12:30 PM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] v1.10.1 - Namespace Protection
Jason Spirko wrote:
Hi All:
Can somebody please explain how the namespace protection works in v1.10 and how to implement it?
You need an extension to protect per namespace, thus the method used will greatly vary with the extension chosen.
I have several namespaces defined in my LocalSettings.php (see code
below).
I want to be able to create user groups for each namespace and allow only that group associated with the namespace (and sysops of course) permission to edit pages (still allow others to read).
# # Custom Namespaces #
$wgExtraNamespaces = array(100 => "CSE",101 => "CSE_talk", 102 => "IT",103 => "IT_talk", 104 => "MarCom",105 => "MarCom_talk", 106 => "OPS",107 => "OPS_talk", 108 => "Sales",109 => "Sales_talk", );
# # End Custom Namespaces #
Also, is there a way to allow a specific user group read permission
to only
the main namespace and an additional namespace (ex. only Main & Sales)?
Grant everybody else a permission to read the other namespaces.
I just need to be pointed in the right direction. I've read the meta pages and I guess I just don't understand...
Your could use a code like this:
$wgPrivateNamespaces = array(); $wgHooks['userCan'][] = 'wfCheckNamespace';
function wfCheckNamespace( $title, $user, $action, &$result) { global $wgPrivateNamespaces; if ( $action == 'read' ) { if ( in_array( $title->getNamespace(), $wgPrivateNamespacesRead ) ) { if ( !$user->isAllowed( $wgPrivateNamespacesRead[ $title->getNamespace() ] ) ) { $result = false; return false; } } } else if ( in_array( $title->getNamespace(), $wgPrivateNamespaces ) ) { if ( !$user->isAllowed( $wgPrivateNamespaces[ $title->getNamespace() ] ) ) { $result = false; return false; } } } return true; }
$wgPrivateNamespaces[100] = 'editCSE'; $wgPrivateNamespaces[101] = 'editCSE'; $wgPrivateNamespaces[102] = 'editIT'; $wgPrivateNamespaces[103] = 'editIT'; $wgPrivateNamespaces[104] = 'editMarCom'; ...
$wgGroupPermissions['CSE']['editCSE'] = true; $wgGroupPermissions['IT']['editIT'] = true; $wgGroupPermissions['MarCom']['editMarCom'] = true; ...
$wgGroupPermissions['sysop']['editCSE'] = true; $wgGroupPermissions['sysop']['editIT'] = true; $wgGroupPermissions['sysop']['editMarCom'] = true;
...
//Restrict reading of CSE, IT, MarCom and OPS (and talk) namespaces $wgPrivateNamespacesRead[100] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[101] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[102] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[103] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[104] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[105] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[106] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[107] = 'readMoreNamespaces';
//to read them you need to be registered $wgGroupPermissions['user' ]['readMoreNamespaces'] = true;
I practically copied PrivateNamespaces extension by amidaniel. Use at your own risk. If you know a bit of PHP, you should be able to customize it to do whatever you want.
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
.................................................................................... This message (including any attachments) contains confidential and proprietary information intended only for the addressee. If you are not the intended recipient, please notify the sender immediately by responding to this e-mail, and delete this message and attachments from your system. If you have any questions about this e-mail please notify the sender immediately. Any unauthorized disclosure, copying, distribution or reliance on the contents of this information is strictly prohibited and may constitute a violation of law.
Jason Spirko wrote:
I thought the new version of MediaWiki provides namespace protection which is supposed to define who is able to edit a namespace. Am I just misunderstanding the purpose of this?
You're right, i missed it. Jsut change what i called $wgPrivateNamespaces by $wgNamespaceProtection.
For restricting read you still need an extension.
In regards to the code below, should I be able to make a separate PHP file and call it from LocalSettings.php?
Sure. It ended up being much longer than what i expected.
I added the code as you suggested below. What I have is a custom settings file that I call at the end of the LocalSettings.php file called "xoran_custom.php". I have added your code to the end of this file. But now I receive the following error when accessing the wiki:
Parse error: syntax error, unexpected '}' in C:...\wiki\includes\xoran_custom.php on line 118
Here is the code pasted from the xoran_custom.php:
<---- Begin Code ---->
# # Restrict access to custom namespaces # $wgPrivateNamespaces = array(); $wgHooks['userCan'][] = 'wfCheckNamespace'; function wfCheckNamespace( $title, $user, $action, &$result) { global $wgPrivateNamespaces; if ( $action == 'read' ) { if ( in_array( $title->getNamespace(), $wgPrivateNamespacesRead ) ) { if ( !$user->isAllowed( $wgPrivateNamespacesRead[ $title->getNamespace() ] ) ) { $result = false; return false; } } } else if ( in_array( $title->getNamespace(), $wgPrivateNamespaces ) ) { if ( !$user->isAllowed( $wgPrivateNamespaces[ $title->getNamespace() ] ) ) { $result = false; return false; } } } return true; Line 118 --> } $wgPrivateNamespaces[100] = 'edit_CSE'; $wgPrivateNamespaces[101] = 'edit_CSE'; $wgPrivateNamespaces[102] = 'edit_IT'; $wgPrivateNamespaces[103] = 'edit_IT'; // create new user groups to allow namespace editing $wgGroupPermissions['CSE']['edit_CSE'] = true; $wgGroupPermissions['IT']['edit_IT'] = true; // give sysop permission to edit all namespaces $wgGroupPermissions['sysop']['edit_CSE'] = true; $wgGroupPermissions['sysop']['edit_IT'] = true; //Restrict reading of CSE & IT (and talk) namespaces $wgPrivateNamespacesRead[100] = 'read_CSE'; $wgPrivateNamespacesRead[101] = 'read_CSE'; $wgPrivateNamespacesRead[102] = 'read_IT'; $wgPrivateNamespacesRead[103] = 'read_IT'; // give employees permission to read all namespaces $wgGroupPermissions['xoran']['read_CSE'] = true; $wgGroupPermissions['xoran']['read_IT'] = true; // give distributor access to CSE namespace only // <---- End Code ---->
I apologize for the lengthy code paste, but I am just a beginner when it comes to PHP so please bear with me.
I really appreciate your help, I'm excitied to get this working...it will make things so much easier to administer.
Thanks.
----------------------------- Jason Spirko Systems Administrator Xoran Technologies Inc.
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Platonides Sent: Wednesday, July 25, 2007 12:30 PM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] v1.10.1 - Namespace Protection
Jason Spirko wrote:
Hi All:
Can somebody please explain how the namespace protection works in v1.10 and how to implement it?
You need an extension to protect per namespace, thus the method used will greatly vary with the extension chosen.
I have several namespaces defined in my LocalSettings.php (see code
below).
I want to be able to create user groups for each namespace and allow only that group associated with the namespace (and sysops of course) permission to edit pages (still allow others to read).
# # Custom Namespaces #
$wgExtraNamespaces = array(100 => "CSE",101 => "CSE_talk", 102 => "IT",103 => "IT_talk", 104 => "MarCom",105 => "MarCom_talk", 106 => "OPS",107 => "OPS_talk", 108 => "Sales",109 => "Sales_talk", );
# # End Custom Namespaces #
Also, is there a way to allow a specific user group read permission
to only
the main namespace and an additional namespace (ex. only Main & Sales)?
Grant everybody else a permission to read the other namespaces.
I just need to be pointed in the right direction. I've read the meta pages and I guess I just don't understand...
Your could use a code like this:
$wgPrivateNamespaces = array(); $wgHooks['userCan'][] = 'wfCheckNamespace';
function wfCheckNamespace( $title, $user, $action, &$result) { global $wgPrivateNamespaces; if ( $action == 'read' ) { if ( in_array( $title->getNamespace(), $wgPrivateNamespacesRead ) ) { if ( !$user->isAllowed( $wgPrivateNamespacesRead[ $title->getNamespace() ] ) ) { $result = false; return false; } } } else if ( in_array( $title->getNamespace(), $wgPrivateNamespaces ) ) { if ( !$user->isAllowed( $wgPrivateNamespaces[ $title->getNamespace() ] ) ) { $result = false; return false; } } } return true; }
$wgPrivateNamespaces[100] = 'editCSE'; $wgPrivateNamespaces[101] = 'editCSE'; $wgPrivateNamespaces[102] = 'editIT'; $wgPrivateNamespaces[103] = 'editIT'; $wgPrivateNamespaces[104] = 'editMarCom'; ...
$wgGroupPermissions['CSE']['editCSE'] = true; $wgGroupPermissions['IT']['editIT'] = true; $wgGroupPermissions['MarCom']['editMarCom'] = true; ...
$wgGroupPermissions['sysop']['editCSE'] = true; $wgGroupPermissions['sysop']['editIT'] = true; $wgGroupPermissions['sysop']['editMarCom'] = true;
...
//Restrict reading of CSE, IT, MarCom and OPS (and talk) namespaces $wgPrivateNamespacesRead[100] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[101] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[102] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[103] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[104] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[105] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[106] = 'readMoreNamespaces'; $wgPrivateNamespacesRead[107] = 'readMoreNamespaces';
//to read them you need to be registered $wgGroupPermissions['user' ]['readMoreNamespaces'] = true;
I practically copied PrivateNamespaces extension by amidaniel. Use at your own risk. If you know a bit of PHP, you should be able to customize it to do whatever you want.
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
.................................................................................... This message (including any attachments) contains confidential and proprietary information intended only for the addressee. If you are not the intended recipient, please notify the sender immediately by responding to this e-mail, and delete this message and attachments from your system. If you have any questions about this e-mail please notify the sender immediately. Any unauthorized disclosure, copying, distribution or reliance on the contents of this information is strictly prohibited and may constitute a violation of law.
Jason Spirko wrote:
I added the code as you suggested below. What I have is a custom settings file that I call at the end of the LocalSettings.php file called "xoran_custom.php". I have added your code to the end of this file. But now I receive the following error when accessing the wiki:
Parse error: syntax error, unexpected '}' in C:...\wiki\includes\xoran_custom.php on line 118
Oh, well i coded it directly on the email so it's not too strange...
There're two } before return true (lines 115-116), there should only be one. I see now that "global $wgPrivateNamespaces;" should be "global $wgPrivateNamespaces, $wgPrivateNamespacesRead;" and it's neither initialised (add "$wgPrivateNamespacesRead = array();" below "$wgPrivateNamespaces = array();")
Also, if you're are using $wgNamespaceProtection, remove everything from the else to the line 116 (including the two } but not the } before the else).
Remember that MediaWiki is not designed to restrict reading. Among other things, you will probably want to add the non-readable namespaces to $wgNonincludableNamespaces http://www.mediawiki.org/wiki/Manual:$wgNonincludableNamespaces
Thank you for your help! I was able to implement this exactly as planned.
~ Jason
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Platonides Sent: Thursday, July 26, 2007 12:06 PM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] v1.10.1 - Namespace Protection
Jason Spirko wrote:
I added the code as you suggested below. What I have is a custom settings file that I call at the end of the LocalSettings.php file called "xoran_custom.php". I have added your code to the end of this file. But now I receive the following error when accessing the wiki:
Parse error: syntax error, unexpected '}' in C:...\wiki\includes\xoran_custom.php on line 118
Oh, well i coded it directly on the email so it's not too strange...
There're two } before return true (lines 115-116), there should only be one. I see now that "global $wgPrivateNamespaces;" should be "global $wgPrivateNamespaces, $wgPrivateNamespacesRead;" and it's neither initialised (add "$wgPrivateNamespacesRead = array();" below "$wgPrivateNamespaces = array();")
Also, if you're are using $wgNamespaceProtection, remove everything from the else to the line 116 (including the two } but not the } before the else).
Remember that MediaWiki is not designed to restrict reading. Among other things, you will probably want to add the non-readable namespaces to $wgNonincludableNamespaces http://www.mediawiki.org/wiki/Manual:$wgNonincludableNamespaces
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
.................................................................................... This message (including any attachments) contains confidential and proprietary information intended only for the addressee. If you are not the intended recipient, please notify the sender immediately by responding to this e-mail, and delete this message and attachments from your system. If you have any questions about this e-mail please notify the sender immediately. Any unauthorized disclosure, copying, distribution or reliance on the contents of this information is strictly prohibited and may constitute a violation of law.
mediawiki-l@lists.wikimedia.org