Extension:SecurePoll/ja
SecurePoll拡張機能は、選挙、投票、アンケートのための特別ページ拡張機能です。 ウィキメディア財団理事会選挙や裁定委員会選挙で使用されています。また、ウィキメディア・ライセンス移行投票にも使用されました。
スクリーンショット
- 投票の一覧を表示しているメインページ。
- 説明文のある投票ページ。
- SecurePollの管理者用ログ
- SecurePollの投票者ログ
インストール
- ダウンロードして、ファイルを
extensions/
フォルダー内のSecurePoll
という名前のディレクトリ内に配置します。
開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/SecurePoll
- 以下のコードを LocalSettings.php ファイルの末尾に追加します:
wfLoadExtension( 'SecurePoll' );
- 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベーステーブルを自動的に作成します。
完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
In addition, you will need to add some user groups and user rights to your LocalSettings.php file. Here is one way to do it, which gives a new group called electionadmin the power to do everything in SecurePoll (create polls, edit polls, see voter IP addresses):
$wgGroupPermissions['electionadmin']['securepoll-create-poll'] = true;
$wgGroupPermissions['electionadmin']['securepoll-edit-poll'] = true;
$wgGroupPermissions['electionadmin']['securepoll-view-voter-pii'] = true;
Once this group is created, a bureaucrat can add someone to the group using Special:UserRights. Then that person can visit Special:SecurePoll to view polls, create polls, edit polls, tally polls, etc.
Each poll's data is compartmentalized. You can have 100 electionadmins, but if you only add one electionadmin to a particular poll, only that one electionadmin will be able to edit that particular poll or see user IPs. If an electionadmin is removed from a poll, they will lose access to it.
securepoll-view-voter-pii
is used for "scrutineering" a poll, which involves looking at a list of voter IPs, user agents, and X-Forwarded-For headers to look for cheating (secret duplicate votes by sockpuppets). Because this involves looking at voter IP addresses and other sensitive, personal, de-anonymizing data, it is a sensitive user right, so only trusted users should be assigned to the electionadmin group.
It is possible to split securepoll-view-voter-pii
into a separate group. You can use a config such as the one below to create a group called scrutineer that contains the securepoll-view-voter-pii
right, separating it from the electionadmin group:
$wgGroupPermissions['electionadmin']['securepoll-create-poll'] = true;
$wgGroupPermissions['electionadmin']['securepoll-edit-poll'] = true;
$wgGroupPermissions['scrutineer']['securepoll-create-poll'] = true;
$wgGroupPermissions['scrutineer']['securepoll-edit-poll'] = true;
$wgGroupPermissions['scrutineer']['securepoll-view-voter-pii'] = true;
A user also needs to be added to the poll (and hence have the securepoll-edit-poll
right) in order to view PII - securepoll-view-voter-pii
by itself has no effect.
使用法
新規投票の作成
新規投票を作成するには、手動でXMLファイルを作成してそれをインポートする方法と、Special:SecurePollの投票作成インターフェースを使用する方法があります。
手動
投票を手動で作成するためには以下のことが必要です。
- XMLファイルを書く
- コマンドラインインターフェイスの
import.php
コマンドを使用してインポートします。
テストフォルダの中には、4つのサンプルファイルがあります。
3way-test.xml
approval-test.xml
radio-range.xml
schulze-test.xml
info
投票をインポートするには、cli フォルダから以下を実行します。
extensions/SecurePoll/maintenance$ php importElectionConfiguration.php ../tests/phpunit/data/3way-test.xml
dockerを使って投票をインポートするには、cliフォルダから以下を実行します。
docker-compose exec mediawiki php extensions/SecurePoll/maintenance/importElectionConfiguration.php extensions/SecurePoll/tests/phpunit/data/3way-test.xml
ウェブインタフェース経由
securepoll-create-poll
の権限を持った利用者は、Special:SecurePollの一番下にあるリンクから新しい投票を作成することができます。
新しい投票を作成するには、作成フォームの必須フィールドに必要事項を入力します。 以下のフィールドには特に注意を払う必要があります。
- When adding poll admins, only members of the
electionadmin
group are allowed. If$wgSecurePollUseLogging
is set totrue
, it will be logged whenever an admin is added to or removed from a poll. The logs can be viewed at Special:SecurePollLog. - 暗号化された投票を作成するには、暗号化方式のラジオを選択します。 GnuPGを選択した場合、(公開)暗号化キーと(非公開)復号化キーを生成します。 暗号鍵は作成フォームに入力し、秘密鍵はオフラインの場所に保管してください(選挙終了後、集計の際に必要になります)。 詳細な例は[$1 here]をご覧ください。
さあ、Special:SecurePollを訪れて、皆さんの投票をご覧ください。
既存の投票を編集
投票を編集するのは、該当の投票の管理者でなければなりません。 Special:SecurePollから、編集したい投票の「編集」リンクをクリックします。
選挙が始まる前であれば、選挙に関することは何でも編集可能です。 選挙が開始されると、一部の項目は編集できなくなります。
有権者の編集
有権者を編集するのは、当該の投票の管理者である必要があります。 Special:SecurePollから、投票の「投票資格」のリンクをクリックします。
投票の翻訳
投票を翻訳するには、当該の投票の管理者である必要があります。 Special:SecurePollから、翻訳したい投票の「翻訳」リンクをクリックします。
投票者一覧の閲覧
投票が作成されたときに、透明性機能が無効にされていない限り、誰でも投票者一覧を閲覧できます。
特定の投票所の管理者は、投票者一覧を、重複する投票者を特定するのに役立つ非公開の情報 (IP アドレス、ユーザー エージェント情報、共有 Cookie など) と共に閲覧できます。
$wgSecurePollUseLogging
に true
を設定すると、管理者が非公開データを閲覧するたびに記録されます。 ログはSpecial:SecurePollLogで閲覧できます。
管理者は重複していると確信した票を無効にできます。
票の集計
票の集計は特定の投票の管理者のみに認められます。 Special:SecurePollで、皆さんが票の集計をしたい投票への集計リンクがクリックできます。
もし投票がすでに集計されていたら、そのページに結果が表示されています。 もしなければ、または皆さんが再集計したいのであれば、新規集計を始めるためのフォームがあります。
- 投票が暗号化されていなければ、集計ボタンをクリックしてください。
- 投票が暗号化されている場合、より多くの情報を入力する必要があるかもしれません。例えば、GnuPGを使用した場合、(非公開の)復号化キーを入力し、集計ボタンをクリックします。暗号化された投票に多くの投票がある場合、集計に長い時間がかかることがあります。後で結果を確認する必要があるかもしれません。
次に、Special:SecurePollにアクセスすると、皆さんの投票がご覧いただけます。
(STV) 集計
単記委譲式投票方式(single transferable votes 略号STV)の詳細情報はこちらをご参照ください。
一般的なアルゴリズム(algorithm)の実装 (source).
クオータ(Quata)式投票とは + .000000001. 最低得票数(Quota)は、議席を確保するための最小限の票数です。
1. コンピューターで最低得票数を計算してみましょう。 2. 第一希望で候補者に票を割り振ります。 3. 少なくとも最低得票数に達した候補者、全員を勝利者として発表します。 4. 勝者から希望者に余剰票を移します。 5. 3から4の手順を、もはや選ばれる新しい候補者がいなくなるまで繰り返します。(いくつかの制度の元では、初めのうち、票は以前の勝者と敗者を逆転させる可能性があります。これは選挙結果に影響するかもしれません) もし、すべての議席が勝利者で埋まれば、過程は終了です。さもなければ: 6. ひとりまたはそれ以上の候補者が敗退することになります。通例、最下位の候補者か、残った候補者のなかで合計票が最低の得票数より少ない者になります。 7. 敗者の票を残った希望のある候補者に移します。 8. 3-7を議席が埋まるまで繰り返します。
今回使用するクォータ(手順1)は、ドループクォータ(情報)方式です。
floor( no. votes / (no. seats + 1) ) + 1
選ばれた、あるいは敗退した候補者から票を移動させる方法には、ミーク(Meek)方式を用います。 w:Counting_single_transferable_votes#Meek
- 英語版です。Meek Method
集計作業(JobRunner)
- 集計作業は、スケジュールしておいたジョブを通して処理されるでしょう Manual:ジョブ キュー 。
この作業のために、 scheduled jobを作成するか、手作業で遂行するか、はっきりさせておいてください。
- また、集計は、手動で集計スクリプトを実行することでも進めることができます。
集計を実行するには、下記のように、extensions/SecurePoll/cli
にある cli フォルダから実行します。
extensions/SecurePoll/maintenance/tallyElection.php
MediaWiki-Dockerを使って集計を実行するには、extensions/SecurePoll/cli
に置かれた cli フォルダから、下記コマンドを動かします。
docker-compose exec mediawiki php extensions/SecurePoll/maintenance/tallyElection.php
(STV)試験選挙を作り出す
- 試験的な(STV)選挙は、
extensions/SecurePoll/cli
に置かれた cli フォルダから作り出すことができます。 - 試験選挙を作り出すには、
extensions/SecurePoll/cli
に置かれたcli フォルダから下記コマンドを動かします。
extensions/SecurePoll/maintenance/generateTestElection.php
- 試験的な(STV)選挙は集計のための足場を提供します。
Redirect polls
A redirect poll is a poll that shows up in the list of polls at Special:SecurePoll, but clicking on "vote" and other links will redirect the voter to a different wiki. This is useful if you do all of your votes on a central votewiki (in Wikimedia's case, https://vote.wikimedia.org).
Special:SecurePoll/create will show an additional drop-down list called "For wiki:"—allowing you to select "This wiki", "All wikis", or a different wiki in your wiki farm—if all of the following conditions are met:
- You are using a wiki farm (multiple wikis using the same file system but different databases).
- You haven't excluded all other wikis using
$wgSecurePollExcludedWikis
. - You have
$wgCanonicalServer
configured to have a period (use different subdomains) on each wiki. - You have
$wgSecurePollEditOtherWikis = true;
for your current wiki.
If you have a wiki in your wiki farm that doesn't have SecurePoll installed, be sure to add it to $wgSecurePollExcludedWikis
to keep it out of the "For wiki:" list.
"For wiki" dropdown item selected | What it does locally | What it does on other wikis |
---|---|---|
このウィキ | Creates a local election | Nothing |
すべてのウィキ | Creates a local election | Creates "redirect polls" at every other wiki in the wiki farm |
Picking a specific other wiki such as es.wikipedia.org | Creates a local election | Creates a "redirect poll" at the chosen wiki |
Testing note: $wgCanonicalServer
must contain domains with subdomains. So for example, http://localhost
will not get the dropdown list to show up, but http://en.localhost
will.
$wgConf->settings = [
'wgCanonicalServer' => [
'my_database' => 'http://en.localhost:8080',
'secondwiki' => 'http://es.localhost:8080'
],
In the database, fields related to redirect polls include securepoll_elections.el_auth_type
(can be local or mw-remote), and the following securepoll_properties.pr_key
s: jump-id
, jump-url
, and main-wiki
.
For developers
SQL tables
Note that configuring a poll to use encryption encrypts the securepoll_votes.vote_record field.
Table | Field prefix | Description | Contains sensitive data? |
---|---|---|---|
securepoll_cookie_match | cm_ | Used on the vote details page to display the securepoll-cookie-dup-list message ("Cookie duplicate users"). |
Yes |
securepoll_elections | el_ | List of elections, and some basic config data such as the name, creator, start date, end date, language, ballot type (e.g. approval), and tally type (e.g. plurality). Additional config data is pivoted and stored in securepoll_properties instead. |
No |
securepoll_entity | en_ | Maps "one to many" with the securepoll_msg table. The "many" is because a securepoll_msg can be in multiple languages. Possible options for securepoll_entity.en_type are election , question , and option . |
No |
securepoll_lists | li_ | Stores usernames manually added via the Voter Eligibility page. Users are added in the format userName@databaseName. There are 3 types of lists:
|
No |
securepoll_log | spl_ | If $wgSecurePollUseLogging is set to true, stores the log entries here. |
Yes. Special:SecurePollLog is private. |
securepoll_msgs | msg_ | List of strings. For example, the poll name, the poll questions, and the poll answers. This is mapped to from other tables such as securepoll_options and securepoll_questions , and supports having the same entity in multiple languages (securepoll_msgs.msg_lang ). |
No |
securepoll_options | op_ | List of poll options for each question. Doesn't store the option text here, but rather maps it to the table securepoll_msgs . |
No |
securepoll_properties | pr_ | Config data for each election. For example, who the election admins are, whether it's a redirect poll, whether to shuffle the options, whether to use encryption, list of tallies and their values (tally-result ), etc.
Is also the config data for on-the-fly voter eligibility calculation. For example, voter minimum edit count and voter not-sitewide-blocked is stored here. |
Partial. Rows with pr_key as gpg-encrypt-key, gpg-sign-key, openssl-encrypt-key, openssl-sign-key, tally-result, tally-result-time are private data. |
securepoll_questions | qu_ | List of poll questions. Doesn't store the question text here, but rather maps it to the table securepoll_msgs . |
No |
securepoll_strike | st_ | Which votes have been struck (crossed out, removed from the tally) by election admins. Includes a reason that they can type in. | Yes. Only election admins can see the strike log from the UI. |
securepoll_voters | voter_ | One row per voter per election. Voters are distinct and will not be duplicated in the same election. Contains data on the voter such as their user groups and whether they're blocked or not. Probably used to determine voter eligibility. voter_properties contains data such as wiki, blocked, sitewide blocked, central block count, central sitewide block count, edit count, bot, language, user groups, eligibility lists, and registration date. |
Partial. This is private for elections with transparency features disabled. |
securepoll_votes | vote_ | One row per vote per election. Contains data on the voter such as IP address and user agent, and contains the actual vote in the vote_record column. The "most active wiki" that the voter chose, if enabled for this poll, is stored in vote_voter_domain . vote_current =0 means that this is a duplicate vote and has been discarded; this is re-calculated for all of the user's previous votes each time they submit a new vote. |
Yes. Contains voter PII such as IP addresses and user agents. Contains the vote itself and its timestamp (the vote date is public unless the voter list is turned off, the vote time is private). |
説明文書
セキュアポル(SecurePoll)
SecurePoll(セキュアポル)に関する一般的な説明文書はwikitech:SecurePollをご参照ください。
SecurePoll の改善
SecurePoll 改善の概要はAnti-Harassment Tools/SecurePoll Improvementsをご参照ください。(仮題:嫌がらせ行為対策ツール/セキュアポル改善)
STV 集計結果を理解する
STV 集計結果に関する解説文書はAnti-Harassment Tools/SecurePoll Improvements/Understanding the STV resultをご参照ください。(仮題:嫌がらせ行為対策ツール/セキュアポルの改善/STV集計結果を理解する)
See also
![]() | この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。 |
![]() | この拡張機能は以下のウィキ ファーム/ウィキ ホスト/パッケージに含まれています: これは正式な一覧ではありません。 一部のウィキ ファーム/ウィキ ホスト/パッケージは、ここに記載されていなくてもこの拡張機能を含んでいる場合があります。 必ずご利用のウィキ ファーム、ウィキ ホスト、バンドルで確認してください。 |