├── media └── font │ ├── fontello.eot │ ├── fontello.ttf │ ├── fontello.woff │ └── fontello.woff2 ├── .gitignore ├── lang └── advanced-access-manager-en_US.mo ├── vendor ├── vectorface │ └── whip │ │ ├── .scrutinizer.yml │ │ ├── LICENSE │ │ ├── composer.json │ │ └── src │ │ ├── IpRange │ │ └── IpRange.php │ │ └── Request │ │ └── RequestAdapter.php ├── composer │ ├── autoload_namespaces.php │ ├── autoload_files.php │ ├── autoload_classmap.php │ ├── autoload_psr4.php │ ├── platform_check.php │ ├── semver │ │ ├── LICENSE │ │ ├── composer.json │ │ └── src │ │ │ └── Constraint │ │ │ ├── MatchNoneConstraint.php │ │ │ └── MatchAllConstraint.php │ ├── LICENSE │ ├── autoload_real.php │ └── autoload_static.php ├── mustangostang │ └── spyc │ │ ├── examples │ │ ├── yaml-load.php │ │ └── yaml-dump.php │ │ ├── composer.json │ │ ├── php4 │ │ └── 5to4.php │ │ ├── README.md │ │ └── COPYING ├── psr │ └── http-message │ │ ├── README.md │ │ ├── composer.json │ │ └── LICENSE ├── matomo │ └── device-detector │ │ ├── Yaml │ │ ├── ParserInterface.php │ │ ├── Spyc.php │ │ ├── Symfony.php │ │ └── Pecl.php │ │ ├── Parser │ │ ├── AbstractBotParser.php │ │ ├── Device │ │ │ ├── Mobile.php │ │ │ ├── Notebook.php │ │ │ ├── Camera.php │ │ │ ├── Console.php │ │ │ ├── CarBrowser.php │ │ │ ├── PortableMediaPlayer.php │ │ │ ├── ShellTv.php │ │ │ └── HbbTv.php │ │ ├── Client │ │ │ ├── Library.php │ │ │ ├── PIM.php │ │ │ ├── FeedReader.php │ │ │ ├── MediaPlayer.php │ │ │ └── Hints │ │ │ │ ├── AppHints.php │ │ │ │ └── BrowserHints.php │ │ └── VendorFragment.php │ │ ├── regexes │ │ ├── device │ │ │ ├── cameras.yml │ │ │ ├── car_browsers.yml │ │ │ └── consoles.yml │ │ ├── client │ │ │ └── browser_engine.yml │ │ └── vendorfragments.yml │ │ ├── Cache │ │ ├── CacheInterface.php │ │ ├── LaravelCache.php │ │ ├── DoctrineBridge.php │ │ ├── PSR16Bridge.php │ │ ├── StaticCache.php │ │ └── PSR6Bridge.php │ │ ├── autoload.php │ │ └── composer.json └── autoload.php ├── composer.json ├── .default.setup.json ├── runtest.sh ├── application ├── Backend │ ├── tmpl │ │ ├── metabox │ │ │ ├── user-metabox.php │ │ │ ├── post-metabox.php │ │ │ ├── policy-principal-metabox.php │ │ │ ├── iframe-footer.php │ │ │ ├── policy-metabox.php │ │ │ ├── iframe-header.php │ │ │ ├── user-iframe.php │ │ │ ├── post-iframe.php │ │ │ └── policy-parent-metabox.php │ │ ├── index.php │ │ ├── partial │ │ │ ├── visitor-subject-tab.php │ │ │ ├── default-subject-tab.php │ │ │ ├── loading-content.php │ │ │ ├── multisite-sync-notification.php │ │ │ ├── content-service-tips.php │ │ │ ├── post-list.php │ │ │ ├── admin-toolbar-mode.php │ │ │ ├── api-route-mode.php │ │ │ ├── jwt-login-url.php │ │ │ └── backend-menu-mode.php │ │ ├── settings │ │ │ ├── service.php │ │ │ ├── configpress.php │ │ │ ├── security.php │ │ │ ├── content.php │ │ │ ├── multisite.php │ │ │ └── core.php │ │ ├── widget │ │ │ ├── login-frontend.php │ │ │ └── login-backend.php │ │ └── page │ │ │ ├── main-panel.php │ │ │ └── current-subject.php │ └── Feature │ │ ├── Settings │ │ ├── Manager.php │ │ ├── ConfigPress.php │ │ └── Content.php │ │ ├── Main │ │ ├── Welcome.php │ │ ├── Url.php │ │ ├── NotFoundRedirect.php │ │ ├── Jwt.php │ │ ├── AccessDeniedRedirect.php │ │ ├── Capability.php │ │ ├── LoginRedirect.php │ │ ├── LogoutRedirect.php │ │ ├── Widget.php │ │ └── ApiRoute.php │ │ └── Abstract.php ├── Framework │ ├── Proxy │ │ └── Interface.php │ ├── Utility │ │ ├── Interface.php │ │ └── BaseTrait.php │ ├── Service │ │ └── Interface.php │ ├── Resource │ │ ├── PostType.php │ │ ├── Policy.php │ │ ├── Taxonomy.php │ │ ├── Term.php │ │ ├── Generic.php │ │ ├── Capability.php │ │ ├── AdminToolbar.php │ │ ├── BackendMenu.php │ │ ├── ApiRoute.php │ │ ├── Widget.php │ │ ├── Url.php │ │ └── User.php │ ├── Type │ │ ├── Preference.php │ │ └── AccessLevel.php │ ├── Preference │ │ ├── LoginRedirect.php │ │ ├── LogoutRedirect.php │ │ ├── NotFoundRedirect.php │ │ ├── Generic.php │ │ ├── AccessDeniedRedirect.php │ │ └── Interface.php │ └── AccessLevel │ │ ├── Default.php │ │ ├── Visitor.php │ │ └── Role.php └── Service │ ├── Hooks.php │ ├── Welcome.php │ ├── BaseTrait.php │ ├── Shortcodes.php │ ├── NotFoundRedirect.php │ └── Shortcode │ └── Handler │ └── LoginForm.php ├── index.php ├── license.txt ├── tests ├── Service │ ├── ApiRoutesTest.php │ └── JwtsTest.php ├── Framework │ ├── Preference │ │ ├── NotFoundRedirectTest.php │ │ ├── LogoutRedirectTest.php │ │ ├── LoginRedirectTest.php │ │ └── AccessDeniedRedirectTest.php │ ├── Resource │ │ ├── ToolbarTest.php │ │ ├── RouteTest.php │ │ ├── BackendMenuTest.php │ │ └── WidgetTest.php │ ├── Policy │ │ └── XpathTest.php │ └── Service │ │ ├── ApiRoutesTest.php │ │ ├── AccessDeniedRedirectTest.php │ │ ├── LoginRedirectTest.php │ │ ├── LogoutRedirectTest.php │ │ └── NotFoundRedirectTest.php ├── Mocks │ └── metaboxes.mock └── bootstrap.php └── phpunit.xml.dist /media/font/fontello.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aamplugin/advanced-access-manager/HEAD/media/font/fontello.eot -------------------------------------------------------------------------------- /media/font/fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aamplugin/advanced-access-manager/HEAD/media/font/fontello.ttf -------------------------------------------------------------------------------- /media/font/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aamplugin/advanced-access-manager/HEAD/media/font/fontello.woff -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | phpunit 2 | .phpunit.result.cache 3 | .default.setup.json 4 | sami.phar 5 | build 6 | sonarqube 7 | .scannerwork -------------------------------------------------------------------------------- /media/font/fontello.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aamplugin/advanced-access-manager/HEAD/media/font/fontello.woff2 -------------------------------------------------------------------------------- /lang/advanced-access-manager-en_US.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aamplugin/advanced-access-manager/HEAD/lang/advanced-access-manager-en_US.mo -------------------------------------------------------------------------------- /vendor/vectorface/whip/.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | tools: 2 | external_code_coverage: true 3 | 4 | checks: 5 | php: 6 | code_rating: true -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "vectorface/whip": "^0.5.0", 4 | "matomo/device-detector": "^6.4", 5 | "composer/semver": "^3.4" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.default.setup.json: -------------------------------------------------------------------------------- 1 | {"admin_user":{"id":1,"user_login":"admin","user_email":"admin@aamportal.local","first_name":"John","last_name":"Smith","role":"administrator","user_pass":"123456"}} -------------------------------------------------------------------------------- /vendor/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/mustangostang/spyc/Spyc.php', 10 | ); 11 | -------------------------------------------------------------------------------- /vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/composer/InstalledVersions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/user-metabox.php: -------------------------------------------------------------------------------- 1 | user->ID), 6 | 'margin-top:10px;', 7 | 'aam-term-iframe' 8 | ); 9 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/post-metabox.php: -------------------------------------------------------------------------------- 1 | post->ID . '&type=post'), 6 | 'margin-top:10px;', 7 | 'aam-post-iframe' 8 | ); 9 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/policy-principal-metabox.php: -------------------------------------------------------------------------------- 1 | post->ID), 6 | 'border: 0; margin-top:0;', 7 | 'aam-principal-iframe' 8 | ); 9 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/iframe-footer.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | do_items(array('jquery-core', 'jquery-migrate', 'code-editor', 'aam-iframe')); ?> 7 | 8 | 9 | do_item('aam-iframe'); ?> 10 | 11 | 12 | 2 | 3 | 4 | 5 | 12 | array($vendorDir . '/vectorface/whip/src'), 10 | 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 11 | 'DeviceDetector\\' => array($vendorDir . '/matomo/device-detector'), 12 | 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'), 13 | ); 14 | -------------------------------------------------------------------------------- /application/Backend/tmpl/partial/visitor-subject-tab.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | . 6 | 7 |
8 | spyc.yaml loaded into PHP:
'; 15 | print_r($array); 16 | echo ''; 17 | 18 | 19 | echo '
YAML Data dumped back:
'; 20 | echo Spyc::YAMLDump($array); 21 | echo '
'; 22 | -------------------------------------------------------------------------------- /application/Backend/tmpl/partial/default-subject-tab.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | . 6 | 7 |
8 | 2 | 3 | 4 |

5 | 9 |

10 | set_404(); 15 | } 16 | 17 | status_header(404); 18 | nocache_headers(); 19 | 20 | $not_found_tmpl = get_404_template(); 21 | 22 | if (!empty($not_found_tmpl) && file_exists($not_found_tmpl)) { 23 | include $not_found_tmpl; 24 | } 25 | } else { 26 | http_response_code(404); 27 | } -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) Vasyl Martyniuk 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Parser/Device/Mobile.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 |
7 |
8 |

9 | 10 |

11 |
12 |
13 |
14 |
15 | =5.3.1" 18 | }, 19 | "autoload": { 20 | "files": [ "Spyc.php" ] 21 | }, 22 | "require-dev": { 23 | "phpunit/phpunit": "4.3.*@dev" 24 | }, 25 | "extra": { 26 | "branch-alias": { 27 | "dev-master": "0.5.x-dev" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /application/Framework/Utility/Interface.php: -------------------------------------------------------------------------------- 1 | ', $code); 13 | $f = fopen ($dest, 'w'); 14 | fwrite($f, $code); 15 | fclose ($f); 16 | print "Written to $dest.\n"; 17 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/regexes/device/cameras.yml: -------------------------------------------------------------------------------- 1 | ############### 2 | # Device Detector - The Universal Device Detection library for parsing User Agents 3 | # 4 | # @link https://matomo.org 5 | # @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later 6 | ############### 7 | 8 | #Nikon 9 | Nikon: 10 | regex: 'Coolpix S800c' 11 | device: 'camera' 12 | model: 'Coolpix S800c' 13 | 14 | # Samsung 15 | Samsung: 16 | regex: 'EK-G[CN][0-9]{3}' 17 | device: 'camera' 18 | models: 19 | - regex: 'EK-GN120' 20 | model: 'Galaxy NX' 21 | - regex: 'EK-GC100' 22 | model: 'Galaxy Camera' 23 | - regex: 'EK-GC110' 24 | model: 'Galaxy Camera WiFi only' 25 | - regex: 'EK-GC200' 26 | model: 'Galaxy Camera 2' 27 | - regex: 'EK-GC([0-9]{3})' 28 | model: 'Galaxy Camera $1' 29 | -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/policy-metabox.php: -------------------------------------------------------------------------------- 1 | 4 |
5 | post->post_content)) { 7 | $json = htmlspecialchars_decode($params->post->post_content); 8 | } else { 9 | $json = AAM_Service_Policies::bootstrap()->get_boilerplate_policy(); 10 | } 11 | ?> 12 | 13 | 20 | 21 |
22 | 2 | 3 | 4 |
5 |
6 |

7 | ', '', '', ''); ?> 8 |

9 |
10 |
11 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
IDName
16 | 17 |
18 | hooks()->listen(); 33 | }, PHP_INT_MAX); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /vendor/autoload.php: -------------------------------------------------------------------------------- 1 | args['before_widget']; 5 | 6 | if (!is_user_logged_in()) { 7 | echo $this->args['before_title']; 8 | echo apply_filters('widget_title', esc_js($this->args['login-title']), $this->args, $this->id_base); 9 | echo $this->args['after_title']; 10 | } elseif (is_user_logged_in()) { 11 | echo $this->args['before_title']; 12 | echo str_replace('%username%', AAM::current_user()->display_name, esc_js($this->args['user-title'])); 13 | echo $this->args['after_title']; 14 | } 15 | 16 | echo AAM_Backend_View::loadPartial('login-form', array( 17 | 'id' => $this->get_field_id('loginform'), 18 | 'redirect' => $this->args['redirect'] 19 | )); 20 | 21 | echo $this->args['after_widget']; 22 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/iframe-header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Advanced Access Manager 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | do_item('common'); ?> 17 | do_item('dashicons'); ?> 18 | do_item('aam-vendor'); ?> 19 | do_item('aam'); ?> 20 | 21 | 22 | 23 | 24 | 25 | matchUserAgent('FBMD/')) { 32 | return null; 33 | } 34 | 35 | return parent::parse(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /application/Backend/tmpl/widget/login-backend.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | 7 |

8 | 9 |

10 | 11 | 12 |

13 | preMatchOverall()) { 38 | return null; 39 | } 40 | 41 | return parent::parse(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /application/Backend/tmpl/partial/post-list.php: -------------------------------------------------------------------------------- 1 | template, 17 | get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) 18 | ); 19 | $content = ob_get_contents(); 20 | ob_end_clean(); 21 | 22 | if (empty($content)) { 23 | $post = get_post(); 24 | 25 | the_title(sprintf('', esc_url(get_permalink())), ''); 26 | echo '
'; 27 | } else { 28 | echo $content; 29 | } 30 | } 31 | 32 | $GLOBALS['wp_query'] = $old_query; 33 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/settings/configpress.php: -------------------------------------------------------------------------------- 1 | 4 |
5 |
6 |
7 |

8 | ', ''); ?> 9 |

10 |
11 |
12 | 13 | 19 |
20 | preMatchOverall()) { 38 | return null; 39 | } 40 | 41 | return parent::parse(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Parser/Device/CarBrowser.php: -------------------------------------------------------------------------------- 1 | preMatchOverall()) { 38 | return null; 39 | } 40 | 41 | return parent::parse(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/mustangostang/spyc/README.md: -------------------------------------------------------------------------------- 1 | **Spyc** is a YAML loader/dumper written in pure PHP. Given a YAML document, Spyc will return an array that 2 | you can use however you see fit. Given an array, Spyc will return a string which contains a YAML document 3 | built from your data. 4 | 5 | **YAML** is an amazingly human friendly and strikingly versatile data serialization language which can be used 6 | for log files, config files, custom protocols, the works. For more information, see http://www.yaml.org. 7 | 8 | Spyc supports YAML 1.0 specification. 9 | 10 | ## Using Spyc 11 | 12 | Using Spyc is trivial: 13 | 14 | ```php 15 | = 50306)) { 8 | $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; 9 | } 10 | 11 | if ($issues) { 12 | if (!headers_sent()) { 13 | header('HTTP/1.1 500 Internal Server Error'); 14 | } 15 | if (!ini_get('display_errors')) { 16 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 17 | fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); 18 | } elseif (!headers_sent()) { 19 | echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; 20 | } 21 | } 22 | trigger_error( 23 | 'Composer detected issues in your platform: ' . implode(' ', $issues), 24 | E_USER_ERROR 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Parser/Device/PortableMediaPlayer.php: -------------------------------------------------------------------------------- 1 | preMatchOverall()) { 38 | return null; 39 | } 40 | 41 | return parent::parse(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /application/Framework/Service/Interface.php: -------------------------------------------------------------------------------- 1 | 'A sequence','second' => 'of mapped values'); 18 | $array['Mapped'] = array('A sequence','which is mapped'); 19 | $array['A Note'] = 'What if your text is too long?'; 20 | $array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block. Kinda like this.'; 21 | $array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.'; 22 | $array['Old Dog'] = "And if you want\n to preserve line breaks, \ngo ahead!"; 23 | $array['key:withcolon'] = "Should support this to"; 24 | 25 | $yaml = Spyc::YAMLDump($array,4,60); 26 | -------------------------------------------------------------------------------- /application/Framework/Resource/PostType.php: -------------------------------------------------------------------------------- 1 | name; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /application/Framework/Resource/Policy.php: -------------------------------------------------------------------------------- 1 | ID; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /vendor/composer/semver/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015 Composer 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /application/Framework/Resource/Taxonomy.php: -------------------------------------------------------------------------------- 1 | name; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Cache/CacheInterface.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 11 | 14 | 15 | 16 |
9 | ', ''); ?> 10 | 12 | 13 |
17 |
18 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 13 | 16 | 17 | 18 |
11 | ', ''); ?> 12 | 14 | 15 |
19 |
20 | clientHints) { 37 | return null; 38 | } 39 | 40 | $appId = $this->clientHints->getApp(); 41 | $name = $this->getRegexes()[$appId] ?? null; 42 | 43 | if ('' === (string) $name) { 44 | return null; 45 | } 46 | 47 | return [ 48 | 'name' => $name, 49 | ]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/post-iframe.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |
17 | 18 |
19 |
20 | postManager->render_content_access_form( 21 | $params->objectId, 22 | $params->objectType 23 | ); ?> 24 |
25 |
26 |
27 | 28 | 29 | self::ACCESS_CAPABILITY, 38 | 'type' => 'core', 39 | 'view' => __CLASS__ 40 | )); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Main/Welcome.php: -------------------------------------------------------------------------------- 1 | 'welcome', 38 | 'position' => 1, 39 | 'title' => __('Welcome', 'advanced-access-manager'), 40 | 'type' => 'main', 41 | 'view' => __CLASS__ 42 | )); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Parser/Client/Hints/BrowserHints.php: -------------------------------------------------------------------------------- 1 | clientHints) { 37 | return null; 38 | } 39 | 40 | $appId = $this->clientHints->getApp(); 41 | $name = $this->getRegexes()[$appId] ?? null; 42 | 43 | if ('' === (string) $name) { 44 | return null; 45 | } 46 | 47 | return [ 48 | 'name' => $name, 49 | ]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /application/Backend/tmpl/partial/jwt-login-url.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 9 |
10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | class. 13 | * 14 | * @param string $class 15 | * the name of the class to load 16 | * 17 | * @return void 18 | */ 19 | function dd_autoload(string $class): void 20 | { 21 | if (false === strpos($class, 'DeviceDetector\\')) { 22 | return; 23 | } 24 | 25 | $namespaceMap = ['DeviceDetector\\' => __DIR__ . '/']; 26 | 27 | foreach ($namespaceMap as $prefix => $dir) { 28 | /* First swap out the namespace prefix with a directory... */ 29 | $path = str_replace($prefix, $dir, $class); 30 | /* replace the namespace separator with a directory separator... */ 31 | $path = str_replace('\\', '/', $path); 32 | /* and finally, add the PHP file extension to the result. */ 33 | $path .= '.php'; 34 | /* $path should now contain the path to a PHP file defining $class */ 35 | require $path; 36 | } 37 | } 38 | 39 | spl_autoload_register('dd_autoload'); 40 | -------------------------------------------------------------------------------- /application/Framework/Type/Preference.php: -------------------------------------------------------------------------------- 1 | term_id, 40 | $identifier->taxonomy 41 | ]; 42 | 43 | if (property_exists($identifier, 'post_type')) { 44 | $result[] = $identifier->post_type; 45 | } 46 | 47 | return implode('|', $result); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/metabox/policy-parent-metabox.php: -------------------------------------------------------------------------------- 1 | 4 |
5 | $params->post->post_type, 8 | 'exclude_tree' => $params->post->ID, 9 | 'selected' => $params->post->post_parent, 10 | 'name' => 'parent_id', 11 | 'show_option_none' => __( '(no parent)' ), 12 | 'sort_column' => 'post_title', 13 | 'echo' => 0, 14 | ]); 15 | ?> 16 | 17 | 18 |

