Extension:Email Authorization: Difference between revisions
mNo edit summary |
m Fix capitalization |
||
| Line 124: | Line 124: | ||
</translate> |
</translate> |
||
; Version 1.5 |
; Version 1.5 |
||
* |
* Trim and lowercase emails before adding them |
||
; Version 1.4 |
; Version 1.4 |
||
| Line 149: | Line 149: | ||
<translate> |
<translate> |
||
== See also == <!--T:9--> |
== See also == <!--T:9--> |
||
</translate> |
</translate> |
||
Revision as of 21:50, 7 March 2021
Release status: stable |
|
|---|---|
| Implementation | User rights |
| Description | Implements the PluggableAuth PluggableAuthUserAuthorization hook to provide authorization using a list of authorized email addresses. |
| Author(s) | Cindy Cicalese |
| Latest version | 1.5 (2019-11-14) |
| Compatibility policy | Master maintains backward compatibility. |
| MediaWiki | 1.27+ |
| PHP | 5.5+ |
| Database changes | Yes |
|
|
|
emailauthorizationconfig |
|
| Licence | MIT License |
| Download | |
| Translate the Email Authorization extension if it is available at translatewiki.net | |
| Issues | Open tasks · Report a bug |
The Email Authorization extension implements the PluggableAuth PluggableAuthUserAuthorization hook to provide authorization using a list of authorized email addresses.
It provides a special page, Special:EmailAuthorizationConfig, for an administrator to use to add and remove email addresses and email domains from the authorization list.
Installation
- Download and move the extracted
EmailAuthorizationfolder to yourextensions/directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EmailAuthorization
- Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'EmailAuthorization' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure as required
Done – Navigate to Special:Versionon your wiki to verify that the extension is successfully installed.
Configuration
| Flag | Default | Description |
|---|---|---|
| $wgEmailAuthorization_EnableRequests | false | Indicates whether a special page (Special:EmailAuthorizationRequest) will be available for accounts to be requested. If enabled, that page will contain a form used to request an account. By default, that form will contain a single field: email address. Additional fields can be specified by $wgEmailAuthorization_RequestFields. In addition, if true, a special page (Special:EmailAuthorizationApprove) will be available for users in the bureaucratgroup to approve accounts.
|
| $wgEmailAuthorization_RequestFields | [] | An array of additional fields for the request form. The definition of each field is itself an array with the following possible fields:
The last three parameters (values, rows, and columns) are used to decide how to display the field. If values is present, a drop-down list will be displayed, and any values for rows and columns will be ignored. If values is not present but rows is present, a text area of the specified size will be displayed, with columns defaulting to 50 if it is not present. If only columns is present, a text field of the specified width will be displayed. If none are present, a text field of 50 columns will be displayed. Regardless of the contents of this array, an email address field will be present as the first field. For example, $wgEmailAuthorization_RequestFields = [
[
'label' => 'Organization',
'mandatory' => true
],
[
'label' => 'Extra Information',
'rows' => 4,
'columns' => 60
],
[
'label' => 'Animals',
'values' => [ 'dog', 'cat' ]
]
];
would display a mandatory text field (Organization) with 50 columns, a text area with 4 rows and 60 columns (Extra Information), and a drop-down list to choose between dog and cat (Animals). |
Users who should be able to add and revoke email addresses and email domains on the Special:EmailAuthorizationConfig page must be given the emailauthorizationconfig right. For example:
$wgGroupPermissions['bureaucrat']['emailauthorizationconfig'] = true;
$wgPluggableAuth_EnableLocalProperties = false;
Hooks
The Email Authorization extension supplies the following hooks to other extensions:
EmailAuthorizationAddandEmailAuthorizationRevoketake a single parameter: an email address or email domain (i.e. @ followed by the domain).EmailAuthorizationRequesttakes the following parameters: an email address and a JSON-encoded array of form fields.EmailAuthorizationApproveandEmailAuthorizationRejecttake the following parameters: an email address, a JSON-encoded array of form fields, and the User object of the bureaucrat approving/rejecting the account request.
Version history
- Version 1.5
- Trim and lowercase emails before adding them
- Version 1.4
- Added PHPCS and autofix some found sniffs with PHPCBF
- Version 1.3
- Added optional account request capability controlled by
$wgEmailAuthorization_EnableRequestsSpecial:EmailAuthorizationRequestSpecial:EmailAuthorizationApprove
- Version 1.2
- Change message prefix to prevent collisions with other extensions
- Table formatting
- Renamed
Special:ConfigEmailAuthorizationtoSpecial:EmailAuthorizationConfig
- Version 1.1
- Bug fix: adding email address that already existed threw exception
- Email addresses and domains entered in
Special:ConfigEmailAuthorizationnow are validated - Added missing rights messages
- Version 1.0
- Initial version
See also
- PluggableAuth plugins
- Stable extensions
- User rights extensions
- Extensions which add rights
- PluggableAuthUserAuthorization extensions
- LoadExtensionSchemaUpdates extensions
- BeforeCreateEchoEvent extensions
- MIT licensed extensions
- Extensions in Wikimedia version control
- All extensions
- Extensions by MITRE
- User identity extensions
