Plugin Directory

Changeset 3348751


Ignore:
Timestamp:
08/22/2025 05:25:22 PM (6 months ago)
Author:
xpro
Message:

V 1.2.10 - 22 August 2025

  • Fix: Resolved issue related to Access Control.
Location:
xpro-theme-builder/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • xpro-theme-builder/trunk/admin/class-xpro-rest-api.php

    r2862456 r3348751  
    530530     * @return boolean
    531531     */
    532     public static function check_permission() {
    533         return current_user_can( 'edit_posts' );
    534     }
     532    // public static function check_permission() {
     533    //  return current_user_can( 'edit_posts' );
     534    // }
     535
     536    /**
     537     * Checks permission.
     538     *
     539     * @param WP_REST_Request $request The request.
     540     *
     541     * @return boolean|WP_Error
     542     */
     543    public static function check_permission( $request ) {
     544        $route = $request->get_route();
     545       
     546        if ( strpos( $route, 'create-post' ) !== false ) {
     547            return current_user_can( 'publish_posts' );
     548        }
     549
     550        if ( strpos( $route, 'update-post' ) !== false || strpos( $route, 'delete-post' ) !== false ) {
     551            $post_id = (int) $request['id'];
     552            $post    = get_post( $post_id );
     553            if ( ! $post ) {
     554                return new WP_Error( 'rest_post_invalid', __( 'Invalid post.' ), array( 'status' => 404 ) );
     555            }
     556
     557            $allowed_types = array( 'post', 'page' );
     558            if ( ! in_array( $post->post_type, $allowed_types, true ) ) {
     559                return new WP_Error( 'rest_forbidden', __( 'Post type not allowed.' ), array( 'status' => 403 ) );
     560            }
     561
     562            if ( $post->post_author != get_current_user_id() && ! current_user_can( 'edit_others_posts' ) ) {
     563                return new WP_Error( 'rest_forbidden', __( 'Dilshad is testing not deleted or edit' ), array( 'status' => 403 ) );
     564            }
     565
     566            return true;
     567        }
     568
     569        if ( strpos( $route, 'update-settings' ) !== false ) {
     570            return current_user_can( 'manage_options' );
     571        }
     572
     573        return new WP_Error( 'rest_forbidden', __( 'Invalid permission.' ), array( 'status' => 403 ) );
     574    }
    535575}
    536576
  • xpro-theme-builder/trunk/changelog.txt

    r3324980 r3348751  
     1= V 1.2.10 - 22 August 2025 =
     2
     3- Fix: Resolved issue related to Access Control.
     4
     5
    16= V 1.2.9 - 09 July 2025 =
    27
  • xpro-theme-builder/trunk/readme.txt

    r3324980 r3348751  
    11=== Xpro Theme Builder For Elementor - FREE ===
    22Plugin Name: Xpro Theme Builder For Elementor - FREE
    3 Version: 1.2.9
     3Version: 1.2.10
    44Contributors: Xpro
    55Tags: elementor, theme builder, header footer builder, sticky header, free theme builder
    66Requires at least: 5.0
    7 Tested up to: 6.8.1
     7Tested up to: 6.8.2
    88Stable tag: trunk
    99Requires PHP: 7.0
     
    290290== Changelog ==
    291291
     292= V 1.2.10 - 22 August 2025 =
     293
     294- Fix: Resolved issue related to Access Control.
     295
     296
    292297= V 1.2.9 - 09 July 2025 =
    293298
  • xpro-theme-builder/trunk/xpro-theme-builder.php

    r3324980 r3348751  
    66 * Author:      Xpro
    77 * Author URI:  https://www.wpxpro.com/
    8  * Version:     1.2.9
     8 * Version:     1.2.10
    99 * Developer:   Xpro Team
    1010 * Text Domain: xpro-theme-builder
    11  * Elementor tested up to: 3.30.1
     11 * Elementor tested up to: 3.31.2
    1212 *
    1313 * @package xpro-theme-builder
    1414 */
    1515
    16 define( 'XPRO_THEME_BUILDER_VER', '1.2.9' );
     16define( 'XPRO_THEME_BUILDER_VER', '1.2.10' );
    1717define( 'XPRO_THEME_BUILDER_FILE', __FILE__ );
    1818define( 'XPRO_THEME_BUILDER_BASE', plugin_basename( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.