19 | 20 |

21 | 22 | 23 |

24 | 25 |

26 | 27 |
28 | api_routes(); 31 | $request = new \WP_REST_Request('GET', '/oembed/1.0'); 32 | 33 | // Confirm that we can get a positive response 34 | $this->assertTrue(apply_filters('rest_pre_dispatch', true, '__', $request)); 35 | 36 | // Restrict endpoint and assert that we are getting the WP_Error response 37 | $this->assertTrue($service->deny($request)); 38 | $this->assertEquals( 39 | \WP_Error::class, 40 | get_class(apply_filters('rest_pre_dispatch', true, '__', $request)) 41 | ); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /application/Framework/Resource/Generic.php: -------------------------------------------------------------------------------- 1 | _access_level = $access_level; 42 | $this->type = $resource_type; 43 | 44 | // Do not allow extending generic resource 45 | 46 | // Initialize permissions 47 | $this->_init_permissions(); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /application/Framework/Preference/LoginRedirect.php: -------------------------------------------------------------------------------- 1 | policies($this->get_access_level())->param( 37 | 'redirect:on:login' 38 | ); 39 | 40 | if (!empty($param) && is_array($param)) { 41 | $result = $manager->policy->convert_statement_redirect($param); 42 | } 43 | 44 | return apply_filters('aam_apply_policy_filter', $result, $this); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /application/Framework/Preference/LogoutRedirect.php: -------------------------------------------------------------------------------- 1 | policies($this->get_access_level())->param( 37 | 'redirect:on:logout' 38 | ); 39 | 40 | if (!empty($param) && is_array($param)) { 41 | $result = $manager->policy->convert_statement_redirect($param); 42 | } 43 | 44 | return apply_filters('aam_apply_policy_filter', $result, $this); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /application/Framework/Preference/NotFoundRedirect.php: -------------------------------------------------------------------------------- 1 | policies($this->get_access_level())->param( 37 | 'redirect:on:404' 38 | ); 39 | 40 | if (!empty($param) && is_array($param)) { 41 | $result = $manager->policy->convert_statement_redirect($param); 42 | } 43 | 44 | return apply_filters('aam_apply_policy_filter', $result, $this); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /application/Framework/Preference/Generic.php: -------------------------------------------------------------------------------- 1 | _access_level = $access_level; 42 | $this->type = $preference_type; 43 | 44 | // Do not allow extending generic preferences container 45 | 46 | // Initialize preferences 47 | $this->_init_preferences(); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /tests/Framework/Preference/NotFoundRedirectTest.php: -------------------------------------------------------------------------------- 1 | assertIsInt(AAM::api()->policies()->create('{ 32 | "Param": { 33 | "Key": "redirect:on:404", 34 | "Value": { 35 | "Type": "login_redirect" 36 | } 37 | } 38 | }')); 39 | 40 | // Verifying preferences 41 | $this->assertEquals([ 42 | 'type' => 'login_redirect' 43 | ], AAM::api()->not_found_redirect()->get_redirect()); 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /tests/Framework/Resource/ToolbarTest.php: -------------------------------------------------------------------------------- 1 | assertFalse(AAM::api()->admin_toolbar()->is_denied('documentation')); 32 | 33 | // Creating a new policy & attaching it to current access level 34 | $this->assertIsInt(AAM::api()->policies()->create('{ 35 | "Statement": { 36 | "Resource": "Toolbar:documentation", 37 | "Effect": "deny" 38 | } 39 | }')); 40 | 41 | // Verifying that toolbar item is restricted 42 | $this->assertTrue(AAM::api()->admin_toolbar()->is_denied('documentation')); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /vendor/vectorface/whip/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vectorface/whip", 3 | "description": "A PHP class for retrieving accurate IP address information for the client.", 4 | "keywords": [ 5 | "IP", "Cloudflare", "CDN" 6 | ], 7 | "type": "library", 8 | "license": "MIT", 9 | "authors": [ 10 | { 11 | "name": "Daniel Bruce", 12 | "email": "dbruce@vectorface.com", 13 | "role": "Developer" 14 | }, 15 | { 16 | "name": "Cory Darby", 17 | "email": "ckdarby@vectorface.com", 18 | "role": "Developer" 19 | } 20 | ], 21 | "autoload": { 22 | "psr-4": { 23 | "Vectorface\\Whip\\": "./src" 24 | } 25 | }, 26 | "autoload-dev": { 27 | "psr-4": { 28 | "Vectorface\\WhipTests\\": "./tests" 29 | } 30 | }, 31 | "homepage": "https://github.com/Vectorface/whip", 32 | "support": { 33 | "issues": "https://github.com/Vectorface/whip/issues", 34 | "source": "https://github.com/Vectorface/whip" 35 | }, 36 | "require": { 37 | "php": ">=8.0", 38 | "psr/http-message": "^1.0 || ^2.0" 39 | }, 40 | "require-dev": { 41 | "phpunit/phpunit": "^9.0", 42 | "squizlabs/php_codesniffer": "~2.0" 43 | }, 44 | "scripts": { 45 | "test": [ 46 | "@test-unit" 47 | ], 48 | "test-unit": "phpunit --color=always" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /application/Framework/Resource/Capability.php: -------------------------------------------------------------------------------- 1 | policies(); 33 | 34 | foreach($service->statements('Capability:*') as $stm) { 35 | $bits = explode(':', $stm['Resource']); 36 | $effect = isset($stm['Effect']) ? strtolower($stm['Effect']) : 'deny'; 37 | 38 | $result = array_replace([ 39 | $bits[1] => [ 40 | 'assume' => [ 41 | 'effect' => $effect 42 | ] 43 | ] 44 | ], $result); 45 | } 46 | 47 | return apply_filters('aam_apply_policy_filter', $result, $this); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/partial/backend-menu-mode.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 11 | 22 | 23 | 24 |
9 | ', ''); ?> 10 | 12 | 21 |
25 |
26 | getRegexes() as $brand => $regexes) { 43 | foreach ($regexes as $regex) { 44 | if ($this->matchUserAgent($regex . '[^a-z0-9]+')) { 45 | $this->matchedRegex = $regex; 46 | 47 | return ['brand' => $brand]; 48 | } 49 | } 50 | } 51 | 52 | return null; 53 | } 54 | 55 | /** 56 | * @return string|null 57 | */ 58 | public function getMatchedRegex(): ?string 59 | { 60 | return $this->matchedRegex; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /application/Framework/AccessLevel/Default.php: -------------------------------------------------------------------------------- 1 | assertIsInt(AAM::api()->policies()->create('{ 32 | "Param": { 33 | "Key": "redirect:on:logout", 34 | "Value": { 35 | "Type": "url_redirect", 36 | "Url": "/home-page" 37 | } 38 | } 39 | }')); 40 | 41 | // Verifying preferences 42 | $this->assertEquals([ 43 | 'type' => 'url_redirect', 44 | 'redirect_url' => '/home-page' 45 | ], AAM::api()->logout_redirect()->get_redirect()); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Main/Url.php: -------------------------------------------------------------------------------- 1 | 'url', 48 | 'position' => 55, 49 | 'title' => __('URL Access', 'advanced-access-manager'), 50 | 'capability' => self::ACCESS_CAPABILITY, 51 | 'type' => 'main', 52 | 'view' => __CLASS__ 53 | ]); 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /tests/Framework/Resource/RouteTest.php: -------------------------------------------------------------------------------- 1 | assertFalse(AAM::api()->api_routes()->is_denied('/oembed/1.0/proxy')); 32 | 33 | // Creating a new policy & attaching it to current access level 34 | $this->assertIsInt(AAM::api()->policies()->create('{ 35 | "Statement": [ 36 | { 37 | "Effect": "deny", 38 | "Resource": "Route:/oembed/1.0/proxy:get" 39 | } 40 | ] 41 | }')); 42 | 43 | // Verifying that API route is restricted 44 | $this->assertTrue(AAM::api()->api_routes()->is_denied('/oembed/1.0/proxy')); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Settings/ConfigPress.php: -------------------------------------------------------------------------------- 1 | 'configpress', 45 | 'position' => 90, 46 | 'title' => __('ConfigPress', 'advanced-access-manager'), 47 | 'capability' => self::ACCESS_CAPABILITY, 48 | 'type' => 'settings', 49 | 'view' => __CLASS__ 50 | )); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /application/Service/BaseTrait.php: -------------------------------------------------------------------------------- 1 | assertIsInt(AAM::api()->policies()->create('{ 32 | "Param": { 33 | "Key": "redirect:on:login", 34 | "Value": { 35 | "Type": "trigger_callback", 36 | "Callback": "do_login_workflow" 37 | } 38 | } 39 | }')); 40 | 41 | // Verifying preferences 42 | $this->assertEquals([ 43 | 'type' => 'trigger_callback', 44 | 'callback' => 'do_login_workflow' 45 | ], AAM::api()->login_redirect()->get_redirect()); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /tests/Mocks/metaboxes.mock: -------------------------------------------------------------------------------- 1 | a:1:{s:4:"page";a:2:{s:4:"side";a:2:{s:4:"core";a:2:{s:9:"submitdiv";a:4:{s:2:"id";s:9:"submitdiv";s:5:"title";s:7:"Publish";s:8:"callback";s:20:"post_submit_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}s:13:"pageparentdiv";a:4:{s:2:"id";s:13:"pageparentdiv";s:5:"title";s:15:"Page Attributes";s:8:"callback";s:24:"page_attributes_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}}s:3:"low";a:1:{s:12:"postimagediv";a:4:{s:2:"id";s:12:"postimagediv";s:5:"title";s:14:"Featured image";s:8:"callback";s:23:"post_thumbnail_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}}}s:6:"normal";a:1:{s:4:"core";a:5:{s:10:"postcustom";a:4:{s:2:"id";s:10:"postcustom";s:5:"title";s:13:"Custom Fields";s:8:"callback";s:20:"post_custom_meta_box";s:4:"args";a:2:{s:22:"__back_compat_meta_box";b:1;s:34:"__block_editor_compatible_meta_box";b:1;}}s:16:"commentstatusdiv";a:4:{s:2:"id";s:16:"commentstatusdiv";s:5:"title";s:10:"Discussion";s:8:"callback";s:28:"post_comment_status_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}s:11:"commentsdiv";a:4:{s:2:"id";s:11:"commentsdiv";s:5:"title";s:8:"Comments";s:8:"callback";s:21:"post_comment_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}s:7:"slugdiv";a:4:{s:2:"id";s:7:"slugdiv";s:5:"title";s:4:"Slug";s:8:"callback";s:18:"post_slug_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}s:9:"authordiv";a:4:{s:2:"id";s:9:"authordiv";s:5:"title";s:6:"Author";s:8:"callback";s:20:"post_author_meta_box";s:4:"args";a:1:{s:22:"__back_compat_meta_box";b:1;}}}}}} -------------------------------------------------------------------------------- /application/Framework/AccessLevel/Visitor.php: -------------------------------------------------------------------------------- 1 | access_levels->get( 35 | AAM_Framework_Type_AccessLevel::ALL 36 | ), 37 | $this 38 | ); 39 | } 40 | 41 | /** 42 | * Check if access level has specific capability 43 | * 44 | * @return bool 45 | * @access public 46 | * 47 | * @version 7.0.0 48 | */ 49 | public function has_cap() 50 | { 51 | return false; 52 | } 53 | 54 | /** 55 | * @inheritDoc 56 | */ 57 | public function get_display_name() 58 | { 59 | return __('Visitors', 'advanced-access-manager'); 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Main/NotFoundRedirect.php: -------------------------------------------------------------------------------- 1 | '404redirect', 45 | 'position' => 50, 46 | 'title' => __('404 Redirect', 'advanced-access-manager'), 47 | 'capability' => self::ACCESS_CAPABILITY, 48 | 'type' => 'main', 49 | 'view' => __CLASS__ 50 | ]); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /tests/Framework/Resource/BackendMenuTest.php: -------------------------------------------------------------------------------- 1 | assertFalse( 32 | AAM::api()->backend_menu()->is_denied('edit-tags.php?taxonomy=category') 33 | ); 34 | 35 | // Creating a new policy & attaching it to current access level 36 | $this->assertIsInt(AAM::api()->policies()->create('{ 37 | "Statement": { 38 | "Resource": "BackendMenu:edit-tags.php?taxonomy=category", 39 | "Effect": "deny" 40 | } 41 | }')); 42 | 43 | // Verifying that backend menu is restricted 44 | $this->assertTrue( 45 | AAM::api()->backend_menu()->is_denied('edit-tags.php?taxonomy=category') 46 | ); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Main/Jwt.php: -------------------------------------------------------------------------------- 1 | 'jwt', 45 | 'position' => 65, 46 | 'title' => __('JWT Tokens', 'advanced-access-manager'), 47 | 'capability' => self::ACCESS_CAPABILITY, 48 | 'type' => 'main', 49 | 'view' => __CLASS__, 50 | 'access_levels' => array( 51 | AAM_Framework_Type_AccessLevel::USER 52 | ) 53 | )); 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Cache/DoctrineBridge.php: -------------------------------------------------------------------------------- 1 | cache = $cache; 30 | } 31 | 32 | /** 33 | * @inheritDoc 34 | */ 35 | public function fetch(string $id) 36 | { 37 | return $this->cache->fetch($id); 38 | } 39 | 40 | /** 41 | * @inheritDoc 42 | */ 43 | public function contains(string $id): bool 44 | { 45 | return $this->cache->contains($id); 46 | } 47 | 48 | /** 49 | * @inheritDoc 50 | */ 51 | public function save(string $id, $data, int $lifeTime = 0): bool 52 | { 53 | return $this->cache->save($id, $data, $lifeTime); 54 | } 55 | 56 | /** 57 | * @inheritDoc 58 | */ 59 | public function delete(string $id): bool 60 | { 61 | return $this->cache->delete($id); 62 | } 63 | 64 | /** 65 | * @inheritDoc 66 | */ 67 | public function flushAll(): bool 68 | { 69 | return $this->cache->flushAll(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /application/Service/Shortcodes.php: -------------------------------------------------------------------------------- 1 | process(); 36 | }); 37 | 38 | add_shortcode('aam-login', function($args, $content) { 39 | $shortcode = new AAM_Service_Shortcode_Handler_LoginForm( 40 | $args, $content 41 | ); 42 | 43 | return $shortcode->run(); 44 | }); 45 | 46 | add_shortcode('aam-post-list', function($args, $content) { 47 | $shortcode = new AAM_Service_Shortcode_Handler_PostList( 48 | $args, $content 49 | ); 50 | 51 | return $shortcode->run(); 52 | }); 53 | } 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /application/Framework/Preference/AccessDeniedRedirect.php: -------------------------------------------------------------------------------- 1 | policies($this->get_access_level())->params( 37 | 'redirect:on:access-denied:*' 38 | ); 39 | 40 | foreach($params as $key => $value) { 41 | $bits = explode(':', $key); 42 | $area = $bits[3]; // Should be either frontend, backend or API 43 | 44 | if (is_array($value)) { 45 | $result[$area] = $manager->policy->convert_statement_redirect($value); 46 | } 47 | } 48 | 49 | return apply_filters('aam_apply_policy_filter', $result, $this); 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Main/AccessDeniedRedirect.php: -------------------------------------------------------------------------------- 1 | 'redirect', 46 | 'position' => 30, 47 | 'title' => __('Access Denied Redirect', 'advanced-access-manager'), 48 | 'capability' => self::ACCESS_CAPABILITY, 49 | 'type' => 'main', 50 | 'view' => __CLASS__ 51 | )); 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/settings/security.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | getList() as $id => $option) { ?> 8 | 9 | 15 | 27 | 28 | 29 | 30 |
10 | 11 |

12 | 13 |

14 |
16 | 21 | type="checkbox" 22 | data-on="" 23 | data-off="" 24 | data-size="small" 25 | /> 26 |
31 |
32 | assertIsInt(AAM::api()->policies()->create('{ 32 | "Param": { 33 | "Key": "redirect:on:access-denied:frontend", 34 | "Value": { 35 | "Type": "page_redirect", 36 | "Id": 2 37 | } 38 | } 39 | }')); 40 | 41 | // Verifying preferences 42 | $this->assertEquals([ 43 | 'type' => 'page_redirect', 44 | 'redirect_page_id' => 2 45 | ], AAM::api()->access_denied_redirect()->get_redirect('frontend')); 46 | $this->assertEquals([ 47 | 'type' => 'default' 48 | ], AAM::api()->access_denied_redirect()->get_redirect('backend')); 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Cache/PSR16Bridge.php: -------------------------------------------------------------------------------- 1 | cache = $cache; 31 | } 32 | 33 | /** 34 | * @inheritDoc 35 | */ 36 | public function fetch(string $id) 37 | { 38 | return $this->cache->get($id, false); 39 | } 40 | 41 | /** 42 | * @inheritDoc 43 | */ 44 | public function contains(string $id): bool 45 | { 46 | return $this->cache->has($id); 47 | } 48 | 49 | /** 50 | * @inheritDoc 51 | */ 52 | public function save(string $id, $data, int $lifeTime = 0): bool 53 | { 54 | return $this->cache->set($id, $data, \func_num_args() < 3 ? null : $lifeTime); 55 | } 56 | 57 | /** 58 | * @inheritDoc 59 | */ 60 | public function delete(string $id): bool 61 | { 62 | return $this->cache->delete($id); 63 | } 64 | 65 | /** 66 | * @inheritDoc 67 | */ 68 | public function flushAll(): bool 69 | { 70 | return $this->cache->clear(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /application/Backend/tmpl/settings/content.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | getList(); ?> 8 | 9 | 10 | $option) { ?> 11 | 12 | 18 | 21 | 22 | 23 | 24 |

25 | 26 | 27 |
13 | 14 |

15 | 16 |

17 |
19 | type="checkbox" data-on="" data-off="" data-size="small" /> 20 |
28 |
29 | 'capability', 45 | 'position' => 15, 46 | 'title' => __('Capabilities', 'advanced-access-manager'), 47 | 'capability' => self::ACCESS_CAPABILITY, 48 | 'type' => 'main', 49 | 'view' => __CLASS__, 50 | 'access_levels' => array( 51 | AAM_Framework_Type_AccessLevel::ROLE, 52 | AAM_Framework_Type_AccessLevel::USER 53 | ) 54 | )); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Cache/StaticCache.php: -------------------------------------------------------------------------------- 1 | contains($id) ? self::$staticCache[$id] : false; 35 | } 36 | 37 | /** 38 | * @inheritdoc 39 | */ 40 | public function contains(string $id): bool 41 | { 42 | return isset(self::$staticCache[$id]) || \array_key_exists($id, self::$staticCache); 43 | } 44 | 45 | /** 46 | * @inheritdoc 47 | */ 48 | public function save(string $id, $data, int $lifeTime = 0): bool 49 | { 50 | self::$staticCache[$id] = $data; 51 | 52 | return true; 53 | } 54 | 55 | /** 56 | * @inheritdoc 57 | */ 58 | public function delete(string $id): bool 59 | { 60 | unset(self::$staticCache[$id]); 61 | 62 | return true; 63 | } 64 | 65 | /** 66 | * @inheritdoc 67 | */ 68 | public function flushAll(): bool 69 | { 70 | self::$staticCache = []; 71 | 72 | return true; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /application/Framework/Resource/AdminToolbar.php: -------------------------------------------------------------------------------- 1 | policies()->statements('Toolbar:*'); 35 | 36 | foreach($list as $stm) { 37 | $effect = isset($stm['Effect']) ? strtolower($stm['Effect']) : 'deny'; 38 | 39 | // Extracting toolbar ID 40 | $parsed = explode(':', $stm['Resource']); 41 | 42 | if (!empty($parsed[1])) { 43 | $result = array_merge([ 44 | $parsed[1] => [ 45 | 'list' => [ 46 | 'effect' => $effect !== 'allow' ? 'deny' : 'allow' 47 | ] 48 | ] 49 | ], $result); 50 | } 51 | } 52 | 53 | return apply_filters('aam_apply_policy_filter', $result, $this); 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /tests/Framework/Resource/WidgetTest.php: -------------------------------------------------------------------------------- 1 | assertFalse(AAM::api()->widgets()->is_denied('wp_dashboard_site_health')); 32 | $this->assertFalse(AAM::api()->widgets()->is_denied('wp_widget_search')); 33 | 34 | // Creating a new policy & attaching it to current access level 35 | $this->assertIsInt(AAM::api()->policies()->create('{ 36 | "Statement": { 37 | "Resource": [ 38 | "Widget:wp_dashboard_site_health", 39 | "Widget:wp_widget_search" 40 | ], 41 | "Effect": "deny" 42 | } 43 | }')); 44 | 45 | // Verifying that widgets are restricted 46 | $this->assertTrue(AAM::api()->widgets()->is_denied('wp_dashboard_site_health')); 47 | $this->assertTrue(AAM::api()->widgets()->is_denied('wp_widget_search')); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /application/Framework/Resource/BackendMenu.php: -------------------------------------------------------------------------------- 1 | policies()->statements('BackendMenu:*'); 35 | 36 | foreach($list as $stm) { 37 | $effect = isset($stm['Effect']) ? strtolower($stm['Effect']) : 'deny'; 38 | 39 | // Extracting backend menu item ID 40 | $parsed = explode(':', $stm['Resource']); 41 | 42 | if (!empty($parsed[1])) { 43 | $result = array_replace([ 44 | $parsed[1] => [ 45 | 'access' => [ 46 | 'effect' => $effect !== 'allow' ? 'deny' : 'allow' 47 | ] 48 | ] 49 | ], $result); 50 | } 51 | } 52 | 53 | return apply_filters('aam_apply_policy_filter', $result, $this); 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Parser/Device/ShellTv.php: -------------------------------------------------------------------------------- 1 | matchUserAgent($regex); 41 | 42 | return null !== $match; 43 | } 44 | 45 | /** 46 | * Parses the current UA and checks whether it contains ShellTv information 47 | * 48 | * @see shell_tv.yml for list of detected televisions 49 | * 50 | * @return array|null 51 | */ 52 | public function parse(): ?array 53 | { 54 | // only parse user agents containing fragments: {brand} shell 55 | if (false === $this->isShellTv()) { 56 | return null; 57 | } 58 | 59 | parent::parse(); 60 | 61 | // always set device type to tv, even if no model/brand could be found 62 | $this->deviceType = self::DEVICE_TYPE_TV; 63 | 64 | return $this->getResult(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /vendor/composer/semver/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "composer/semver", 3 | "description": "Semver library that offers utilities, version constraint parsing and validation.", 4 | "type": "library", 5 | "license": "MIT", 6 | "keywords": [ 7 | "semver", 8 | "semantic", 9 | "versioning", 10 | "validation" 11 | ], 12 | "authors": [ 13 | { 14 | "name": "Nils Adermann", 15 | "email": "naderman@naderman.de", 16 | "homepage": "http://www.naderman.de" 17 | }, 18 | { 19 | "name": "Jordi Boggiano", 20 | "email": "j.boggiano@seld.be", 21 | "homepage": "http://seld.be" 22 | }, 23 | { 24 | "name": "Rob Bast", 25 | "email": "rob.bast@gmail.com", 26 | "homepage": "http://robbast.nl" 27 | } 28 | ], 29 | "support": { 30 | "irc": "ircs://irc.libera.chat:6697/composer", 31 | "issues": "https://github.com/composer/semver/issues" 32 | }, 33 | "require": { 34 | "php": "^5.3.2 || ^7.0 || ^8.0" 35 | }, 36 | "require-dev": { 37 | "symfony/phpunit-bridge": "^3 || ^7", 38 | "phpstan/phpstan": "^1.11" 39 | }, 40 | "autoload": { 41 | "psr-4": { 42 | "Composer\\Semver\\": "src" 43 | } 44 | }, 45 | "autoload-dev": { 46 | "psr-4": { 47 | "Composer\\Semver\\": "tests" 48 | } 49 | }, 50 | "extra": { 51 | "branch-alias": { 52 | "dev-main": "3.x-dev" 53 | } 54 | }, 55 | "scripts": { 56 | "test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit", 57 | "phpstan": "@php vendor/bin/phpstan analyse" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /vendor/vectorface/whip/src/IpRange/IpRange.php: -------------------------------------------------------------------------------- 1 | 33 | */ 34 | interface IpRange 35 | { 36 | /** 37 | * Returns whether a given IP address falls within this range. 38 | * 39 | * @param string $ipAddress The given IP address. 40 | * @return bool Returns true if the IP address falls within the range 41 | * and false otherwise. 42 | */ 43 | public function containsIp($ipAddress); 44 | } 45 | -------------------------------------------------------------------------------- /application/Framework/Type/AccessLevel.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | type); ?> 5 | 6 | 1) { ?> 7 |
8 |
9 |
    10 | $feature) { 12 | echo '
  • '; 13 | echo esc_js($feature->title); 14 | echo (empty($feature->notification) ? '' : ' ' . esc_js($feature->notification) . ''); 15 | echo '
  • '; 16 | } 17 | ?> 18 |
19 |
20 |
21 | view); 24 | } 25 | ?> 26 |
27 |
28 | view); 30 | } ?> 31 | 32 |
33 |

34 | 35 |

36 |
37 | 38 | 'login_redirect', 45 | 'position' => 40, 46 | 'title' => __('Login Redirect', 'advanced-access-manager'), 47 | 'capability' => self::ACCESS_CAPABILITY, 48 | 'type' => 'main', 49 | 'view' => __CLASS__, 50 | 'access_levels' => [ 51 | AAM_Framework_Type_AccessLevel::ROLE, 52 | AAM_Framework_Type_AccessLevel::USER, 53 | AAM_Framework_Type_AccessLevel::ALL 54 | ] 55 | ]); 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Settings/Content.php: -------------------------------------------------------------------------------- 1 | 'settings-content', 58 | 'position' => 5, 59 | 'title' => __('Content Settings', 'advanced-access-manager'), 60 | 'capability' => self::ACCESS_CAPABILITY, 61 | 'type' => 'settings', 62 | 'view' => __CLASS__ 63 | )); 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Parser/Device/HbbTv.php: -------------------------------------------------------------------------------- 1 | isHbbTv()) { 43 | return null; 44 | } 45 | 46 | parent::parse(); 47 | 48 | // always set device type to tv, even if no model/brand could be found 49 | if (null === $this->deviceType) { 50 | $this->deviceType = self::DEVICE_TYPE_TV; 51 | } 52 | 53 | return $this->getResult(); 54 | } 55 | 56 | /** 57 | * Returns if the parsed UA was identified as a HbbTV device 58 | * 59 | * @return string|null 60 | */ 61 | public function isHbbTv(): ?string 62 | { 63 | $regex = '(?:HbbTV|SmartTvA)/([1-9]{1}(?:\.[0-9]{1}){1,2})'; 64 | $match = $this->matchUserAgent($regex); 65 | 66 | return $match[1] ?? null; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/vectorface/whip/src/Request/RequestAdapter.php: -------------------------------------------------------------------------------- 1 | 'logout_redirect', 45 | 'position' => 41, 46 | 'title' => __('Logout Redirect', 'advanced-access-manager'), 47 | 'capability' => self::ACCESS_CAPABILITY, 48 | 'type' => 'main', 49 | 'view' => __CLASS__, 50 | 'access_levels' => array( 51 | AAM_Framework_Type_AccessLevel::ROLE, 52 | AAM_Framework_Type_AccessLevel::USER, 53 | AAM_Framework_Type_AccessLevel::ALL 54 | ) 55 | )); 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | ./tests/Framework/Policy 13 | 14 | 15 | ./tests/Framework/Resource 16 | 17 | 18 | ./tests/Framework/Preference 19 | 20 | 21 | ./tests/Framework/Service 22 | 23 | 24 | ./tests/Framework/Utility 25 | 26 | 27 | ./tests/Framework/Manager 28 | 29 | 30 | ./tests/Service 31 | 32 | 33 | ./tests/Rest 34 | 35 | 36 | ./tests/Core 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /vendor/composer/semver/src/Constraint/MatchNoneConstraint.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Composer\Semver\Constraint; 13 | 14 | /** 15 | * Blackhole of constraints, nothing escapes it 16 | */ 17 | class MatchNoneConstraint implements ConstraintInterface 18 | { 19 | /** @var string|null */ 20 | protected $prettyString; 21 | 22 | /** 23 | * @param ConstraintInterface $provider 24 | * 25 | * @return bool 26 | */ 27 | public function matches(ConstraintInterface $provider) 28 | { 29 | return false; 30 | } 31 | 32 | /** 33 | * {@inheritDoc} 34 | */ 35 | public function compile($otherOperator) 36 | { 37 | return 'false'; 38 | } 39 | 40 | /** 41 | * {@inheritDoc} 42 | */ 43 | public function setPrettyString($prettyString) 44 | { 45 | $this->prettyString = $prettyString; 46 | } 47 | 48 | /** 49 | * {@inheritDoc} 50 | */ 51 | public function getPrettyString() 52 | { 53 | if ($this->prettyString) { 54 | return $this->prettyString; 55 | } 56 | 57 | return (string) $this; 58 | } 59 | 60 | /** 61 | * {@inheritDoc} 62 | */ 63 | public function __toString() 64 | { 65 | return '[]'; 66 | } 67 | 68 | /** 69 | * {@inheritDoc} 70 | */ 71 | public function getUpperBound() 72 | { 73 | return new Bound('0.0.0.0-dev', false); 74 | } 75 | 76 | /** 77 | * {@inheritDoc} 78 | */ 79 | public function getLowerBound() 80 | { 81 | return new Bound('0.0.0.0-dev', false); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /application/Backend/Feature/Main/Widget.php: -------------------------------------------------------------------------------- 1 | 'widget', 60 | 'position' => 10, 61 | 'title' => __('Widgets', 'advanced-access-manager'), 62 | 'capability' => self::ACCESS_CAPABILITY, 63 | 'type' => 'main', 64 | 'view' => __CLASS__ 65 | )); 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /tests/Framework/Policy/XpathTest.php: -------------------------------------------------------------------------------- 1 | assertEquals( 37 | $expected, 38 | AAM_Framework_Policy_Xpath::get_value_by_xpath($source, $xpath) 39 | ); 40 | } 41 | 42 | /** 43 | * Data provider 44 | * 45 | * @return array 46 | */ 47 | public static function dataProvider() 48 | { 49 | $obj = new class { 50 | public $prop = 'nice'; 51 | 52 | public function get_it() 53 | { 54 | return [ 'test' => 'y' ]; 55 | } 56 | }; 57 | 58 | return [ 59 | [ 'prop', (object)[ 'prop' => 'test' ], 'test' ], 60 | [ '1', [ 'a', 'b' ], 'b' ], 61 | [ 'a[1].prop', [ 'a' => [ '1', [ 'prop' => 'yes' ] ] ], 'yes' ], 62 | [ 'prop', $obj, 'nice' ], 63 | [ 'get_it.test', $obj, 'y' ] 64 | ]; 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | register(true); 35 | 36 | $filesToLoad = \Composer\Autoload\ComposerStaticInit9666f71e5b586ecf908dd5d7d2d79db6::$files; 37 | $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 39 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 40 | 41 | require $file; 42 | } 43 | }, null, null); 44 | foreach ($filesToLoad as $fileIdentifier => $file) { 45 | $requireFile($fileIdentifier, $file); 46 | } 47 | 48 | return $loader; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/composer/semver/src/Constraint/MatchAllConstraint.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Composer\Semver\Constraint; 13 | 14 | /** 15 | * Defines the absence of a constraint. 16 | * 17 | * This constraint matches everything. 18 | */ 19 | class MatchAllConstraint implements ConstraintInterface 20 | { 21 | /** @var string|null */ 22 | protected $prettyString; 23 | 24 | /** 25 | * @param ConstraintInterface $provider 26 | * 27 | * @return bool 28 | */ 29 | public function matches(ConstraintInterface $provider) 30 | { 31 | return true; 32 | } 33 | 34 | /** 35 | * {@inheritDoc} 36 | */ 37 | public function compile($otherOperator) 38 | { 39 | return 'true'; 40 | } 41 | 42 | /** 43 | * {@inheritDoc} 44 | */ 45 | public function setPrettyString($prettyString) 46 | { 47 | $this->prettyString = $prettyString; 48 | } 49 | 50 | /** 51 | * {@inheritDoc} 52 | */ 53 | public function getPrettyString() 54 | { 55 | if ($this->prettyString) { 56 | return $this->prettyString; 57 | } 58 | 59 | return (string) $this; 60 | } 61 | 62 | /** 63 | * {@inheritDoc} 64 | */ 65 | public function __toString() 66 | { 67 | return '*'; 68 | } 69 | 70 | /** 71 | * {@inheritDoc} 72 | */ 73 | public function getUpperBound() 74 | { 75 | return Bound::positiveInfinity(); 76 | } 77 | 78 | /** 79 | * {@inheritDoc} 80 | */ 81 | public function getLowerBound() 82 | { 83 | return Bound::zero(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /vendor/matomo/device-detector/Cache/PSR6Bridge.php: -------------------------------------------------------------------------------- 1 | pool = $pool; 31 | } 32 | 33 | /** 34 | * @inheritDoc 35 | */ 36 | public function fetch(string $id) 37 | { 38 | $item = $this->pool->getItem($id); 39 | 40 | return $item->isHit() ? $item->get() : false; 41 | } 42 | 43 | /** 44 | * @inheritDoc 45 | */ 46 | public function contains(string $id): bool 47 | { 48 | return $this->pool->hasItem($id); 49 | } 50 | 51 | /** 52 | * @inheritDoc 53 | */ 54 | public function save(string $id, $data, int $lifeTime = 0): bool 55 | { 56 | $item = $this->pool->getItem($id); 57 | $item->set($data); 58 | 59 | if (\func_num_args() > 2) { 60 | $item->expiresAfter($lifeTime); 61 | } 62 | 63 | return $this->pool->save($item); 64 | } 65 | 66 | /** 67 | * @inheritDoc 68 | */ 69 | public function delete(string $id): bool 70 | { 71 | return $this->pool->deleteItem($id); 72 | } 73 | 74 | /** 75 | * @inheritDoc 76 | */ 77 | public function flushAll(): bool 78 | { 79 | return $this->pool->clear(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /application/Framework/Resource/ApiRoute.php: -------------------------------------------------------------------------------- 1 | policies()->statements('Route:*'); 35 | 36 | foreach($list as $stm) { 37 | $effect = isset($stm['Effect']) ? strtolower($stm['Effect']) : 'deny'; 38 | 39 | // Extracting route attributes 40 | $parsed = explode(':', $stm['Resource']); 41 | $route = !empty($parsed[1]) ? $parsed[1] : null; 42 | $verb = !empty($parsed[2]) ? $parsed[2] : null; 43 | 44 | if (!empty($route) && !empty($verb)) { 45 | $key = strtolower($verb . ' ' . $route); 46 | $result = array_merge([ 47 | $key => [ 48 | 'access' => [ 49 | 'effect' => $effect !== 'allow' ? 'deny' : 'allow' 50 | ] 51 | ] 52 | ], $result); 53 | } 54 | } 55 | 56 | return apply_filters('aam_apply_policy_filter', $result, $this); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /application/Service/NotFoundRedirect.php: -------------------------------------------------------------------------------- 1 | initialize_hooks(); 35 | }, PHP_INT_MAX); 36 | } 37 | 38 | /** 39 | * Initialize the service hooks 40 | * 41 | * @return void 42 | * @access protected 43 | * 44 | * @version 7.0.4 45 | */ 46 | protected function initialize_hooks() 47 | { 48 | if (is_admin()) { 49 | // Hook that initialize the AAM UI part of the service 50 | add_action('aam_initialize_ui_action', function () { 51 | AAM_Backend_Feature_Main_NotFoundRedirect::register(); 52 | }); 53 | } 54 | 55 | add_action('wp', function() { 56 | global $wp_query; 57 | 58 | if ($wp_query->is_404) { // Handle 404 redirect 59 | $redirect = AAM::api()->not_found_redirect()->get_redirect(); 60 | 61 | if ($redirect['type'] !== 'default') { 62 | AAM::api()->redirect->do_redirect($redirect); 63 | } 64 | } 65 | }); 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /tests/Framework/Service/ApiRoutesTest.php: -------------------------------------------------------------------------------- 1 | api_routes(); 31 | $request = new \WP_REST_Request('GET', '/oembed/1.0'); 32 | 33 | // Set restrictions 34 | $this->assertTrue($service->deny($request)); 35 | $this->assertTrue($service->deny('GET /oembed/1.0/embed')); 36 | 37 | // Assert that both endpoints are restricted 38 | $this->assertTrue($service->is_denied('/oembed/1.0')); 39 | $this->assertFalse($service->is_allowed('/oembed/1.0')); 40 | $this->assertTrue($service->is_denied($request)); 41 | $this->assertFalse($service->is_allowed($request)); 42 | $this->assertTrue($service->is_denied('/oembed/1.0/embed')); 43 | $this->assertFalse($service->is_allowed('/oembed/1.0/embed')); 44 | 45 | // Making sure that HTTP method is taken into consideration 46 | $this->assertTrue($service->deny('/aam/v2/jwts')); 47 | $this->assertTrue($service->is_denied('/aam/v2/jwts')); 48 | $this->assertFalse($service->is_denied('POST /aam/v2/jwts')); 49 | $this->assertFalse($service->is_denied('DELETE /aam/v2/jwts')); 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Main/ApiRoute.php: -------------------------------------------------------------------------------- 1 | loadPartial('api-route-mode'); 46 | }); 47 | } 48 | 49 | /** 50 | * Register API Routes service 51 | * 52 | * @return void 53 | * @access public 54 | * 55 | * @version 7.0.0 56 | */ 57 | public static function register() 58 | { 59 | AAM_Backend_Feature::registerFeature((object)array( 60 | 'uid' => 'route', 61 | 'position' => 50, 62 | 'title' => __('API Routes', 'advanced-access-manager'), 63 | 'capability' => self::ACCESS_CAPABILITY, 64 | 'type' => 'main', 65 | 'view' => __CLASS__ 66 | )); 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /application/Framework/Resource/Widget.php: -------------------------------------------------------------------------------- 1 | policies()->statements('Widget:*') as $stm) { 35 | $effect = isset($stm['Effect']) ? strtolower($stm['Effect']) : 'deny'; 36 | 37 | // Extracting widget slug 38 | $parsed = explode(':', $stm['Resource']); 39 | 40 | if (!empty($parsed[1])) { 41 | // Determining correct internal resource id 42 | if (array_key_exists('Area', $stm)) { 43 | $id = $parsed[1] . '|' . strtolower($stm['Area']); 44 | } else { 45 | $id = $parsed[1]; 46 | } 47 | 48 | $result = array_replace([ 49 | $id => [ 50 | 'list' => [ 51 | 'effect' => $effect !== 'allow' ? 'deny' : 'allow' 52 | ] 53 | ] 54 | ], $result); 55 | } 56 | } 57 | 58 | return apply_filters('aam_apply_policy_filter', $result, $this); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /tests/Framework/Service/AccessDeniedRedirectTest.php: -------------------------------------------------------------------------------- 1 | 'login_redirect' ]; 31 | $redirect_b = [ 32 | 'type' => 'url_redirect', 33 | 'redirect_url' => site_url() . '/some-page' 34 | ]; 35 | 36 | // Setting redirect 37 | $this->assertTrue(AAM::api()->access_denied_redirect()->set_redirect( 38 | 'frontend', $redirect_a 39 | )); 40 | 41 | // Verifying that we are getting the same redirect back 42 | $this->assertEquals( 43 | $redirect_a, 44 | AAM::api()->access_denied_redirect()->get_redirect('frontend') 45 | ); 46 | 47 | // Setting another redirect 48 | $this->assertTrue(AAM::api()->access_denied_redirect()->set_redirect( 49 | 'backend', $redirect_b 50 | )); 51 | 52 | // Verifying that we are getting the same redirect back 53 | $this->assertEquals( 54 | [ 'type' => 'url_redirect', 'redirect_url' => '/some-page' ], 55 | AAM::api()->access_denied_redirect()->get_redirect('backend') 56 | ); 57 | } 58 | 59 | 60 | } -------------------------------------------------------------------------------- /application/Framework/AccessLevel/Role.php: -------------------------------------------------------------------------------- 1 | access_levels->get( 36 | AAM_Framework_Type_AccessLevel::ALL 37 | ), 38 | $this 39 | ); 40 | } 41 | 42 | /** 43 | * @inheritDoc 44 | */ 45 | public function get_id() 46 | { 47 | return $this->_proxy_instance->slug; 48 | } 49 | 50 | /** 51 | * @inheritDoc 52 | */ 53 | public function get_display_name() 54 | { 55 | return $this->_proxy_instance->display_name; 56 | } 57 | 58 | /** 59 | * Initialize the access level 60 | * 61 | * @param WP_Role $core_instance 62 | * 63 | * @return void 64 | * 65 | * @access protected 66 | * @version 7.0.0 67 | */ 68 | protected function initialize($core_instance) 69 | { 70 | $this->_proxy_instance = new AAM_Framework_Proxy_Role( 71 | wp_roles()->role_names[$core_instance->name], 72 | $core_instance 73 | ); 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /tests/Service/JwtsTest.php: -------------------------------------------------------------------------------- 1 | createUser([ 'role' => 'subscriber' ]); 31 | $token = AAM::api()->jwts('user:' . $user_a)->issue(); 32 | 33 | // Adding token to the super global 34 | $_POST['aam-jwt'] = $token['token']; 35 | 36 | $this->assertEquals($user_a, apply_filters('determine_current_user', null)); 37 | 38 | unset($_POST['aam-jwt']); 39 | } 40 | 41 | /** 42 | * Test that we skip user if they are inactive 43 | * 44 | * @return void 45 | */ 46 | public function testDetermineInactiveUserThroughToken() 47 | { 48 | $user_a = $this->createUser([ 'role' => 'subscriber' ]); 49 | $token = AAM::api()->jwts('user:' . $user_a)->issue(); 50 | 51 | // Get user and lock them 52 | $this->assertEquals( 53 | 'inactive', 54 | AAM::api()->users->get_user($user_a)->update([ 'status' => 'inactive' ])->status 55 | ); 56 | 57 | // Adding token to the super global 58 | $_POST['aam-jwt'] = $token['token']; 59 | 60 | $this->assertFalse(apply_filters('determine_current_user', false)); 61 | 62 | unset($_POST['aam-jwt']); 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /tests/Framework/Service/LoginRedirectTest.php: -------------------------------------------------------------------------------- 1 | 'default' ]; 31 | $redirect_b = [ 32 | 'type' => 'url_redirect', 33 | 'redirect_url' => site_url() . '/some-page' 34 | ]; 35 | 36 | // Setting redirect 37 | $this->assertEquals( 38 | $redirect_a, 39 | AAM::api()->login_redirect()->set_redirect($redirect_a) 40 | ); 41 | 42 | // Verifying that we are getting the same redirect back 43 | $this->assertEquals( 44 | $redirect_a, 45 | AAM::api()->login_redirect()->get_redirect() 46 | ); 47 | 48 | // Setting another redirect 49 | $this->assertEquals([ 50 | 'type' => 'url_redirect', 51 | 'redirect_url' => '/some-page', 52 | ], AAM::api()->login_redirect()->set_redirect($redirect_b)); 53 | 54 | // Verifying that we are getting the same redirect back 55 | $this->assertEquals([ 56 | 'type' => 'url_redirect', 57 | 'redirect_url' => '/some-page', 58 | ], AAM::api()->login_redirect()->get_redirect()); 59 | } 60 | 61 | 62 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/settings/multisite.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | getList() as $id => $option) { ?> 8 | 9 | 15 | 29 | 30 | 31 | 32 |
10 | 11 |

