API:Restricting API usage/ja
Quick overview:
- Quick start guide
- FAQ
- チュートリアル
- フォーマット
- エラーの報告
- 使用制限
- クロスサイト リクエスト
- 認証
- クエリ
- 検索の提案
- ウィキテキストの構文解析とテンプレートの展開
- ページのキャッシュの破棄
- パラメーター情報
- ウィキの本文の変更
- ウォッチリストのフィード
- ウィキデータ /en
- 拡張機能
- MediaWikiおよび拡張機能内でのAPIの使用
- その他
- 実装
- クライアント コード
- アサート
There are several ways to restrict usage of (certain parts of) the API to certain groups of users, or to disable it altogether. Some of these require changing group permissions.
API全体の無効化[edit | edit source]
You can disable the API as a whole by setting $wgEnableAPI = false;
in LocalSettings.php. The API is enabled by default.
書き込みAPIの無効化[edit | edit source]
You can disable all write modules by setting $wgEnableWriteAPI = false;
in LocalSettings.php. The write API is enabled by default as of MediaWiki 1.14, and disabled by default in older versions.
書き込みAPIへのアクセス制限[edit | edit source]
You can deny certain groups the right to use the write API by denying them the writeapi right. By default, all groups have the writeapi right; however, both the writeapi right and $wgEnableWriteAPI = true;
are required in order to use the write API.
モジュールの無効化[edit | edit source]
You can disable individual modules for all users by adding a line to LocalSettings.php. Exactly what to add depends on the type of module you want to disable:
action=
モジュールの場合:$wgAPIModules['modulename'] = 'ApiDisabled';
prop=
モジュールの場合:$wgAPIPropModules['modulename'] = 'ApiQueryDisabled';
list=
モジュールの場合:$wgAPIListModules['modulename'] = 'ApiQueryDisabled';
meta=
モジュールの場合:$wgAPIMetaModules['modulename'] = 'ApiQueryDisabled';
例[edit | edit source]
To disable anyone who isn't a sysop from using action=edit
:
if ( !in_array( 'sysop', $wgUser->getGroups() ) ) { $wgAPIModules['edit'] = 'ApiDisabled'; }