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

Commit 3037bcb

Browse files
authored
Merge pull request #10 from justcoded/develop
Added debug panel to allow regexp by default
2 parents 415e73a + 5712944 commit 3037bcb

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
CHANGELOG
22
=====================
33

4+
v1.1.2
5+
---------------------
6+
* AccessControl filter update default regexp to ^site, in debug mode add gii and debug modules.
7+
8+
v1.1.1
9+
---------------------
10+
* Bugfix: Permission Child/Parents boxes cleanup available options from already exists.
11+
* Bugfix: Permission Child/Parents fixed fatal error on hierarchy loop.
12+
413
v1.1
514
---------------------
6-
* Role permission selector now have better UI with real trees.
7-
* Bugfix: Item name validation not allow '*'.
15+
* NEW: Permissions selector as a real Tree-based selector.
16+
* Bugfix: Fix wrong unique name validations for Role and Permission creating form.
817
* Bugfix: Fatal error on creating Role/Permission with existed name.
918

19+
v1.0.2
20+
---------------------
21+
* Bugfix: Routes Scanner take info from comments as well, not class definition.
22+
1023
v1.0.1
1124
---------------------
1225
* Disable inherit permissions in role permissions selector.

src/filters/RouteAccessControl.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,32 @@
1212
class RouteAccessControl extends ActionFilter
1313
{
1414
/**
15-
* @var array List of action that not need to check access.
15+
* List of action that not need to check access.
16+
*
17+
* @var array
1618
*/
1719
public $allowActions = [];
1820

1921
/**
20-
* @var string Allow route pattern
22+
* Allow route pattern
23+
* in debug mode default value is "/^(site|gii|debug)\//i".
24+
*
25+
* @var string
2126
*/
22-
public $allowRegexp = '/(gii)/i';
27+
public $allowRegexp = '/^(site)\//i';
28+
29+
/**
30+
* RouteAccessControl constructor.
31+
*
32+
* @param array $config
33+
*/
34+
public function __construct(array $config = [])
35+
{
36+
if (defined('YII_DEBUG') && YII_DEBUG) {
37+
$this->allowRegexp = '/^(site|gii|debug)\//i';
38+
}
39+
parent::__construct($config);
40+
}
2341

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

4765
if (in_array($action_rule, $this->allowActions)
48-
|| in_array($controller_rule, $this->allowActions)
66+
|| in_array($controller_rule, $this->allowActions)
4967
) {
5068
$allow = true;
5169
} else {
@@ -63,7 +81,7 @@ public function beforeAction($action)
6381
/**
6482
* Deny access method
6583
*
66-
* @throws ForbiddenHttpException
84+
* @throws ForbiddenHttpException Deny exception.
6785
*/
6886
public function denyAccess()
6987
{

0 commit comments

Comments
 (0)