Commit 0b71faa5 by Jani Mikkonen

Merge branch 'master' of git://github.com/yiisoft/yii2 into messages_fi

parents 8af8b77f b649efe6
...@@ -657,8 +657,7 @@ After a user is authenticated, you probably want to check if he has the permissi ...@@ -657,8 +657,7 @@ After a user is authenticated, you probably want to check if he has the permissi
action for the requested resource. This process is called *authorization* which is covered in detail in action for the requested resource. This process is called *authorization* which is covered in detail in
the [Authorization chapter](authorization.md). the [Authorization chapter](authorization.md).
You may use the [[yii\web\AccessControl]] filter and/or the Role-Based Access Control (RBAC) component You may use the Role-Based Access Control (RBAC) component to implementation authorization.
to implementation authorization.
To simplify the authorization check, you may also override the [[yii\rest\Controller::checkAccess()]] method To simplify the authorization check, you may also override the [[yii\rest\Controller::checkAccess()]] method
and then call this method in places where authorization is needed. By default, the built-in actions provided and then call this method in places where authorization is needed. By default, the built-in actions provided
......
...@@ -124,6 +124,10 @@ abstract class Application extends Module ...@@ -124,6 +124,10 @@ abstract class Application extends Module
* 'name' => 'extension name', * 'name' => 'extension name',
* 'version' => 'version number', * 'version' => 'version number',
* 'bootstrap' => 'BootstrapClassName', * 'bootstrap' => 'BootstrapClassName',
* 'alias' => [
* '@alias1' => 'to/path1',
* '@alias2' => 'to/path2',
* ],
* ] * ]
* ~~~ * ~~~
*/ */
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace yii\db; namespace yii\db;
use Yii;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\helpers\Inflector; use yii\helpers\Inflector;
use yii\helpers\StringHelper; use yii\helpers\StringHelper;
...@@ -376,6 +377,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -376,6 +377,7 @@ class ActiveRecord extends BaseActiveRecord
public function insert($runValidation = true, $attributes = null) public function insert($runValidation = true, $attributes = null)
{ {
if ($runValidation && !$this->validate($attributes)) { if ($runValidation && !$this->validate($attributes)) {
Yii::info('Model not inserted due to validation error.', __METHOD__);
return false; return false;
} }
$db = static::getDb(); $db = static::getDb();
...@@ -493,6 +495,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -493,6 +495,7 @@ class ActiveRecord extends BaseActiveRecord
public function update($runValidation = true, $attributes = null) public function update($runValidation = true, $attributes = null)
{ {
if ($runValidation && !$this->validate($attributes)) { if ($runValidation && !$this->validate($attributes)) {
Yii::info('Model not updated due to validation error.', __METHOD__);
return false; return false;
} }
$db = static::getDb(); $db = static::getDb();
......
...@@ -132,7 +132,7 @@ class ImageValidator extends FileValidator ...@@ -132,7 +132,7 @@ class ImageValidator extends FileValidator
$this->overHeight = Yii::t('yii', 'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.'); $this->overHeight = Yii::t('yii', 'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.');
} }
if ($this->wrongMimeType === null) { if ($this->wrongMimeType === null) {
$this->wrongMimeType = Yii::t('yii', 'Only files with these mimeTypes are allowed: {mimeTypes}.'); $this->wrongMimeType = Yii::t('yii', 'Only files with these MIME types are allowed: {mimeTypes}.');
} }
if (!is_array($this->mimeTypes)) { if (!is_array($this->mimeTypes)) {
$this->mimeTypes = preg_split('/[\s,]+/', strtolower($this->mimeTypes), -1, PREG_SPLIT_NO_EMPTY); $this->mimeTypes = preg_split('/[\s,]+/', strtolower($this->mimeTypes), -1, PREG_SPLIT_NO_EMPTY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment