Version Description
- Fixed: PHP Deprecated: filter_var(): Passing null to parameter https://github.com/aamplugin/advanced-access-manager/issues/208
- Added New: Extend CALLBACK to support inline arguments https://github.com/aamplugin/advanced-access-manager/issues/206
- Added New: Add support for the THE_POST token https://github.com/aamplugin/advanced-access-manager/issues/205
- Added New: Add support for new resource types Filter & Action https://github.com/aamplugin/advanced-access-manager/issues/207
Download this release
Release Info
Developer | vasyltech |
Plugin | Advanced Access Manager |
Version | 6.8.3 |
Comparing to | |
See all releases |
Code changes from version 6.8.2 to 6.8.3
- aam.php +8 -8
- application/Core/Contract/RequestTrait.php +30 -12
- application/Core/Policy/Resource.php +12 -1
- application/Core/Policy/Token.php +133 -5
- application/Core/Policy/Typecast.php +13 -1
- application/Service/AccessPolicy.php +26 -2
- readme.txt +7 -1
aam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Plugin Name: Advanced Access Manager
|
5 |
* Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
|
6 |
-
* Version: 6.8.
|
7 |
* Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
* Author URI: https://vasyltech.com
|
9 |
* Text Domain: advanced-access-manager
|
@@ -261,27 +261,27 @@ class AAM
|
|
261 |
}
|
262 |
|
263 |
if (defined('ABSPATH')) {
|
264 |
-
//
|
265 |
define('AAM_MEDIA', plugins_url('/media', __FILE__));
|
266 |
define('AAM_KEY', 'advanced-access-manager');
|
267 |
-
define('AAM_VERSION', '6.8.
|
268 |
define('AAM_BASEDIR', __DIR__);
|
269 |
|
270 |
-
//
|
271 |
require __DIR__ . '/vendor/autoload.php';
|
272 |
|
273 |
-
//
|
274 |
require(__DIR__ . '/autoloader.php');
|
275 |
AAM_Autoloader::register();
|
276 |
|
277 |
// Keep this as the lowest priority
|
278 |
add_action('plugins_loaded', 'AAM::onPluginsLoaded', -999);
|
279 |
|
280 |
-
//
|
281 |
-
//this is important to have to catch events like register core post types
|
282 |
add_action('init', 'AAM::onInit', -1);
|
283 |
|
284 |
-
//
|
285 |
register_activation_hook(__FILE__, array('AAM', 'activate'));
|
286 |
register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
|
287 |
}
|
3 |
/**
|
4 |
* Plugin Name: Advanced Access Manager
|
5 |
* Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
|
6 |
+
* Version: 6.8.3
|
7 |
* Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
* Author URI: https://vasyltech.com
|
9 |
* Text Domain: advanced-access-manager
|
261 |
}
|
262 |
|
263 |
if (defined('ABSPATH')) {
|
264 |
+
// Define few common constants
|
265 |
define('AAM_MEDIA', plugins_url('/media', __FILE__));
|
266 |
define('AAM_KEY', 'advanced-access-manager');
|
267 |
+
define('AAM_VERSION', '6.8.3');
|
268 |
define('AAM_BASEDIR', __DIR__);
|
269 |
|
270 |
+
// Load vendor
|
271 |
require __DIR__ . '/vendor/autoload.php';
|
272 |
|
273 |
+
// Register autoloader
|
274 |
require(__DIR__ . '/autoloader.php');
|
275 |
AAM_Autoloader::register();
|
276 |
|
277 |
// Keep this as the lowest priority
|
278 |
add_action('plugins_loaded', 'AAM::onPluginsLoaded', -999);
|
279 |
|
280 |
+
// The highest priority (higher the core)
|
281 |
+
// this is important to have to catch events like register core post types
|
282 |
add_action('init', 'AAM::onInit', -1);
|
283 |
|
284 |
+
// Activation & deactivation hooks
|
285 |
register_activation_hook(__FILE__, array('AAM', 'activate'));
|
286 |
register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
|
287 |
}
|
application/Core/Contract/RequestTrait.php
CHANGED
@@ -28,10 +28,13 @@ trait AAM_Core_Contract_RequestTrait
|
|
28 |
*
|
29 |
* @return mixed
|
30 |
*
|
|
|
|
|
|
|
31 |
* @access public
|
32 |
-
* @version 6.
|
33 |
*/
|
34 |
-
public function getFromPost($param, $filter = FILTER_DEFAULT, $options =
|
35 |
{
|
36 |
$post = filter_input(INPUT_POST, $param, $filter, $options);
|
37 |
|
@@ -51,10 +54,13 @@ trait AAM_Core_Contract_RequestTrait
|
|
51 |
*
|
52 |
* @return mixed
|
53 |
*
|
|
|
|
|
|
|
54 |
* @access public
|
55 |
-
* @version 6.
|
56 |
*/
|
57 |
-
public function getSafeFromPost($param, $filter = FILTER_DEFAULT, $options =
|
58 |
{
|
59 |
$value = $this->getFromPost($param, $filter, $options);
|
60 |
|
@@ -70,10 +76,13 @@ trait AAM_Core_Contract_RequestTrait
|
|
70 |
*
|
71 |
* @return mixed
|
72 |
*
|
|
|
|
|
|
|
73 |
* @access public
|
74 |
-
* @version 6.
|
75 |
*/
|
76 |
-
public function getFromQuery($param, $filter = FILTER_DEFAULT, $options =
|
77 |
{
|
78 |
$get = filter_input(INPUT_GET, $param, $filter, $options);
|
79 |
|
@@ -93,10 +102,13 @@ trait AAM_Core_Contract_RequestTrait
|
|
93 |
*
|
94 |
* @return mixed
|
95 |
*
|
|
|
|
|
|
|
96 |
* @access public
|
97 |
-
* @version 6.
|
98 |
*/
|
99 |
-
public function getFromRequest($param, $filter = FILTER_DEFAULT, $options =
|
100 |
{
|
101 |
return filter_var($this->readFromArray($_REQUEST, $param), $filter, $options);
|
102 |
}
|
@@ -110,10 +122,13 @@ trait AAM_Core_Contract_RequestTrait
|
|
110 |
*
|
111 |
* @return mixed
|
112 |
*
|
|
|
|
|
|
|
113 |
* @access public
|
114 |
-
* @version 6.
|
115 |
*/
|
116 |
-
public function getFromCookie($param, $filter = FILTER_DEFAULT, $options =
|
117 |
{
|
118 |
$cookie = filter_input(INPUT_COOKIE, $param, $filter, $options);
|
119 |
|
@@ -135,10 +150,13 @@ trait AAM_Core_Contract_RequestTrait
|
|
135 |
*
|
136 |
* @return mixed
|
137 |
*
|
|
|
|
|
|
|
138 |
* @access public
|
139 |
-
* @version 6.
|
140 |
*/
|
141 |
-
public function getFromServer($param, $filter = FILTER_DEFAULT, $options =
|
142 |
{
|
143 |
$var = filter_input(INPUT_SERVER, $param, $filter, $options);
|
144 |
|
28 |
*
|
29 |
* @return mixed
|
30 |
*
|
31 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/208
|
32 |
+
* @since 6.0.0 Initial implementation of the method
|
33 |
+
*
|
34 |
* @access public
|
35 |
+
* @version 6.8.3
|
36 |
*/
|
37 |
+
public function getFromPost($param, $filter = FILTER_DEFAULT, $options = 0)
|
38 |
{
|
39 |
$post = filter_input(INPUT_POST, $param, $filter, $options);
|
40 |
|
54 |
*
|
55 |
* @return mixed
|
56 |
*
|
57 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/208
|
58 |
+
* @since 6.7.9 Initial implementation of the method
|
59 |
+
*
|
60 |
* @access public
|
61 |
+
* @version 6.8.3
|
62 |
*/
|
63 |
+
public function getSafeFromPost($param, $filter = FILTER_DEFAULT, $options = 0)
|
64 |
{
|
65 |
$value = $this->getFromPost($param, $filter, $options);
|
66 |
|
76 |
*
|
77 |
* @return mixed
|
78 |
*
|
79 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/208
|
80 |
+
* @since 6.0.0 Initial implementation of the method
|
81 |
+
*
|
82 |
* @access public
|
83 |
+
* @version 6.8.3
|
84 |
*/
|
85 |
+
public function getFromQuery($param, $filter = FILTER_DEFAULT, $options = 0)
|
86 |
{
|
87 |
$get = filter_input(INPUT_GET, $param, $filter, $options);
|
88 |
|
102 |
*
|
103 |
* @return mixed
|
104 |
*
|
105 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/208
|
106 |
+
* @since 6.0.0 Initial implementation of the method
|
107 |
+
*
|
108 |
* @access public
|
109 |
+
* @version 6.8.3
|
110 |
*/
|
111 |
+
public function getFromRequest($param, $filter = FILTER_DEFAULT, $options = 0)
|
112 |
{
|
113 |
return filter_var($this->readFromArray($_REQUEST, $param), $filter, $options);
|
114 |
}
|
122 |
*
|
123 |
* @return mixed
|
124 |
*
|
125 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/208
|
126 |
+
* @since 6.0.0 Initial implementation of the method
|
127 |
+
*
|
128 |
* @access public
|
129 |
+
* @version 6.8.3
|
130 |
*/
|
131 |
+
public function getFromCookie($param, $filter = FILTER_DEFAULT, $options = 0)
|
132 |
{
|
133 |
$cookie = filter_input(INPUT_COOKIE, $param, $filter, $options);
|
134 |
|
150 |
*
|
151 |
* @return mixed
|
152 |
*
|
153 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/208
|
154 |
+
* @since 6.0.0 Initial implementation of the method
|
155 |
+
*
|
156 |
* @access public
|
157 |
+
* @version 6.8.3
|
158 |
*/
|
159 |
+
public function getFromServer($param, $filter = FILTER_DEFAULT, $options = 0)
|
160 |
{
|
161 |
$var = filter_input(INPUT_SERVER, $param, $filter, $options);
|
162 |
|
application/Core/Policy/Resource.php
CHANGED
@@ -11,7 +11,11 @@
|
|
11 |
* AAM core policy resources
|
12 |
*
|
13 |
* @package AAM
|
14 |
-
*
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
class AAM_Core_Policy_Resource
|
17 |
{
|
@@ -86,4 +90,11 @@ class AAM_Core_Policy_Resource
|
|
86 |
*/
|
87 |
const ROUTE = 'Route';
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
11 |
* AAM core policy resources
|
12 |
*
|
13 |
* @package AAM
|
14 |
+
*
|
15 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/207
|
16 |
+
* @since 6.0.0 Initial implementation of the class
|
17 |
+
*
|
18 |
+
* @version 6.8.3
|
19 |
*/
|
20 |
class AAM_Core_Policy_Resource
|
21 |
{
|
90 |
*/
|
91 |
const ROUTE = 'Route';
|
92 |
|
93 |
+
/**
|
94 |
+
* WordPress core hooks (actions and filters)
|
95 |
+
*
|
96 |
+
* @version 6.8.3
|
97 |
+
*/
|
98 |
+
const HOOK = 'Hook';
|
99 |
+
|
100 |
}
|
application/Core/Policy/Token.php
CHANGED
@@ -10,6 +10,7 @@
|
|
10 |
/**
|
11 |
* AAM core policy token evaluator
|
12 |
*
|
|
|
13 |
* @since 6.3.0 Fixed bug that was causing fatal error policies that have conditions
|
14 |
* defined for Capability & Role resources
|
15 |
* @since 6.2.1 Added POLICY_META token
|
@@ -19,7 +20,7 @@
|
|
19 |
* @since 6.0.0 Initial implementation of the class
|
20 |
*
|
21 |
* @package AAM
|
22 |
-
* @version 6.3
|
23 |
*/
|
24 |
class AAM_Core_Policy_Token
|
25 |
{
|
@@ -29,6 +30,7 @@ class AAM_Core_Policy_Token
|
|
29 |
*
|
30 |
* @var array
|
31 |
*
|
|
|
32 |
* @since 6.3.0 Added PHP_GLOBAL, WP_NETWORK_OPTION token and changed
|
33 |
* WP_OPTION callback
|
34 |
* @since 6.2.1 Added `POLICY_META` token
|
@@ -38,7 +40,7 @@ class AAM_Core_Policy_Token
|
|
38 |
* @since 6.0.0 Initial implementation of the property
|
39 |
*
|
40 |
* @access protected
|
41 |
-
* @version 6.3
|
42 |
*/
|
43 |
protected static $map = array(
|
44 |
'USER' => 'AAM_Core_Policy_Token::getUserValue',
|
@@ -61,6 +63,7 @@ class AAM_Core_Policy_Token
|
|
61 |
'POLICY_META' => 'AAM_Core_Policy_Token::getPolicyMeta',
|
62 |
'WP_SITE' => 'AAM_Core_Policy_Token::getSiteParam',
|
63 |
'WP_NETWORK_OPTION' => 'AAM_Core_Policy_Token::getNetworkOption',
|
|
|
64 |
);
|
65 |
|
66 |
/**
|
@@ -100,11 +103,12 @@ class AAM_Core_Policy_Token
|
|
100 |
*
|
101 |
* @return mixed
|
102 |
*
|
103 |
-
* @since 6.
|
|
|
104 |
* @since 6.1.0 Initial implementation of the method
|
105 |
*
|
106 |
* @access public
|
107 |
-
* @version 6.
|
108 |
*/
|
109 |
public static function getTokenValue($token, $args = array())
|
110 |
{
|
@@ -117,7 +121,7 @@ class AAM_Core_Policy_Token
|
|
117 |
$value = call_user_func(self::$map[$parts[0]], $parts[1]);
|
118 |
}
|
119 |
} elseif ($parts[0] === 'CALLBACK') {
|
120 |
-
$value =
|
121 |
} else {
|
122 |
$value = apply_filters(
|
123 |
'aam_policy_token_value_filter', null, $parts[0], $parts[1], $args
|
@@ -127,6 +131,123 @@ class AAM_Core_Policy_Token
|
|
127 |
return $value;
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
/**
|
131 |
* Get USER's value
|
132 |
*
|
@@ -197,6 +318,13 @@ class AAM_Core_Policy_Token
|
|
197 |
return $value;
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
/**
|
201 |
* Get user meta value(s)
|
202 |
*
|
10 |
/**
|
11 |
* AAM core policy token evaluator
|
12 |
*
|
13 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/205
|
14 |
* @since 6.3.0 Fixed bug that was causing fatal error policies that have conditions
|
15 |
* defined for Capability & Role resources
|
16 |
* @since 6.2.1 Added POLICY_META token
|
20 |
* @since 6.0.0 Initial implementation of the class
|
21 |
*
|
22 |
* @package AAM
|
23 |
+
* @version 6.8.3
|
24 |
*/
|
25 |
class AAM_Core_Policy_Token
|
26 |
{
|
30 |
*
|
31 |
* @var array
|
32 |
*
|
33 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/205
|
34 |
* @since 6.3.0 Added PHP_GLOBAL, WP_NETWORK_OPTION token and changed
|
35 |
* WP_OPTION callback
|
36 |
* @since 6.2.1 Added `POLICY_META` token
|
40 |
* @since 6.0.0 Initial implementation of the property
|
41 |
*
|
42 |
* @access protected
|
43 |
+
* @version 6.8.3
|
44 |
*/
|
45 |
protected static $map = array(
|
46 |
'USER' => 'AAM_Core_Policy_Token::getUserValue',
|
63 |
'POLICY_META' => 'AAM_Core_Policy_Token::getPolicyMeta',
|
64 |
'WP_SITE' => 'AAM_Core_Policy_Token::getSiteParam',
|
65 |
'WP_NETWORK_OPTION' => 'AAM_Core_Policy_Token::getNetworkOption',
|
66 |
+
'THE_POST' => 'AAM_Core_Policy_Token::getCurrentPostValue'
|
67 |
);
|
68 |
|
69 |
/**
|
103 |
*
|
104 |
* @return mixed
|
105 |
*
|
106 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/206
|
107 |
+
* @since 6.3.3 https://github.com/aamplugin/advanced-access-manager/issues/50
|
108 |
* @since 6.1.0 Initial implementation of the method
|
109 |
*
|
110 |
* @access public
|
111 |
+
* @version 6.8.3
|
112 |
*/
|
113 |
public static function getTokenValue($token, $args = array())
|
114 |
{
|
121 |
$value = call_user_func(self::$map[$parts[0]], $parts[1]);
|
122 |
}
|
123 |
} elseif ($parts[0] === 'CALLBACK') {
|
124 |
+
$value = self::evaluateCallback($parts[1], $args);
|
125 |
} else {
|
126 |
$value = apply_filters(
|
127 |
'aam_policy_token_value_filter', null, $parts[0], $parts[1], $args
|
131 |
return $value;
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* Evaluate CALLBACK expression
|
136 |
+
*
|
137 |
+
* @param string $exp
|
138 |
+
* @param array $args
|
139 |
+
*
|
140 |
+
* @return mixed
|
141 |
+
*
|
142 |
+
* @access protected
|
143 |
+
* @version 6.8.3
|
144 |
+
*/
|
145 |
+
protected static function evaluateCallback($exp, $args)
|
146 |
+
{
|
147 |
+
$response = null;
|
148 |
+
$cb = self::_parseFunction($exp, $args);
|
149 |
+
|
150 |
+
if (!is_null($cb)) {
|
151 |
+
if (is_callable($cb['func']) || function_exists($cb['func'])) {
|
152 |
+
$result = call_user_func_array($cb['func'], $cb['args']);
|
153 |
+
|
154 |
+
if (!empty($cb['xpath'])) {
|
155 |
+
$response = self::_getValueByXPath($result, $cb['xpath']);
|
156 |
+
} else {
|
157 |
+
$response = $result;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
return $response;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Parse CALLBACK expression
|
167 |
+
*
|
168 |
+
* @param string $exp
|
169 |
+
* @param array $args
|
170 |
+
*
|
171 |
+
* @return array
|
172 |
+
*
|
173 |
+
* @access private
|
174 |
+
* @version 6.8.3
|
175 |
+
*/
|
176 |
+
private static function _parseFunction($exp, $args)
|
177 |
+
{
|
178 |
+
$response = null;
|
179 |
+
$regex = '/^([^(]+)\(?([^)]*)\)?(.*)$/i';
|
180 |
+
|
181 |
+
if (preg_match($regex, $exp, $match)) {
|
182 |
+
// The second part is the collection of arguments that we pass to
|
183 |
+
// the function
|
184 |
+
$markers = array_map('trim', explode(',', $match[2]));
|
185 |
+
$values = [];
|
186 |
+
|
187 |
+
foreach($markers as $marker) {
|
188 |
+
if (preg_match('/^\'.*\'$/', $marker) === 1) { // This is literal string
|
189 |
+
array_push($values, trim($marker, '\''));
|
190 |
+
} elseif (strpos($marker, '.') !== false) { // Potentially another marker
|
191 |
+
array_push($values, self::getTokenValue($marker, $args));
|
192 |
+
} else {
|
193 |
+
array_push($values, $marker);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
$response = array(
|
198 |
+
'func' => trim($match[1]),
|
199 |
+
'args' => $values,
|
200 |
+
'xpath' => trim($match[3])
|
201 |
+
);
|
202 |
+
}
|
203 |
+
|
204 |
+
return $response;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Get value by xpath
|
209 |
+
*
|
210 |
+
* This method supports multiple different path
|
211 |
+
*
|
212 |
+
* @param mixed $obj
|
213 |
+
* @param string $xpath
|
214 |
+
*
|
215 |
+
* @return mixed
|
216 |
+
*
|
217 |
+
* @access private
|
218 |
+
* @version 6.8.3
|
219 |
+
*/
|
220 |
+
private static function _getValueByXPath($obj, $xpath)
|
221 |
+
{
|
222 |
+
$value = $obj;
|
223 |
+
$path = trim(
|
224 |
+
str_replace(
|
225 |
+
array('["', '[', '"]', ']', '..'), '.', $xpath
|
226 |
+
),
|
227 |
+
' .' // white space is important!
|
228 |
+
);
|
229 |
+
|
230 |
+
foreach(explode('.', $path) as $l) {
|
231 |
+
if (is_object($value)) {
|
232 |
+
if (isset($value->{$l})) {
|
233 |
+
$value = $value->{$l};
|
234 |
+
} else {
|
235 |
+
$value = null;
|
236 |
+
break;
|
237 |
+
}
|
238 |
+
} else if (is_array($value)) {
|
239 |
+
if (array_key_exists($l, $value)) {
|
240 |
+
$value = $value[$l];
|
241 |
+
} else {
|
242 |
+
$value = null;
|
243 |
+
break;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
return $value;
|
249 |
+
}
|
250 |
+
|
251 |
/**
|
252 |
* Get USER's value
|
253 |
*
|
318 |
return $value;
|
319 |
}
|
320 |
|
321 |
+
protected static function getCurrentPostValue($option_name)
|
322 |
+
{
|
323 |
+
$post = AAM_Core_API::getCurrentPost();
|
324 |
+
|
325 |
+
return is_a($post, 'AAM_Core_Object_Post') ? $post->{$option_name} : null;
|
326 |
+
}
|
327 |
+
|
328 |
/**
|
329 |
* Get user meta value(s)
|
330 |
*
|
application/Core/Policy/Typecast.php
CHANGED
@@ -72,7 +72,19 @@ class AAM_Core_Policy_Typecast
|
|
72 |
break;
|
73 |
|
74 |
case 'int':
|
75 |
-
$value = (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
break;
|
77 |
|
78 |
case 'boolean':
|
72 |
break;
|
73 |
|
74 |
case 'int':
|
75 |
+
$value = intval($value);
|
76 |
+
break;
|
77 |
+
|
78 |
+
case 'float':
|
79 |
+
$value = floatval($value);
|
80 |
+
break;
|
81 |
+
|
82 |
+
case 'numeric':
|
83 |
+
if (is_numeric($value)) {
|
84 |
+
$value = is_float($value) ? floatval($value) : intval($value);
|
85 |
+
} else {
|
86 |
+
$value = 0;
|
87 |
+
}
|
88 |
break;
|
89 |
|
90 |
case 'boolean':
|
application/Service/AccessPolicy.php
CHANGED
@@ -10,6 +10,7 @@
|
|
10 |
/**
|
11 |
* Access Policy service
|
12 |
*
|
|
|
13 |
* @since 6.4.0 Enhanced https://github.com/aamplugin/advanced-access-manager/issues/71
|
14 |
* Added new hook `aam_post_read_action_conversion_filter`
|
15 |
* @since 6.3.1 Fixed incompatibility with plugins that use WP_User::get_role_caps
|
@@ -21,7 +22,7 @@
|
|
21 |
* @since 6.0.0 Initial implementation of the class
|
22 |
*
|
23 |
* @package AAM
|
24 |
-
* @version 6.
|
25 |
*/
|
26 |
class AAM_Service_AccessPolicy
|
27 |
{
|
@@ -180,6 +181,7 @@ class AAM_Service_AccessPolicy
|
|
180 |
*
|
181 |
* @return void
|
182 |
*
|
|
|
183 |
* @since 6.4.0 Enhanced https://github.com/aamplugin/advanced-access-manager/issues/71
|
184 |
* https://github.com/aamplugin/advanced-access-manager/issues/62
|
185 |
* https://github.com/aamplugin/advanced-access-manager/issues/63
|
@@ -189,7 +191,7 @@ class AAM_Service_AccessPolicy
|
|
189 |
* @since 6.0.0 Initial implementation of the method
|
190 |
*
|
191 |
* @access protected
|
192 |
-
* @version 6.
|
193 |
*/
|
194 |
protected function initializeHooks()
|
195 |
{
|
@@ -227,6 +229,27 @@ class AAM_Service_AccessPolicy
|
|
227 |
));
|
228 |
});
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
// Hook into AAM core objects initialization
|
231 |
add_filter('aam_menu_object_option_filter', array($this, 'applyAccessPolicyToObject'), 10, 2);
|
232 |
add_filter('aam_metabox_object_option_filter', array($this, 'applyAccessPolicyToObject'), 10, 2);
|
@@ -695,6 +718,7 @@ class AAM_Service_AccessPolicy
|
|
695 |
* @access public
|
696 |
* @link https://aamplugin.com/reference/policy#capability
|
697 |
* @link https://aamplugin.com/reference/policy#role
|
|
|
698 |
* @version 6.3.1
|
699 |
*/
|
700 |
public function initializeUser(AAM_Core_Subject_User $subject)
|
10 |
/**
|
11 |
* Access Policy service
|
12 |
*
|
13 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/207
|
14 |
* @since 6.4.0 Enhanced https://github.com/aamplugin/advanced-access-manager/issues/71
|
15 |
* Added new hook `aam_post_read_action_conversion_filter`
|
16 |
* @since 6.3.1 Fixed incompatibility with plugins that use WP_User::get_role_caps
|
22 |
* @since 6.0.0 Initial implementation of the class
|
23 |
*
|
24 |
* @package AAM
|
25 |
+
* @version 6.8.3
|
26 |
*/
|
27 |
class AAM_Service_AccessPolicy
|
28 |
{
|
181 |
*
|
182 |
* @return void
|
183 |
*
|
184 |
+
* @since 6.8.3 https://github.com/aamplugin/advanced-access-manager/issues/207
|
185 |
* @since 6.4.0 Enhanced https://github.com/aamplugin/advanced-access-manager/issues/71
|
186 |
* https://github.com/aamplugin/advanced-access-manager/issues/62
|
187 |
* https://github.com/aamplugin/advanced-access-manager/issues/63
|
191 |
* @since 6.0.0 Initial implementation of the method
|
192 |
*
|
193 |
* @access protected
|
194 |
+
* @version 6.8.3
|
195 |
*/
|
196 |
protected function initializeHooks()
|
197 |
{
|
229 |
));
|
230 |
});
|
231 |
|
232 |
+
add_action((is_admin() ? 'admin_init' : 'init'), function() {
|
233 |
+
$manager = AAM::api()->getAccessPolicyManager();
|
234 |
+
$found = $manager->getResources(AAM_Core_Policy_Resource::HOOK);
|
235 |
+
|
236 |
+
foreach($found as $resource => $stm) {
|
237 |
+
$parts = explode(':', $resource);
|
238 |
+
|
239 |
+
if (count($parts) === 2) { // Currently support only name:priority
|
240 |
+
if (isset($stm['Effect']) && $stm['Effect'] === 'deny') {
|
241 |
+
$priority = apply_filters(
|
242 |
+
'aam_hook_resource_priority', $parts[1]
|
243 |
+
);
|
244 |
+
|
245 |
+
if (is_bool($priority) || is_numeric($priority)) {
|
246 |
+
remove_all_filters($parts[0], $priority);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}, PHP_INT_MAX);
|
252 |
+
|
253 |
// Hook into AAM core objects initialization
|
254 |
add_filter('aam_menu_object_option_filter', array($this, 'applyAccessPolicyToObject'), 10, 2);
|
255 |
add_filter('aam_metabox_object_option_filter', array($this, 'applyAccessPolicyToObject'), 10, 2);
|
718 |
* @access public
|
719 |
* @link https://aamplugin.com/reference/policy#capability
|
720 |
* @link https://aamplugin.com/reference/policy#role
|
721 |
+
*
|
722 |
* @version 6.3.1
|
723 |
*/
|
724 |
public function initializeUser(AAM_Core_Subject_User $subject)
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: access control, membership, backend menu, user role, restricted content, s
|
|
4 |
Requires at least: 4.7.0
|
5 |
Requires PHP: 5.6.0
|
6 |
Tested up to: 6.0.0
|
7 |
-
Stable tag: 6.8.
|
8 |
|
9 |
All you need to manage access to WordPress websites on the frontend, backend and API levels for any role, user or visitors.
|
10 |
|
@@ -91,6 +91,12 @@ We take security and privacy very seriously, that is why there are several non-n
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
= 6.8.2 =
|
95 |
* Fixed: Fix jquery 1.9 incompatibility with attr 'checked' by @Tofandel [https://github.com/aamplugin/advanced-access-manager/pull/204](https://github.com/aamplugin/advanced-access-manager/pull/204)
|
96 |
|
4 |
Requires at least: 4.7.0
|
5 |
Requires PHP: 5.6.0
|
6 |
Tested up to: 6.0.0
|
7 |
+
Stable tag: 6.8.3
|
8 |
|
9 |
All you need to manage access to WordPress websites on the frontend, backend and API levels for any role, user or visitors.
|
10 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 6.8.3 =
|
95 |
+
* Fixed: PHP Deprecated: filter_var(): Passing null to parameter [https://github.com/aamplugin/advanced-access-manager/issues/208](https://github.com/aamplugin/advanced-access-manager/issues/208)
|
96 |
+
* Added New: Extend CALLBACK to support inline arguments [https://github.com/aamplugin/advanced-access-manager/issues/206](https://github.com/aamplugin/advanced-access-manager/issues/206)
|
97 |
+
* Added New: Add support for the THE_POST token [https://github.com/aamplugin/advanced-access-manager/issues/205](https://github.com/aamplugin/advanced-access-manager/issues/205)
|
98 |
+
* Added New: Add support for new resource types Filter & Action [https://github.com/aamplugin/advanced-access-manager/issues/207](https://github.com/aamplugin/advanced-access-manager/issues/207)
|
99 |
+
|
100 |
= 6.8.2 =
|
101 |
* Fixed: Fix jquery 1.9 incompatibility with attr 'checked' by @Tofandel [https://github.com/aamplugin/advanced-access-manager/pull/204](https://github.com/aamplugin/advanced-access-manager/pull/204)
|
102 |
|