From f5667eb2de2ec0c339c2ca535f3b13b78d0426f2 Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Wed, 10 Dec 2014 18:37:17 +0900 Subject: [PATCH 1/5] docs/guide-ja/input-multiple-models.md - prepared for translation [ci skip] --- docs/guide-ja/input-multiple-models.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 docs/guide-ja/input-multiple-models.md diff --git a/docs/guide-ja/input-multiple-models.md b/docs/guide-ja/input-multiple-models.md new file mode 100644 index 0000000000..e2743d6e67 --- /dev/null +++ b/docs/guide-ja/input-multiple-models.md @@ -0,0 +1,6 @@ +Complex Forms with Multiple Models +================================== + +> Note: This section is under development. +> +> It has no content yet. From 49fb12096fe2dce3c86ee2e19228bca7d1346a1e Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Sun, 21 Dec 2014 09:31:24 +0900 Subject: [PATCH 2/5] docs/guide-ja - stubs added [ci skip] --- docs/guide-ja/db-elasticsearch.md | 6 ++++++ docs/guide-ja/db-mongodb.md | 6 ++++++ docs/guide-ja/db-redis.md | 6 ++++++ docs/guide-ja/db-sphinx.md | 6 ++++++ docs/guide-ja/input-multiple-models.md | 8 ++++---- docs/guide-ja/output-pagination.md | 6 ++++++ docs/guide-ja/output-sorting.md | 6 ++++++ docs/guide-ja/security-auth-clients.md | 6 ++++++ 8 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 docs/guide-ja/db-elasticsearch.md create mode 100644 docs/guide-ja/db-mongodb.md create mode 100644 docs/guide-ja/db-redis.md create mode 100644 docs/guide-ja/db-sphinx.md create mode 100644 docs/guide-ja/output-pagination.md create mode 100644 docs/guide-ja/output-sorting.md create mode 100644 docs/guide-ja/security-auth-clients.md diff --git a/docs/guide-ja/db-elasticsearch.md b/docs/guide-ja/db-elasticsearch.md new file mode 100644 index 0000000000..411d83d1ab --- /dev/null +++ b/docs/guide-ja/db-elasticsearch.md @@ -0,0 +1,6 @@ +Elasticsearch +============= + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 diff --git a/docs/guide-ja/db-mongodb.md b/docs/guide-ja/db-mongodb.md new file mode 100644 index 0000000000..14302535aa --- /dev/null +++ b/docs/guide-ja/db-mongodb.md @@ -0,0 +1,6 @@ +Mongo DB +======== + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 diff --git a/docs/guide-ja/db-redis.md b/docs/guide-ja/db-redis.md new file mode 100644 index 0000000000..ad8fbe938f --- /dev/null +++ b/docs/guide-ja/db-redis.md @@ -0,0 +1,6 @@ +Redis +===== + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 diff --git a/docs/guide-ja/db-sphinx.md b/docs/guide-ja/db-sphinx.md new file mode 100644 index 0000000000..9a8f486bf6 --- /dev/null +++ b/docs/guide-ja/db-sphinx.md @@ -0,0 +1,6 @@ +Sphinx Search +============= + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 diff --git a/docs/guide-ja/input-multiple-models.md b/docs/guide-ja/input-multiple-models.md index e2743d6e67..bb0df62fc2 100644 --- a/docs/guide-ja/input-multiple-models.md +++ b/docs/guide-ja/input-multiple-models.md @@ -1,6 +1,6 @@ -Complex Forms with Multiple Models -================================== +複数のモデルを扱う複雑なフォーム +================================ -> Note: This section is under development. +> Note|注意: この節はまだ執筆中です。 > -> It has no content yet. +> まだ内容がありません。 diff --git a/docs/guide-ja/output-pagination.md b/docs/guide-ja/output-pagination.md new file mode 100644 index 0000000000..a2019588c4 --- /dev/null +++ b/docs/guide-ja/output-pagination.md @@ -0,0 +1,6 @@ +ページネーション +================ + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 diff --git a/docs/guide-ja/output-sorting.md b/docs/guide-ja/output-sorting.md new file mode 100644 index 0000000000..8f3c0479ab --- /dev/null +++ b/docs/guide-ja/output-sorting.md @@ -0,0 +1,6 @@ +並べ替え +======== + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 diff --git a/docs/guide-ja/security-auth-clients.md b/docs/guide-ja/security-auth-clients.md new file mode 100644 index 0000000000..9f1073cc97 --- /dev/null +++ b/docs/guide-ja/security-auth-clients.md @@ -0,0 +1,6 @@ +Auth クライアント +================= + +> Note|注意: この節はまだ執筆中です。 +> +> まだ内容がありません。 From 9065432c30091287ea5987a57b2b26300c47471e Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Sun, 21 Dec 2014 09:32:26 +0900 Subject: [PATCH 3/5] docs/guide-ja/security-authentication.md - started translation [ci skip] --- docs/guide-ja/README.md | 8 +-- docs/guide-ja/security-authentication.md | 86 ++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 docs/guide-ja/security-authentication.md diff --git a/docs/guide-ja/README.md b/docs/guide-ja/README.md index 7d95d10a2b..d9ef6caf97 100644 --- a/docs/guide-ja/README.md +++ b/docs/guide-ja/README.md @@ -108,11 +108,11 @@ All Rights Reserved. セキュリティ ------------ -* **翻訳未着手** [認証](security-authentication.md) -* **翻訳未着手** [権限](security-authorization.md) -* **翻訳未着手** [パスワードを扱う](security-passwords.md) +* **翻訳中** [認証](security-authentication.md) +* **翻訳中** [権限](security-authorization.md) +* **翻訳中** [パスワードを扱う](security-passwords.md) * **TBD** [Auth クライアント](security-auth-clients.md) -* **翻訳未着手** [ベストプラクティス](security-best-practices.md) +* **翻訳中** [ベストプラクティス](security-best-practices.md) キャッシュ diff --git a/docs/guide-ja/security-authentication.md b/docs/guide-ja/security-authentication.md new file mode 100644 index 0000000000..53b4ee2f1f --- /dev/null +++ b/docs/guide-ja/security-authentication.md @@ -0,0 +1,86 @@ +Authentication +============== + +> Note: This section is under development. + +Authentication is the act of verifying who a user is, and is the basis of the login process. Typically, authentication uses the combination of an identifier--a username or email address--and a password. The user submits these values through a form, and the application then compares the submitted information against that previously stored (e.g., upon registration). + +In Yii, this entire process is performed semi-automatically, leaving the developer to merely implement [[yii\web\IdentityInterface]], the most important class in the authentication system. Typically, implementation of `IdentityInterface` is accomplished using the `User` model. + +You can find a fully featured example of authentication in the +[advanced application template](tutorial-advanced-app.md). Below, only the interface methods are listed: + +```php +class User extends ActiveRecord implements IdentityInterface +{ + // ... + + /** + * Finds an identity by the given ID. + * + * @param string|integer $id the ID to be looked for + * @return IdentityInterface|null the identity object that matches the given ID. + */ + public static function findIdentity($id) + { + return static::findOne($id); + } + + /** + * Finds an identity by the given token. + * + * @param string $token the token to be looked for + * @return IdentityInterface|null the identity object that matches the given token. + */ + public static function findIdentityByAccessToken($token, $type = null) + { + return static::findOne(['access_token' => $token]); + } + + /** + * @return int|string current user ID + */ + public function getId() + { + return $this->id; + } + + /** + * @return string current user auth key + */ + public function getAuthKey() + { + return $this->auth_key; + } + + /** + * @param string $authKey + * @return boolean if auth key is valid for current user + */ + public function validateAuthKey($authKey) + { + return $this->getAuthKey() === $authKey; + } +} +``` + +Two of the outlined methods are simple: `findIdentity` is provided with an ID value and returns a model instance +associated with that ID. The `getId` method returns the ID itself. Two of the other methods – `getAuthKey` and +`validateAuthKey` – are used to provide extra security to the "remember me" cookie. The `getAuthKey` method should +return a string that is unique for each user. You can reliably create a unique string using +`Yii::$app->getSecurity()->generateRandomString()`. It's a good idea to also save this as part of the user's record: + +```php +public function beforeSave($insert) +{ + if (parent::beforeSave($insert)) { + if ($this->isNewRecord) { + $this->auth_key = Yii::$app->getSecurity()->generateRandomString(); + } + return true; + } + return false; +} +``` + +The `validateAuthKey` method just needs to compare the `$authKey` variable, passed as a parameter (itself retrieved from a cookie), with the value fetched from the database. From eaf813acbf0fb8a287141c3e462f5e1a2f01361e Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Sun, 21 Dec 2014 10:16:49 +0900 Subject: [PATCH 4/5] docs/guide-ja/security-authentication.md - added [ci skip] --- docs/guide-ja/security-authentication.md | 50 +++++++++++++----------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/docs/guide-ja/security-authentication.md b/docs/guide-ja/security-authentication.md index 53b4ee2f1f..3247f3a300 100644 --- a/docs/guide-ja/security-authentication.md +++ b/docs/guide-ja/security-authentication.md @@ -1,14 +1,18 @@ -Authentication -============== +認証 +==== -> Note: This section is under development. +> Note|注意: この節はまだ執筆中です。 -Authentication is the act of verifying who a user is, and is the basis of the login process. Typically, authentication uses the combination of an identifier--a username or email address--and a password. The user submits these values through a form, and the application then compares the submitted information against that previously stored (e.g., upon registration). +認証はユーザが誰であるかを確認する行為であり、ログインプロセスの基礎となるものです。 +典型的には、認証は、識別子 (ユーザ名またはメールアドレス) とパスワードの組み合わせを使用します。 +ユーザはこれらの値をフォームを通じて送信し、アプリケーションは送信された情報を以前に (例えば、ユーザ登録時に) 保存された情報と比較します。 -In Yii, this entire process is performed semi-automatically, leaving the developer to merely implement [[yii\web\IdentityInterface]], the most important class in the authentication system. Typically, implementation of `IdentityInterface` is accomplished using the `User` model. +Yii では、このプロセス全体が半自動的に実行されます。 +開発者に残されているのは、認証システムにおいて最も重要なクラスである [[yii\web\IdentityInterface]] を実装することだけです。 +典型的には、`IdentityInterface` の実装は `User` モデルを使って達成されます。 -You can find a fully featured example of authentication in the -[advanced application template](tutorial-advanced-app.md). Below, only the interface methods are listed: +十分な機能を有する認証の実例を [アドバンストアプリケーションテンプレート](tutorial-advanced-app.md) の中に見出すことが出来ます。 +下記にインターフェイスのメソッドだけをリストします。 ```php class User extends ActiveRecord implements IdentityInterface @@ -16,10 +20,10 @@ class User extends ActiveRecord implements IdentityInterface // ... /** - * Finds an identity by the given ID. + * 与えられた ID によって識別子を探す * - * @param string|integer $id the ID to be looked for - * @return IdentityInterface|null the identity object that matches the given ID. + * @param string|integer $id 探すための ID + * @return IdentityInterface|null 与えられた ID に合致する識別子オブジェクト */ public static function findIdentity($id) { @@ -27,10 +31,10 @@ class User extends ActiveRecord implements IdentityInterface } /** - * Finds an identity by the given token. + * 与えられたトークンによって識別子を探す * - * @param string $token the token to be looked for - * @return IdentityInterface|null the identity object that matches the given token. + * @param string $token 探すためのトークン + * @return IdentityInterface|null 与えられたトークンに合致する識別子オブジェクト */ public static function findIdentityByAccessToken($token, $type = null) { @@ -38,7 +42,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @return int|string current user ID + * @return int|string 現在のユーザの ID */ public function getId() { @@ -46,7 +50,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @return string current user auth key + * @return string 現在のユーザの認証キー */ public function getAuthKey() { @@ -55,7 +59,7 @@ class User extends ActiveRecord implements IdentityInterface /** * @param string $authKey - * @return boolean if auth key is valid for current user + * @return boolean 認証キーが現在のユーザに対して有効か否か */ public function validateAuthKey($authKey) { @@ -64,11 +68,13 @@ class User extends ActiveRecord implements IdentityInterface } ``` -Two of the outlined methods are simple: `findIdentity` is provided with an ID value and returns a model instance -associated with that ID. The `getId` method returns the ID itself. Two of the other methods – `getAuthKey` and -`validateAuthKey` – are used to provide extra security to the "remember me" cookie. The `getAuthKey` method should -return a string that is unique for each user. You can reliably create a unique string using -`Yii::$app->getSecurity()->generateRandomString()`. It's a good idea to also save this as part of the user's record: +概要を述べたメソッドのうち、二つは単純なものです。 +`findIdentity` は ID の値を受け取って、その ID と関連付けられたモデルのインスタンスを返します。 +`getId` メソッドは ID そのものを返します。 +その他のメソッドのうち、二つのもの - `getAuthKey` と `validateAuthKey` - は、「次回から自動ログイン ("remember me")」のクッキーに対して追加のセキュリティを提供するために使われます。 +`getAuthKey` メソッドは全てのユーザに対してユニークな文字列を返さなければなりません。 +`Yii::$app->getSecurity()->generateRandomString()` を使うと、信頼性の高い方法でユニークな文字列を生成することが出来ます。 +これをユーザのレコードの一部として保存しておくのが良いアイデアです。 ```php public function beforeSave($insert) @@ -83,4 +89,4 @@ public function beforeSave($insert) } ``` -The `validateAuthKey` method just needs to compare the `$authKey` variable, passed as a parameter (itself retrieved from a cookie), with the value fetched from the database. +`validateAuthKey` メソッドでは、パラメータとして渡された `$authKey` 変数 (これ自体はクッキーから読み出されます) をデータベースから読み出された値と比較する必要があるだけです。 From 40419bb2da530ef2a9530429f9ad904881d02a79 Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Sun, 21 Dec 2014 10:23:12 +0900 Subject: [PATCH 5/5] docs/guide-ja/README.md - updated [ci skip] --- docs/guide-ja/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide-ja/README.md b/docs/guide-ja/README.md index d9ef6caf97..2514aab687 100644 --- a/docs/guide-ja/README.md +++ b/docs/guide-ja/README.md @@ -108,8 +108,8 @@ All Rights Reserved. セキュリティ ------------ -* **翻訳中** [認証](security-authentication.md) -* **翻訳中** [権限](security-authorization.md) +* [認証](security-authentication.md) +* **翻訳中** [権限付与](security-authorization.md) * **翻訳中** [パスワードを扱う](security-passwords.md) * **TBD** [Auth クライアント](security-auth-clients.md) * **翻訳中** [ベストプラクティス](security-best-practices.md)