Extension:Email Authorization

This page is a translated version of the page Extension:Email Authorization and the translation is 91% complete.
Other languages:
English • ‎Türkçe • ‎中文 • ‎日本語
PluggableAuth Icon.svg この拡張機能では、先に PluggableAuth 拡張機能をインストールする必要があります。
MediaWiki 拡張機能マニュアル
OOjs UI icon advanced.svg
Email Authorization
リリースの状態: 安定
実装 利用者権限
説明 Implements the PluggableAuth PluggableAuthUserAuthorization hook to provide authorization using a list of authorized email addresses.
作者 Cindy Cicalese
最新バージョン 1.5 (2019-11-14)
互換性ポリシー master
MediaWiki 1.27+
PHP 5.5+
データベースの変更 はい
ライセンス MIT ライセンス
ダウンロード
  • $wgEmailAuthorization_RequestFields
  • $wgEmailAuthorization_EnableRequests
emailauthorizationconfig
translatewiki.net で翻訳を利用できる場合は、Email Authorization 拡張機能の翻訳にご協力ください
使用状況とバージョン マトリクスを確認してください。
問題点 未解決のタスク · バグを報告

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.

インストール

This extension requires PluggableAuth to be installed first.
  • ダウンロードして、ファイルを extensions/ フォルダー内の EmailAuthorization という名前のディレクトリ内に配置します。
  • 以下のコードを LocalSettings.php の末尾に追加します:
    wfLoadExtension( 'EmailAuthorization' );
    
  • 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベース テーブルを自動的に作成します。
  • 必要に応じて設定します
  •   完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

設定

フラグ 既定 説明
$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:
  • label: the label for the field (string); must be present
  • mandatory: if present and true, this field is mandatory
  • values: a comma separated list of strings that are the possible values of this field; the field will be a drop-down list
  • rows: if present, the number of rows in the text area for this field
  • columns: if present, the number of columns in the text field or text area for this field (default: 50)

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;
Since this extension relies upon the user's email address to perform authorization, you should prevent the user from editing it with the following configuration:
$wgPluggableAuth_EnableLocalProperties = false;

フック

The Email Authorization extension supplies the following hooks to other extensions:

  • EmailAuthorizationAdd and EmailAuthorizationRevoke take a single parameter: an email address or email domain (i.e. @ followed by the domain).
  • EmailAuthorizationRequest takes the following parameters: an email address and a JSON-encoded array of form fields.
  • EmailAuthorizationApprove and EmailAuthorizationReject take 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 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_EnableRequests
    • Special:EmailAuthorizationRequest
    • Special:EmailAuthorizationApprove
Version 1.2
  • Change message prefix to prevent collisions with other extensions
  • Table formatting
  • Renamed Special:ConfigEmailAuthorization to Special:EmailAuthorizationConfig
Version 1.1
  • Bug fix: adding email address that already existed threw exception
  • Email addresses and domains entered in Special:ConfigEmailAuthorization now are validated
  • Added missing rights messages
Version 1.0
  • Initial version

関連項目