Version Description
- Enhanced Access Policy with additional markers
- Fixed minor PHP warnings caused by other plugins incompatibility
- Fixed couple UI typos
Download this release
Release Info
Developer | vasyltech |
Plugin | Advanced Access Manager |
Version | 5.9.8 |
Comparing to | |
See all releases |
Code changes from version 5.9.7.3 to 5.9.8
- aam.php +3 -3
- application/Backend/Manager.php +18 -16
- application/Core/API.php +13 -3
- application/Core/Policy/Manager.php +14 -0
- application/Core/Policy/Token.php +30 -10
- application/Shared/Manager.php +5 -4
- readme.txt +7 -2
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: 5.9.
|
7 |
* Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
* Author URI: https://vasyltech.com
|
9 |
* Text Domain: advanced-access-manager
|
@@ -276,7 +276,7 @@ if (defined('ABSPATH')) {
|
|
276 |
AAM_Autoloader::register();
|
277 |
|
278 |
// Keep this as the lowest priority
|
279 |
-
add_action('plugins_loaded', 'AAM::onPluginsLoaded', -
|
280 |
|
281 |
//the highest priority (higher the core)
|
282 |
//this is important to have to catch events like register core post types
|
@@ -290,7 +290,7 @@ if (defined('ABSPATH')) {
|
|
290 |
wp_schedule_event(time(), 'daily', 'aam-cron');
|
291 |
}
|
292 |
add_action('aam-cron', 'AAM::cron');
|
293 |
-
|
294 |
//activation & deactivation hooks
|
295 |
register_activation_hook(__FILE__, array('AAM', 'activate'));
|
296 |
register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
|
3 |
/**
|
4 |
* Plugin Name: Advanced Access Manager
|
5 |
* Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
|
6 |
+
* Version: 5.9.8
|
7 |
* Author: Vasyl Martyniuk <vasyl@vasyltech.com>
|
8 |
* Author URI: https://vasyltech.com
|
9 |
* Text Domain: advanced-access-manager
|
276 |
AAM_Autoloader::register();
|
277 |
|
278 |
// Keep this as the lowest priority
|
279 |
+
add_action('plugins_loaded', 'AAM::onPluginsLoaded', -999);
|
280 |
|
281 |
//the highest priority (higher the core)
|
282 |
//this is important to have to catch events like register core post types
|
290 |
wp_schedule_event(time(), 'daily', 'aam-cron');
|
291 |
}
|
292 |
add_action('aam-cron', 'AAM::cron');
|
293 |
+
|
294 |
//activation & deactivation hooks
|
295 |
register_activation_hook(__FILE__, array('AAM', 'activate'));
|
296 |
register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
|
application/Backend/Manager.php
CHANGED
@@ -685,21 +685,23 @@ class AAM_Backend_Manager {
|
|
685 |
|
686 |
$reflection = new ReflectionClass(get_class($wp_admin_bar));
|
687 |
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
if (isset($nodes['root']) && is_null($cache)) {
|
694 |
-
$cache = array();
|
695 |
-
foreach($nodes['root']->children as $node) {
|
696 |
-
$cache = array_merge($cache, $node->children);
|
697 |
-
}
|
698 |
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
}
|
704 |
}
|
705 |
}
|
@@ -992,8 +994,8 @@ class AAM_Backend_Manager {
|
|
992 |
if (current_user_can($type->cap->create_posts)) {
|
993 |
add_submenu_page(
|
994 |
'aam',
|
995 |
-
'Add New
|
996 |
-
'Add New
|
997 |
$type->cap->create_posts,
|
998 |
'post-new.php?post_type=aam_policy'
|
999 |
);
|
685 |
|
686 |
$reflection = new ReflectionClass(get_class($wp_admin_bar));
|
687 |
|
688 |
+
if ($reflection->hasProperty('nodes')) {
|
689 |
+
$prop = $reflection->getProperty('nodes');
|
690 |
+
$prop->setAccessible(true);
|
691 |
+
|
692 |
+
$nodes = $prop->getValue($wp_admin_bar);
|
|
|
|
|
|
|
|
|
|
|
693 |
|
694 |
+
if (isset($nodes['root']) && is_null($cache)) {
|
695 |
+
$cache = array();
|
696 |
+
foreach($nodes['root']->children as $node) {
|
697 |
+
$cache = array_merge($cache, $node->children);
|
698 |
+
}
|
699 |
+
|
700 |
+
// do some cleanup
|
701 |
+
foreach($cache as $i => $node) {
|
702 |
+
if ($node->id === 'menu-toggle') {
|
703 |
+
unset($cache[$i]);
|
704 |
+
}
|
705 |
}
|
706 |
}
|
707 |
}
|
994 |
if (current_user_can($type->cap->create_posts)) {
|
995 |
add_submenu_page(
|
996 |
'aam',
|
997 |
+
'Add New Policy',
|
998 |
+
'Add New Policy',
|
999 |
$type->cap->create_posts,
|
1000 |
'post-new.php?post_type=aam_policy'
|
1001 |
);
|
application/Core/API.php
CHANGED
@@ -423,11 +423,11 @@ final class AAM_Core_API {
|
|
423 |
*
|
424 |
* @return AAM_Core_Object_Post|null
|
425 |
*/
|
426 |
-
public static function getCurrentPost() {
|
427 |
global $wp_query, $post;
|
428 |
|
429 |
$res = $post;
|
430 |
-
|
431 |
if (get_the_ID()) {
|
432 |
$res = get_post(get_the_ID());
|
433 |
} elseif (!empty($wp_query->queried_object)) {
|
@@ -455,8 +455,18 @@ final class AAM_Core_API {
|
|
455 |
}
|
456 |
|
457 |
$user = AAM::getUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
|
459 |
-
return
|
460 |
}
|
461 |
|
462 |
/**
|
423 |
*
|
424 |
* @return AAM_Core_Object_Post|null
|
425 |
*/
|
426 |
+
public static function getCurrentPost($raw = false) {
|
427 |
global $wp_query, $post;
|
428 |
|
429 |
$res = $post;
|
430 |
+
|
431 |
if (get_the_ID()) {
|
432 |
$res = get_post(get_the_ID());
|
433 |
} elseif (!empty($wp_query->queried_object)) {
|
455 |
}
|
456 |
|
457 |
$user = AAM::getUser();
|
458 |
+
|
459 |
+
$response = null;
|
460 |
+
|
461 |
+
if (is_a($res, 'WP_Post')) {
|
462 |
+
if ($raw) {
|
463 |
+
$response = $res;
|
464 |
+
} else {
|
465 |
+
$response = $user->getObject('post', $res->ID);
|
466 |
+
}
|
467 |
+
}
|
468 |
|
469 |
+
return $response;
|
470 |
}
|
471 |
|
472 |
/**
|
application/Core/Policy/Manager.php
CHANGED
@@ -383,6 +383,20 @@ final class AAM_Core_Policy_Manager {
|
|
383 |
}
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
return $res;
|
387 |
}, 1, 2);
|
388 |
}
|
383 |
}
|
384 |
}
|
385 |
|
386 |
+
return $res;
|
387 |
+
}, 1, 2);
|
388 |
+
} elseif (strpos($id, 'site_option:') === 0) {
|
389 |
+
add_filter('site_option_' . substr($id, 12), function($res, $option) {
|
390 |
+
$param = $this->tree['Param']["site_option:{$option}"];
|
391 |
+
|
392 |
+
if ($this->isApplicable($param)) {
|
393 |
+
if (is_array($res) && is_array($param['Value'])) {
|
394 |
+
$res = array_merge($res, $param['Value']);
|
395 |
+
} else {
|
396 |
+
$res = $param['Value'];
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
return $res;
|
401 |
}, 1, 2);
|
402 |
}
|
application/Core/Policy/Token.php
CHANGED
@@ -25,16 +25,17 @@ final class AAM_Core_Policy_Token {
|
|
25 |
* @static
|
26 |
*/
|
27 |
protected static $map = array(
|
28 |
-
'USER'
|
29 |
-
'USERMETA'
|
30 |
-
'DATETIME'
|
31 |
-
'GET'
|
32 |
-
'QUERY'
|
33 |
-
'POST'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
|
|
38 |
);
|
39 |
|
40 |
/**
|
@@ -163,6 +164,25 @@ final class AAM_Core_Policy_Token {
|
|
163 |
|
164 |
return $value;
|
165 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
/**
|
168 |
* Get inline argument
|
25 |
* @static
|
26 |
*/
|
27 |
protected static $map = array(
|
28 |
+
'USER' => 'AAM_Core_Policy_Token::getUserValue',
|
29 |
+
'USERMETA' => 'AAM_Core_Policy_Token::getUserMetaValue',
|
30 |
+
'DATETIME' => 'AAM_Core_Policy_Token::getDateTimeValue',
|
31 |
+
'GET' => 'AAM_Core_Request::get',
|
32 |
+
'QUERY' => 'AAM_Core_Request::get',
|
33 |
+
'POST' => 'AAM_Core_Request::post',
|
34 |
+
'WP_POSTMETA' => 'AAM_Core_Policy_Token::getCurrentPostMeta',
|
35 |
+
'COOKIE' => 'AAM_Core_Request::cookie',
|
36 |
+
'SERVER' => 'AAM_Core_Request::server',
|
37 |
+
'ARGS' => 'AAM_Core_Policy_Token::getArgValue',
|
38 |
+
'CONST' => 'AAM_Core_Policy_Token::defined'
|
39 |
);
|
40 |
|
41 |
/**
|
164 |
|
165 |
return $value;
|
166 |
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Undocumented function
|
170 |
+
*
|
171 |
+
* @param [type] $metakey
|
172 |
+
* @return void
|
173 |
+
*/
|
174 |
+
protected static function getCurrentPostMeta($metakey)
|
175 |
+
{
|
176 |
+
$post = AAM_Core_API::getCurrentPost(true);
|
177 |
+
|
178 |
+
if (is_a($post, 'WP_Post')) {
|
179 |
+
$meta = get_post_meta($post->ID, $metakey, true);
|
180 |
+
} else {
|
181 |
+
$meta = null;
|
182 |
+
}
|
183 |
+
|
184 |
+
return $meta;
|
185 |
+
}
|
186 |
|
187 |
/**
|
188 |
* Get inline argument
|
application/Shared/Manager.php
CHANGED
@@ -157,10 +157,11 @@ class AAM_Shared_Manager {
|
|
157 |
register_post_type('aam_policy', array(
|
158 |
'label' => __('Access Policy', AAM_KEY),
|
159 |
'labels' => array(
|
160 |
-
'name'
|
161 |
-
'edit_item'
|
162 |
-
'
|
163 |
-
'
|
|
|
164 |
),
|
165 |
'description' => __('Access and security policy', AAM_KEY),
|
166 |
'public' => true,
|
157 |
register_post_type('aam_policy', array(
|
158 |
'label' => __('Access Policy', AAM_KEY),
|
159 |
'labels' => array(
|
160 |
+
'name' => __('Access Policies', AAM_KEY),
|
161 |
+
'edit_item' => __('Edit Policy', AAM_KEY),
|
162 |
+
'singular_name' => __('Policy', AAM_KEY),
|
163 |
+
'add_new_item' => __('Add New Policy', AAM_KEY),
|
164 |
+
'new_item' => __('New Policy', AAM_KEY)
|
165 |
),
|
166 |
'description' => __('Access and security policy', AAM_KEY),
|
167 |
'public' => true,
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: vasyltech
|
3 |
Tags: access control, membership, backend menu, user role, restricted content, security, jwt
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 5.2.
|
6 |
-
Stable tag: 5.9.
|
7 |
|
8 |
All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
|
9 |
|
@@ -80,6 +80,11 @@ https://www.youtube.com/watch?v=mj5Xa_Wc16Y
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
|
|
|
|
83 |
= 5.9.7.3 =
|
84 |
* Fixed the PHP notice that is triggered when Multiple roles is enabled and no roles selected for any particular user
|
85 |
|
2 |
Contributors: vasyltech
|
3 |
Tags: access control, membership, backend menu, user role, restricted content, security, jwt
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 5.2.2
|
6 |
+
Stable tag: 5.9.8
|
7 |
|
8 |
All you need to manage access to you WordPress websites on frontend, backend and API levels for any role, user or visitors.
|
9 |
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 5.9.8 =
|
84 |
+
* Enhanced Access Policy with additional markers
|
85 |
+
* Fixed minor PHP warnings caused by other plugins incompatibility
|
86 |
+
* Fixed couple UI typos
|
87 |
+
|
88 |
= 5.9.7.3 =
|
89 |
* Fixed the PHP notice that is triggered when Multiple roles is enabled and no roles selected for any particular user
|
90 |
|