πŸ‡ΊπŸ‡ΈUnited States @nm63282

Seattle, WA
Account created on 16 April 2021, over 3 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Move UI tips/ instructions to bottom. 

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Improve page title.

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Cleanup. 

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Improve code documentation. 

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Improve testing instructions.

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Add source code.

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Improve clarity.

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

Here is a sample plugin for above.

Note it would break complex permissions, for example block rules below or beside allow rules.

web/modules/custom/zzz/src/Plugin/ImcePlugin/ZzzImceFolders.php


namespace Drupal\zzz\Plugin\ImcePlugin;


use Drupal\Core\Session\AccountProxyInterface;
use Drupal\imce\Imce;
use Drupal\imce\ImcePluginBase;

/**
 * Custom IMCE folder perms merge.
 *
 * @ImcePlugin(
 *   id = "zzz_imce_folders",
 *   label = "IMCE ZZZ Folders",
 *   weight = 10,
 * )
 *
 * Explain.
 */
class ZzzImceFolders extends ImcePluginBase {

  /**
   * {@inheritdoc}
   */
  public function processUserConf(array &$conf, AccountProxyInterface $user) {

    // Skip administrators.
    if ($user->hasPermission("administer imce")) {
      return;
    }

    // Skip admin roles.
    if (array_intersect($user->getRoles(), [
      'administrator',
      'custom_client_admin',
    ])) {
      return;
    }

    // Get imce settings.
    $settings = \Drupal::config('imce.settings');
    $imce_roles = $settings->get('roles_profiles');

    // Get user roles, from more permissive to less permissive.
    $user_roles = array_reverse(array_flip($user->getRoles()));
    $user_imce_roles = array_keys(array_intersect_key($imce_roles, $user_roles));

    // Get storage.
    $scheme = \Drupal::config('system.file')->get('default_scheme');
    $storage = \Drupal::entityTypeManager()->getStorage('imce_profile');

    // Get folders for each role.
    foreach ($user_imce_roles as $id) {
      if ($profile = $storage->load($imce_roles[$id][$scheme])) {
        if ($folders = $profile->getConf('folders', [])) {
          $processed = Imce::processUserFolders($folders, $user);
          $conf['folders'][$id] = $processed;
        }
      }
    }
  }

}
πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

This still occurs on 3.0.0-beta8.

Oddly, the patch still applies too.

looks like the issue may be multiple dialogs getting inserted.

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA

nifsight β†’ created an issue.

πŸ‡ΊπŸ‡ΈUnited States nm63282 Seattle, WA
Production build 0.71.5 2024