--- a/wedocs/assets/build/index.asset.php
+++ b/wedocs/assets/build/index.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '1fd015210a7390e3647a');
+<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'ab6e63c54006ff4e8837');
--- a/wedocs/includes/API/SettingsApi.php
+++ b/wedocs/includes/API/SettingsApi.php
@@ -67,7 +67,7 @@
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_items' ),
- 'permission_callback' => '__return_true',
+ 'permission_callback' => array( $this, 'get_items_permissions_check' ),
),
array(
'methods' => WP_REST_Server::CREATABLE,
@@ -104,6 +104,23 @@
}
/**
+ * Check settings data read permission.
+ *
+ * @since 2.1.16
+ *
+ * @param WP_REST_Request $request
+ *
+ * @return bool|WP_Error
+ */
+ public function get_items_permissions_check( $request ) {
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to do that.', 'wedocs' ), array( 'status' => rest_authorization_required_code() ) );
+ }
+
+ return true;
+ }
+
+ /**
* Check settings data creation permission.
*
* @since 2.0.0
--- a/wedocs/includes/Admin.php
+++ b/wedocs/includes/Admin.php
@@ -121,4 +121,4 @@
return $res;
}
-}
+}
No newline at end of file
--- a/wedocs/includes/functions.php
+++ b/wedocs/includes/functions.php
@@ -510,12 +510,26 @@
$wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
}
- $roles = $wp_roles->get_names();
- $capabilities = array( 'edit_post', 'edit_docs', 'publish_docs', 'edit_others_docs', 'read_private_docs', 'edit_private_docs', 'edit_published_docs' );
- // Push documentation handling access to users.
+ $permitted_roles = array( 'administrator', 'editor' );
+ $all_roles = $wp_roles->get_names();
+ $capabilities = array( 'edit_docs', 'publish_docs', 'edit_others_docs', 'read_private_docs', 'edit_private_docs', 'edit_published_docs' );
+
+ // First, remove capabilities from unauthorized roles (cleanup for existing installations)
+ foreach ( $capabilities as $capability ) {
+ foreach ( array_keys( $all_roles ) as $role_key ) {
+ $role = $wp_roles->get_role( $role_key );
+ if ( $role && $role->has_cap( $capability ) && ! in_array( $role_key, $permitted_roles, true ) ) {
+ $wp_roles->remove_cap( $role_key, $capability );
+ }
+ }
+ }
+
+ // Push documentation handling access ONLY to permitted roles.
foreach ( $capabilities as $capability ) {
- foreach ( $roles as $role_key => $role ) {
- $wp_roles->add_cap( $role_key, $capability );
+ foreach ( $permitted_roles as $role_key ) {
+ if ( $wp_roles->is_role( $role_key ) ) {
+ $wp_roles->add_cap( $role_key, $capability );
+ }
}
}
}
--- a/wedocs/vendor/autoload.php
+++ b/wedocs/vendor/autoload.php
@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInit6eb449ec1097d9853ab88fe4bfdc1a98::getLoader();
+return ComposerAutoloaderInita5217d61fa6434ba2fea633864271676::getLoader();
--- a/wedocs/vendor/composer/autoload_real.php
+++ b/wedocs/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit6eb449ec1097d9853ab88fe4bfdc1a98
+class ComposerAutoloaderInita5217d61fa6434ba2fea633864271676
{
private static $loader;
@@ -24,15 +24,15 @@
require __DIR__ . '/platform_check.php';
- spl_autoload_register(array('ComposerAutoloaderInit6eb449ec1097d9853ab88fe4bfdc1a98', 'loadClassLoader'), true, true);
+ spl_autoload_register(array('ComposerAutoloaderInita5217d61fa6434ba2fea633864271676', 'loadClassLoader'), true, true);
self::$loader = $loader = new ComposerAutoloadClassLoader(dirname(dirname(__FILE__)));
- spl_autoload_unregister(array('ComposerAutoloaderInit6eb449ec1097d9853ab88fe4bfdc1a98', 'loadClassLoader'));
+ spl_autoload_unregister(array('ComposerAutoloaderInita5217d61fa6434ba2fea633864271676', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
- call_user_func(ComposerAutoloadComposerStaticInit6eb449ec1097d9853ab88fe4bfdc1a98::getInitializer($loader));
+ call_user_func(ComposerAutoloadComposerStaticInita5217d61fa6434ba2fea633864271676::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@@ -53,12 +53,12 @@
$loader->register(true);
if ($useStaticLoader) {
- $includeFiles = ComposerAutoloadComposerStaticInit6eb449ec1097d9853ab88fe4bfdc1a98::$files;
+ $includeFiles = ComposerAutoloadComposerStaticInita5217d61fa6434ba2fea633864271676::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
- composerRequire6eb449ec1097d9853ab88fe4bfdc1a98($fileIdentifier, $file);
+ composerRequirea5217d61fa6434ba2fea633864271676($fileIdentifier, $file);
}
return $loader;
@@ -70,7 +70,7 @@
* @param string $file
* @return void
*/
-function composerRequire6eb449ec1097d9853ab88fe4bfdc1a98($fileIdentifier, $file)
+function composerRequirea5217d61fa6434ba2fea633864271676($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
--- a/wedocs/vendor/composer/autoload_static.php
+++ b/wedocs/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
namespace ComposerAutoload;
-class ComposerStaticInit6eb449ec1097d9853ab88fe4bfdc1a98
+class ComposerStaticInita5217d61fa6434ba2fea633864271676
{
public static $files = array (
'bc33bdda64b68124ebec25fc6f289c9e' => __DIR__ . '/../..' . '/includes/functions.php',
@@ -60,9 +60,9 @@
public static function getInitializer(ClassLoader $loader)
{
return Closure::bind(function () use ($loader) {
- $loader->prefixLengthsPsr4 = ComposerStaticInit6eb449ec1097d9853ab88fe4bfdc1a98::$prefixLengthsPsr4;
- $loader->prefixDirsPsr4 = ComposerStaticInit6eb449ec1097d9853ab88fe4bfdc1a98::$prefixDirsPsr4;
- $loader->classMap = ComposerStaticInit6eb449ec1097d9853ab88fe4bfdc1a98::$classMap;
+ $loader->prefixLengthsPsr4 = ComposerStaticInita5217d61fa6434ba2fea633864271676::$prefixLengthsPsr4;
+ $loader->prefixDirsPsr4 = ComposerStaticInita5217d61fa6434ba2fea633864271676::$prefixDirsPsr4;
+ $loader->classMap = ComposerStaticInita5217d61fa6434ba2fea633864271676::$classMap;
}, null, ClassLoader::class);
}
--- a/wedocs/wedocs.php
+++ b/wedocs/wedocs.php
@@ -3,7 +3,7 @@
Plugin Name: weDocs
Plugin URI: https://wedocs.co/
Description: A documentation plugin for WordPress
-Version: 2.1.15
+Version: 2.1.16
Author: weDevs
Author URI: https://wedocs.co/?utm_source=wporg&utm_medium=banner&utm_campaign=author-uri
License: GPL2
@@ -61,7 +61,7 @@
*
* @var string
*/
- const VERSION = '2.1.15';
+ const VERSION = '2.1.16';
/**
* The plugin url.