12 | 13 |

14 |
16 | 21 | type="checkbox" 22 | data-on="" 23 | data-off="" 24 | data-size="small" 25 | 26 | 27 | /> 28 |
33 |
34 | 'default' ]; 31 | $redirect_b = [ 32 | 'type' => 'url_redirect', 33 | 'redirect_url' => site_url() . '/some-page' 34 | ]; 35 | 36 | // Setting redirect 37 | $this->assertEquals( 38 | $redirect_a, 39 | AAM::api()->logout_redirect()->set_redirect($redirect_a) 40 | ); 41 | 42 | // Verifying that we are getting the same redirect back 43 | $this->assertEquals( 44 | $redirect_a, 45 | AAM::api()->logout_redirect()->get_redirect() 46 | ); 47 | 48 | // Setting another redirect 49 | $this->assertEquals([ 50 | 'type' => 'url_redirect', 51 | 'redirect_url' => '/some-page', 52 | ], AAM::api()->logout_redirect()->set_redirect($redirect_b)); 53 | 54 | // Verifying that we are getting the same redirect back 55 | $this->assertEquals([ 56 | 'type' => 'url_redirect', 57 | 'redirect_url' => '/some-page', 58 | ], AAM::api()->logout_redirect()->get_redirect()); 59 | } 60 | 61 | 62 | } -------------------------------------------------------------------------------- /application/Backend/tmpl/settings/core.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | getList() as $id => $option) { ?> 8 | 9 | 15 | 29 | 30 | 31 | 32 |
10 | 11 |

