84 Commits

Author SHA1 Message Date
e6f5c46cdc Fixes #15633: Deprecate some things going away/changing in 2.1
- Deprecated `yii\base\BaseObject::className()` in favor of native PHP syntax `::class`, which does not trigger autoloading
- Deprecated XCache and Zend data cache support as caching backends
- Deprecated `yii\BaseYii::powered()` method
- Added `yii\base\InvalidArgumentException` and deprecated `yii\base\InvalidParamException`
- Added `yii\BaseYii::debug()` and deprecated `yii\BaseYii::trace()`
2018-02-11 01:48:29 +03:00
65f6b59b35 @inheritdoc notation changed 2018-01-23 13:11:24 +02:00
711498f93a Cache user assignments to avoid unnecessary DB queries (#14696)
* Cache user assignments to avoid unnecessary DB queries

alternative to #9138 and #10981, only cache on `checkAccess` call which is usually
called on every request. Cache is not necessary in RBAC management.

Similar to #14061 but includes proper cache invalidation and test.

`getAssignments()` always queries the DB. The cache is only applied on
`checkAccess` calls, and invalidated as soon as the RBAC structure is
modified through the manager component (verified by the test case).

Regarding [concerns of memory usage](https://github.com/yiisoft/yii2/pull/14061#issuecomment-297982502)
if used in batch mode on multiple users, you can call
`invalidateCache()` method if this really causes a problem.

fixes #7743
close #9138
close #14061
close #10981

See also
- https://github.com/yiisoft/yii2/issues/7626#issuecomment-77745166
- https://github.com/yiisoft/yii2/pull/14061#issuecomment-319645488

* improve test naming

* fix tests

* fix assignment cache for non-scalar user-ids
2017-09-01 10:50:36 +02:00
5a8c3d537b Enable phpdoc_summary rule in php-cs-fixer config (#14675)
* Enable `phpdoc_summary` rule in php-cs-fixer config.

* Fix case in "PHPDoc".
2017-08-21 11:19:35 +02:00
1501c659ac Add empty lines before return statements. (#14682) [skip ci] 2017-08-21 01:58:49 +03:00
1ee29c630d Fixes #14493: Fixed getting permissions in yii\rbac\Dbmanger::getPermissionsByUser by user with id equals 0 2017-07-24 18:42:40 +03:00
fe8a0a6a2e Enable no_useless_else rule in php-cs-fixer (#14420) 2017-07-10 11:26:21 +03:00
93f88bb7db mention defaultRoles in getRolesByUser() docs
fixes #14393
2017-07-06 12:40:13 +02:00
ba0ab403b5 Added php-cs-fixer coding standards validation to Travis CI (#14100)
* php-cs-fixer: PSR2 rule.

* php-cs-fixer: PSR2 rule - fix views.

* Travis setup refactoring.

* Add php-cs-fixer to travis cs tests.

* Fix tests on hhvm-3.12

* improve travis config

* composer update

* revert composer update

* improve travis config

* Fix CS.

* Extract config to separate classes.

* Extract config to separate classes.

* Add file header.

* Force short array syntax.

* binary_operator_spaces fixer

* Fix broken tests

* cast_spaces fixer

* concat_space fixer

* dir_constant fixer

* ereg_to_preg fixer

* function_typehint_space fixer

* hash_to_slash_comment fixer

* is_null fixer

* linebreak_after_opening_tag fixer

* lowercase_cast fixer

* magic_constant_casing fixer

* modernize_types_casting fixer

* native_function_casing fixer

* new_with_braces fixer

* no_alias_functions fixer

* no_blank_lines_after_class_opening fixer

* no_blank_lines_after_phpdoc fixer

* no_empty_comment fixer

* no_empty_phpdoc fixer

* no_empty_statement fixer

* no_extra_consecutive_blank_lines fixer

* no_leading_import_slash fixer

* no_leading_namespace_whitespace fixer

* no_mixed_echo_print fixer

* no_multiline_whitespace_around_double_arrow fixer

* no_multiline_whitespace_before_semicolons fixer

* no_php4_constructor fixer

* no_short_bool_cast fixer

* no_singleline_whitespace_before_semicolons fixer

* no_spaces_around_offset fixer

* no_trailing_comma_in_list_call fixer

* no_trailing_comma_in_singleline_array fixer

* no_unneeded_control_parentheses fixer

* no_unused_imports fixer

* no_useless_return fixer

* no_whitespace_before_comma_in_array fixer

* no_whitespace_in_blank_line fixer

* not_operator_with_successor_space fixer

* object_operator_without_whitespace fixer

* ordered_imports fixer

* php_unit_construct fixer

* php_unit_dedicate_assert fixer

* php_unit_fqcn_annotation fixer

* phpdoc_indent fixer

* phpdoc_no_access fixer

* phpdoc_no_empty_return fixer

* phpdoc_no_package fixer

* phpdoc_no_useless_inheritdoc fixer

* Fix broken tests

* phpdoc_return_self_reference fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_to_comment fixer

* phpdoc_trim fixer

* phpdoc_var_without_name fixer

* psr4 fixer

* self_accessor fixer

* short_scalar_cast fixer

* single_blank_line_before_namespace fixer

* single_quote fixer

* standardize_not_equals fixer

* ternary_operator_spaces fixer

* trailing_comma_in_multiline_array fixer

* trim_array_spaces fixer

* protected_to_private fixer

* unary_operator_spaces fixer

* whitespace_after_comma_in_array fixer

* `parent::setRules()` -> `$this->setRules()`

* blank_line_after_opening_tag fixer

* Update finder config.

* Revert changes for YiiRequirementChecker.

* Fix array formatting.

* Add missing import.

* Fix CS for new code merged from master.

* Fix some indentation issues.
2017-06-12 12:25:45 +03:00
cb53b2feec Fixes #14081: Added yii\caching\CacheInterface to make custom cache extensions adoption easier 2017-06-11 19:18:33 +03:00
67b9a57e86 additional fix for #13501
close #13593
2017-05-31 19:17:28 +02:00
fc8ea4831b Fixes #14108: fixed phpdoc mistake in method description 2017-05-03 23:37:46 +03:00
375ea7a847 Fixes #13951: renamed get-method which was conflicting with existing property (#14055) 2017-04-26 13:32:58 +03:00
d2fb17f444 Fixes #13961: RBAC Rules: PostgreSQL: PHP Warning "unserialize() expects parameter 1 to be string, resource given" was fixed 2017-04-12 21:48:16 +03:00
a182ce57fc Fixes for issues found with Static Code Analysis with Php Inspections (EA Extended) (#13606)
* Php Inspections (EA Extended): language level migration fixes
* Php Inspections (EA Extended): instanceof a trait always return false
* Php Inspections (EA Extended): fixed preg_quote (/ is not escaped by default)
* Php Inspections (EA Extended): fixed a greedy regex
* Php Inspections (EA Extended): refereted instanceof self in a trait
* Php Inspections (EA Extended): revert language level changes in requirements checker
* Php Inspections (EA Extended): revert language level changes in requirements checker
* Php Inspections (EA Extended): more greedy regexes fixed
2017-02-22 17:07:52 +03:00
3a4505ac08 Fixes #11230: Include defaultRoles in yii\rbac\DbManager->getRolesByUser() results 2017-02-15 01:26:33 +03:00
97c43c2480 Fixes #13501: Fixed yii\rbac\DbManager::getRule() and yii\rbac\DbManager::getRules() to properly handle resource data came from Rule table when using PostgreSQL 2017-02-04 15:51:12 +03:00
5795b3937e Added rbac\BaseManager::hasNoAssignments() 2016-12-17 12:37:36 +02:00
eeeafc91b3 Fixes #7980: Removed duplicate code in getItem() which is executed anyways in populateItem() 2016-11-10 01:52:02 +03:00
4aa935e69e Fixes #12055: Changed boolean to bool and integer to int in phpdoc 2016-11-07 02:51:39 +03:00
32f4dc8997 Fixes #5385: links created from classes to corresponding guide articles (#12920) 2016-11-04 18:55:14 +03:00
73a30780b3 Fixes #12810: getChildRoles() throws an exception when role has no children 2016-10-24 14:11:09 +03:00
aa4b49a2e6 Fixes #11245: Added yii\rbac\ManagerInterface::getRolesByRole($roleName) method. Implement to DbManager and PhpManager 2016-10-04 14:44:18 +03:00
94dfb97e69 Reverted #11702: Added yii\rbac\DbManager::$assignmentTablePk to be able to customize RBAC DB schema more (reverted from commit 532242041c3fe32d9208fd68a1167706b11b45df) 2016-06-07 11:39:48 +03:00
532242041c Fixes #11702: Added yii\rbac\DbManager::$assignmentTablePk to be able to customize RBAC DB schema more 2016-06-06 22:06:36 +03:00
627233715b proper @since annotations 2016-04-28 02:25:32 +02:00
d438c03dbc Bug #11223: Fixed returning an empty array when DbManager::getRolesByUser() was called on a user with user id 0
* Bug #11223: Fixed returning an empty array when DbManager::getRolesByUser() was called on a user with user id 0 (VirtualRJ)

* Added unit tests for #11223
2016-04-01 22:28:23 +03:00
049ea37f77 Fixes #10993: Fixed yii\rbac\DbManager::removeAllRules() and yii\rbac\PhpManager::removeAllItems() 2016-03-16 01:53:48 +03:00
7eff23886c Fixes #10726: Added yii\rbac\ManagerInterface::canAddChild() 2016-03-15 22:43:27 +03:00
effe3b0b94 phpdoc adjustments 2016-02-07 18:12:22 +01:00
cc4849a3ae Renamed getUserIDsByRole → getUserIdsByRole for consistency
See 0e0079bcae (commitcomment-14953758)
2015-12-14 12:34:00 +03:00
08034bbe10 Add @since [skip ci] 2015-12-14 00:03:46 +01:00
0e0079bcae Fixes #9573: Added yii\rbac\ManagerInterface::getUserIDsByRole() and implementations 2015-12-08 20:00:48 +03:00
5ab4f0f090 Better quotes usage in strings
- Use single quote where interpolation isn't necessary
- Use interpolation when it's better than concatenation
2015-10-10 00:23:52 +03:00
5569eaae06 Fixes #9314: Fixed yii\rbac\DbManager::getPermissionsByUser() not returning permissions directly assigned to a user 2015-09-05 01:31:10 +03:00
aef21ceec8 phpdoc typo 2015-08-03 23:38:58 +02:00
6d9fe671de various code style and whitespace adjustments 2015-08-02 00:27:19 +02:00
8b951796ac Fixes #9263: Avoid extra DB query in RBAC DbManager in case auth item name is empty 2015-08-01 01:42:40 +03:00
07bcc8fda1 Fixes #8595: Fixed yii\rbac\DbManager::checkAccessFromCache() to check against auth items loaded in cache recursively 2015-05-29 10:42:32 -04:00
f11bdfa2a7 Grammar fix: followings -> following 2015-04-21 15:08:16 +02:00
28dce6c9b6 Fixes #7656: Fixed yii\rbac\DbManager::getRolesByUser() and yii\rbac\PhpManager::getRolesByUser() to return roles only 2015-04-21 00:29:04 +03:00
3cddd3bab4 Include ruleTable in list of customizable tables [ci skip]
With the addition of ruleTable in 2.0, including it in the list of customizable tables in the class-level doc makes it easier to spot the difference from 1.1.
2015-03-29 10:14:37 -05:00
6e33bef238 Fixes #7266 2015-02-13 14:02:54 -05:00
d188dd10c0 Fixes #3168: Improved the performance of yii\rbac\DbManager::checkAccess() by caching mechanism 2015-02-12 21:29:00 -05:00
6481d13494 Optimized checks order in conditions 2015-02-08 17:56:36 +03:00
d341bf02b4 Fixes #6398: Added support for specifying dependent component in terms of a configuration array for classes such as DbCache 2015-01-04 19:28:05 -05:00
402d58cfd8 Fixes #6081: yii\rbac\DbManager::getChildren() was not quoting column name properly 2014-11-27 00:28:55 +03:00
280dd1651d Fixes #6172: yii\rbac\DbManager should properly quote table and column names 2014-11-22 18:25:02 -05:00
bb8550886e PHP type casting 2014-10-25 15:30:03 +03:00
999e8b84d4 Fixes #5584: yii\rbac\DbRbacManager should not delete items when deleting a rule on a database not supporting cascade update 2014-10-16 08:13:31 -04:00