Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from justcoded/develop
Browse files Browse the repository at this point in the history
Added debug panel to allow regexp by default
  • Loading branch information
aprokopenko authored Apr 13, 2018
2 parents 415e73a + 5712944 commit 3037bcb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
CHANGELOG
=====================

v1.1.2
---------------------
* AccessControl filter update default regexp to ^site, in debug mode add gii and debug modules.

v1.1.1
---------------------
* Bugfix: Permission Child/Parents boxes cleanup available options from already exists.
* Bugfix: Permission Child/Parents fixed fatal error on hierarchy loop.

v1.1
---------------------
* Role permission selector now have better UI with real trees.
* Bugfix: Item name validation not allow '*'.
* NEW: Permissions selector as a real Tree-based selector.
* Bugfix: Fix wrong unique name validations for Role and Permission creating form.
* Bugfix: Fatal error on creating Role/Permission with existed name.

v1.0.2
---------------------
* Bugfix: Routes Scanner take info from comments as well, not class definition.

v1.0.1
---------------------
* Disable inherit permissions in role permissions selector.
Expand Down
28 changes: 23 additions & 5 deletions src/filters/RouteAccessControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,32 @@
class RouteAccessControl extends ActionFilter
{
/**
* @var array List of action that not need to check access.
* List of action that not need to check access.
*
* @var array
*/
public $allowActions = [];

/**
* @var string Allow route pattern
* Allow route pattern
* in debug mode default value is "/^(site|gii|debug)\//i".
*
* @var string
*/
public $allowRegexp = '/(gii)/i';
public $allowRegexp = '/^(site)\//i';

/**
* RouteAccessControl constructor.
*
* @param array $config
*/
public function __construct(array $config = [])
{
if (defined('YII_DEBUG') && YII_DEBUG) {
$this->allowRegexp = '/^(site|gii|debug)\//i';
}
parent::__construct($config);
}

/**
* This method is invoked right before an action is to be executed (after all possible filters.)
Expand All @@ -45,7 +63,7 @@ public function beforeAction($action)
}

if (in_array($action_rule, $this->allowActions)
|| in_array($controller_rule, $this->allowActions)
|| in_array($controller_rule, $this->allowActions)
) {
$allow = true;
} else {
Expand All @@ -63,7 +81,7 @@ public function beforeAction($action)
/**
* Deny access method
*
* @throws ForbiddenHttpException
* @throws ForbiddenHttpException Deny exception.
*/
public function denyAccess()
{
Expand Down

0 comments on commit 3037bcb

Please sign in to comment.