Making WordPress.org


Ignore:
Timestamp:
03/16/2026 03:53:45 AM (7 months ago)
Author:
dd32
Message:

Plugin Directory: Allow Featured/Beta plugin owners to manage the committers and allow all committers to toggle public preview.

This relaxes a security change introduced with #5654, so adding/removing committers of these plugins now also triggers the plugins team to be CC'd for review.

Closes ​https://github.com/WordPress/wordpress.org/pull/561.
Fixes #8206.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins-2024/inc/template-tags.php

    r14644 r14718  
    266266        $post = get_post();
    267267
    268         // Check if they can access plugin management, but can't add committers.
    269         // This means the plugin has limited self-management functionalities, for security.
     268        $is_beta     = is_object_in_term( $post->ID, 'plugin_section', 'beta' );
     269        $is_featured = is_object_in_term( $post->ID, 'plugin_section', 'featured' );
     270
     271        // Check if the plugin is in a section with limited self-management, and the user can manage it.
    270272        if (
    271                 (
    272                         current_user_can( 'plugin_admin_edit', $post ) &&
    273                         ! current_user_can( 'plugin_add_committer', $post )
    274                 ) || (
    275                         // Show the notice to plugin reviewers when it's limited. See class-capabilities.php.
    276                         is_object_in_term( $post->ID, 'plugin_section', array( 'beta', 'featured' ) ) &&
     273                ! ( $is_beta || $is_featured ) ||
     274                ! (
     275                        current_user_can( 'plugin_admin_edit', $post ) ||
    277276                        current_user_can( 'plugin_review' )
    278277                )
    279278        ) {
    280                 printf(
    281                         '<div class="plugin-notice notice notice-warning notice-alt"><p>%s</p></div>',
    282                         sprintf(
    283                                 __( 'Management of this plugin has been limited for security reasons. Please contact the <a href="mailto:%1$s">plugins team (%1$s)</a> for assistance to add/remove committers, or to perform other actions that are unavailable.', 'wporg-plugins' ),
    284                                 'plugins@wordpress.org'
    285                         )
     279                return;
     280        }
     281
     282        $section = $is_beta ? __( 'Beta', 'wporg-plugins' ) : __( 'Featured', 'wporg-plugins' );
     283        $is_owner = get_current_user_id() == $post->post_author;
     284
     285        if ( $is_owner ) {
     286                $message = sprintf(
     287                        /* translators: 1: section name (Beta/Featured), 2: plugins team email address */
     288                        __( 'This plugin is listed in the %1$s section. Some management features have been limited for security reasons. Please contact the <a href="mailto:%2$s">plugins team (%2$s)</a> for assistance with closing or transferring this plugin.', 'wporg-plugins' ),
     289                        $section,
     290                        'plugins@wordpress.org'
    286291                );
    287         }
     292        } else {
     293                $owner = get_user_by( 'ID', $post->post_author );
     294                $message = sprintf(
     295                        /* translators: 1: section name (Beta/Featured), 2: plugin owner display name, 3: plugins team email address */
     296                        __( 'This plugin is listed in the %1$s section. Some management features have been limited for security reasons. Only the plugin owner (%2$s) can manage committers. Please contact the <a href="mailto:%3$s">plugins team (%3$s)</a> for assistance with closing or transferring this plugin.', 'wporg-plugins' ),
     297                        $section,
     298                        esc_html( $owner->display_name ),
     299                        'plugins@wordpress.org'
     300                );
     301        }
     302
     303        printf(
     304                '<div class="plugin-notice notice notice-warning notice-alt"><p>%s</p></div>',
     305                $message
     306        );
    288307}
    289308
Note: See TracChangeset for help on using the changeset viewer.