12 | 13 |

14 |
16 | 21 | type="checkbox" 22 | data-on="" 23 | data-off="" 24 | data-size="small" 25 | 26 | 27 | /> 28 |
33 |
34 | 'default' ]; 31 | $redirect_b = [ 32 | 'type' => 'url_redirect', 33 | 'redirect_url' => site_url() . '/not-found' 34 | ]; 35 | 36 | // Setting redirect 37 | $this->assertEquals( 38 | $redirect_a, 39 | AAM::api()->not_found_redirect()->set_redirect($redirect_a) 40 | ); 41 | 42 | // Verifying that we are getting the same redirect back 43 | $this->assertEquals( 44 | $redirect_a, 45 | AAM::api()->not_found_redirect()->get_redirect() 46 | ); 47 | 48 | // Setting another redirect 49 | $this->assertEquals([ 50 | 'type' => 'url_redirect', 51 | 'redirect_url' => '/not-found' 52 | ], AAM::api()->not_found_redirect()->set_redirect($redirect_b)); 53 | 54 | // Verifying that we are getting the same redirect back 55 | $this->assertEquals([ 56 | 'type' => 'url_redirect', 57 | 'redirect_url' => '/not-found' 58 | ], AAM::api()->not_found_redirect()->get_redirect()); 59 | } 60 | 61 | 62 | } -------------------------------------------------------------------------------- /application/Framework/Preference/Interface.php: -------------------------------------------------------------------------------- 1 | policies()->statements('Url:*') as $stm) { 34 | $effect = isset($stm['Effect']) ? strtolower($stm['Effect']) : 'deny'; 35 | $parsed = explode(':', $stm['Resource'], 2); 36 | 37 | if (!empty($parsed[1])) { 38 | $url = $this->misc->sanitize_url($parsed[1]); 39 | 40 | // Covert redirect 41 | if (!empty($stm['Redirect']) && is_array($stm['Redirect'])) { 42 | $redirect = $this->policy->convert_statement_redirect( 43 | $stm['Redirect'] 44 | ); 45 | } else { 46 | $redirect = [ 'type' => 'default' ]; 47 | } 48 | 49 | $result = array_replace([ 50 | $url => [ 51 | 'access' => [ 52 | 'effect' => $effect !== 'allow' ? 'deny' : 'allow', 53 | 'redirect' => $redirect 54 | ] 55 | ] 56 | ], $result); 57 | } 58 | } 59 | 60 | return apply_filters('aam_apply_policy_filter', $result, $this); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /application/Backend/Feature/Abstract.php: -------------------------------------------------------------------------------- 1 | get_content(); 44 | } 45 | 46 | /** 47 | * Get HTML content 48 | * 49 | * @return string 50 | * @access public 51 | * 52 | * @version 7.0.0 53 | */ 54 | public function get_content() 55 | { 56 | ob_start(); 57 | require_once(dirname(__DIR__) . '/tmpl/' . static::TEMPLATE); 58 | $content = ob_get_contents(); 59 | ob_end_clean(); 60 | 61 | return $content; 62 | } 63 | 64 | /** 65 | * Get currently managed access level 66 | * 67 | * @return AAM_Backend_AccessLevel 68 | * @access public 69 | * 70 | * @version 7.0.0 71 | */ 72 | public function get_access_level() 73 | { 74 | return AAM_Backend_AccessLevel::get_instance(); 75 | } 76 | 77 | /** 78 | * Register feature 79 | * 80 | * @return void 81 | * @access public 82 | * 83 | * @version 7.0.0 84 | */ 85 | public static function register() {} 86 | 87 | } -------------------------------------------------------------------------------- /application/Service/Shortcode/Handler/LoginForm.php: -------------------------------------------------------------------------------- 1 | CSS class for login form 37 | * "redirect" => Redirect to URL after successful login 38 | * 39 | * @param array $args 40 | * 41 | * @return void 42 | * 43 | * @since 6.9.17 https://github.com/aamplugin/advanced-access-manager/issues/318 44 | * @since 6.6.0 Initial implementation of the method 45 | * 46 | * @access public 47 | * @version 6.6.17 48 | */ 49 | public function __construct($args, $content = null) 50 | { 51 | $this->args = array_merge( 52 | array('class' => '', 'redirect' => ''), 53 | is_array($args) ? $args : array() 54 | ); 55 | } 56 | 57 | /** 58 | * Process the shortcode 59 | * 60 | * @return string 61 | * 62 | * @access public 63 | * @version 6.6.0 64 | */ 65 | public function run() 66 | { 67 | return AAM_Backend_View::loadPartial('login-form', array_merge( 68 | $this->args, 69 | array('id' => uniqid()) 70 | )); 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/mustangostang/spyc/Spyc.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'V' => 15 | array ( 16 | 'Vectorface\\Whip\\' => 16, 17 | ), 18 | 'P' => 19 | array ( 20 | 'Psr\\Http\\Message\\' => 17, 21 | ), 22 | 'D' => 23 | array ( 24 | 'DeviceDetector\\' => 15, 25 | ), 26 | 'C' => 27 | array ( 28 | 'Composer\\Semver\\' => 16, 29 | ), 30 | ); 31 | 32 | public static $prefixDirsPsr4 = array ( 33 | 'Vectorface\\Whip\\' => 34 | array ( 35 | 0 => __DIR__ . '/..' . '/vectorface/whip/src', 36 | ), 37 | 'Psr\\Http\\Message\\' => 38 | array ( 39 | 0 => __DIR__ . '/..' . '/psr/http-message/src', 40 | ), 41 | 'DeviceDetector\\' => 42 | array ( 43 | 0 => __DIR__ . '/..' . '/matomo/device-detector', 44 | ), 45 | 'Composer\\Semver\\' => 46 | array ( 47 | 0 => __DIR__ . '/..' . '/composer/semver/src', 48 | ), 49 | ); 50 | 51 | public static $classMap = array ( 52 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 53 | ); 54 | 55 | public static function getInitializer(ClassLoader $loader) 56 | { 57 | return \Closure::bind(function () use ($loader) { 58 | $loader->prefixLengthsPsr4 = ComposerStaticInit9666f71e5b586ecf908dd5d7d2d79db6::$prefixLengthsPsr4; 59 | $loader->prefixDirsPsr4 = ComposerStaticInit9666f71e5b586ecf908dd5d7d2d79db6::$prefixDirsPsr4; 60 | $loader->classMap = ComposerStaticInit9666f71e5b586ecf908dd5d7d2d79db6::$classMap; 61 | 62 | }, null, ClassLoader::class); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/matomo/device-detector/regexes/device/consoles.yml: -------------------------------------------------------------------------------- 1 | ############### 2 | # Device Detector - The Universal Device Detection library for parsing User Agents 3 | # 4 | # @link https://matomo.org 5 | # @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later 6 | ############### 7 | 8 | Archos: 9 | regex: 'Archos.*GAMEPAD([2]?)' 10 | device: 'console' 11 | model: 'Gamepad $1' 12 | 13 | Microsoft: 14 | regex: 'Xbox' 15 | device: 'console' 16 | models: 17 | - regex: 'Xbox Series X' 18 | model: 'Xbox Series X' 19 | - regex: 'Xbox One X' 20 | model: 'Xbox One X' 21 | - regex: 'Xbox One' 22 | model: 'Xbox One' 23 | - regex: 'XBOX_ONE_ED' 24 | model: 'Xbox One S' 25 | - regex: 'Xbox' 26 | model: 'Xbox 360' 27 | 28 | Nintendo: 29 | regex: 'Nintendo (([3]?DS[i]?)|Wii[U]?|Switch|GameBoy)' 30 | device: 'console' 31 | model: '$1' 32 | 33 | OUYA: 34 | regex: 'OUYA' 35 | device: 'console' 36 | model: 'OUYA' 37 | 38 | Sanyo: 39 | regex: 'Aplix_SANYO' 40 | device: 'console' 41 | model: '3DO TRY' 42 | 43 | Sega: 44 | regex: 'Dreamcast|Aplix_SEGASATURN' 45 | device: 'console' 46 | models: 47 | - regex: 'Dreamcast' 48 | model: 'Dreamcast' 49 | - regex: 'Aplix_SEGASATURN' 50 | model: 'Saturn' 51 | 52 | JXD: 53 | regex: 'JXD_S601WIFI' 54 | device: 'console' 55 | model: 'S601 WiFi' 56 | 57 | Sony: 58 | regex: '(?:PlayStation ?(4 Pro|[2-5]|Portable|Vita)|sony_tv;ps5;|\(PS3\))' 59 | device: 'console' 60 | models: 61 | - regex: 'sony_tv;ps5;' 62 | model: 'PlayStation 5' 63 | - regex: 'PlayStation 4 PRO' 64 | model: 'PlayStation 4 Pro' 65 | - regex: '\(PS3\)' 66 | model: 'PlayStation 3' 67 | - regex: 'PlayStation ?(4 Pro|[2-5]|Portable|Vita)' 68 | model: 'PlayStation $1' 69 | 70 | # Retroid Pocket (www.goretroid.com) 71 | Retroid Pocket: 72 | regex: 'Retroid Pocket' 73 | device: 'console' 74 | models: 75 | - regex: 'Pocket ([23]) ?(?:Plus|\+)' 76 | model: '$1 Plus' 77 | - regex: 'Pocket 4 Pro' 78 | model: '4 Pro' 79 | - regex: 'Pocket ([235])' 80 | model: '$1' 81 | -------------------------------------------------------------------------------- /application/Backend/tmpl/page/current-subject.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 |
7 |
8 |
9 | 16 |
17 |
18 |
19 |
20 | 21 | 38 | ID; 39 | } 40 | 41 | /** 42 | * @inheritDoc 43 | */ 44 | private function _apply_policy() 45 | { 46 | $result = []; 47 | 48 | foreach($this->policies()->statements('User:*') as $stm) { 49 | $bits = explode(':', $stm['Resource']); 50 | 51 | // If user identifier is not numeric, convert it to WP_User::ID for 52 | // consistency 53 | if (is_numeric($bits[1])) { 54 | $id = intval($bits[1]); 55 | } else { 56 | $user = $this->users->get_user($bits[1]); 57 | $id = is_object($user) ? $user->ID : null; 58 | } 59 | 60 | if (!empty($id)) { 61 | $result[$id] = array_replace( 62 | isset($result[$id]) ? $result[$id] : [], 63 | $this->policy->statement_to_permission($stm, $this->type) 64 | ); 65 | } 66 | } 67 | 68 | return apply_filters('aam_apply_policy_filter', $result, $this); 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /vendor/matomo/device-detector/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matomo/device-detector", 3 | "type": "library", 4 | "description": "The Universal Device Detection library, that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, media players, mobile apps, feed readers, libraries, etc), operating systems, devices, brands and models.", 5 | "keywords": ["useragent","parser","devicedetection"], 6 | "homepage": "https://matomo.org", 7 | "license": "LGPL-3.0-or-later", 8 | "authors": [ 9 | { 10 | "name": "The Matomo Team", 11 | "email": "hello@matomo.org", 12 | "homepage": "https://matomo.org/team/" 13 | } 14 | ], 15 | "support": { 16 | "forum": "https://forum.matomo.org/", 17 | "issues": "https://github.com/matomo-org/device-detector/issues", 18 | "wiki": "https://dev.matomo.org/", 19 | "source": "https://github.com/matomo-org/matomo" 20 | }, 21 | "autoload": { 22 | "psr-4": { "DeviceDetector\\": "" }, 23 | "exclude-from-classmap": ["Tests/"] 24 | }, 25 | "require": { 26 | "php": "^7.2|^8.0", 27 | "mustangostang/spyc": "*" 28 | }, 29 | "require-dev": { 30 | "phpunit/phpunit": "^8.5.8", 31 | "psr/cache": "^1.0.1", 32 | "psr/simple-cache": "^1.0.1", 33 | "matthiasmullie/scrapbook": "^1.4.7", 34 | "phpstan/phpstan": "^1.10.44", 35 | "mayflower/mo4-coding-standard": "^v9.0.0", 36 | "slevomat/coding-standard": "<8.16.0", 37 | "symfony/yaml": "^5.1.7" 38 | }, 39 | "suggest": { 40 | "doctrine/cache": "Can directly be used for caching purpose", 41 | "ext-yaml": "Necessary for using the Pecl YAML parser" 42 | }, 43 | "scripts": { 44 | "php-cs-fixed": "php vendor/bin/phpcbf" 45 | }, 46 | "archive": { 47 | "exclude": ["/autoload.php"] 48 | }, 49 | "replace": { 50 | "piwik/device-detector":"self.version" 51 | }, 52 | "config": { 53 | "allow-plugins": { 54 | "dealerdirect/phpcodesniffer-composer-installer": true 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | get_headers(); 42 | 43 | if (array_key_exists('authorization', $headers)) { 44 | $token = str_replace('Bearer ', '', $headers['authorization'][0]); 45 | 46 | if (AAM::api()->jwt->is_valid($token)) { 47 | $claims = AAM::api()->jwt->decode($token); 48 | 49 | // Setting current user 50 | wp_set_current_user($claims['user_id']); 51 | } 52 | } 53 | 54 | return $result; 55 | }, 10, 3); 56 | 57 | // Create a somewhat a clone of the administrator role to test functionality that 58 | // can be restricted to not super admin user 59 | if (!wp_roles()->is_role('subadmin')) { 60 | wp_roles()->add_role( 61 | 'subadmin', 62 | 'Sub Administrator', wp_roles()->get_role('administrator')->capabilities 63 | ); 64 | } --------------------------------------------------------------------------------