You are here

protected static function ImceController::disablePerms in FileField Sources 8

Disable IMCE profile permissions.

1 call to ImceController::disablePerms()
ImceController::page in src/Controller/ImceController.php
Outputs the IMCE browser for FileField.

File

src/Controller/ImceController.php, line 101

Class

ImceController
Controller routines for imce routes.

Namespace

Drupal\filefield_sources\Controller

Code

protected static function disablePerms($imceFM, $field_uri, $exceptions = []) {
  $scheme = $imceFM
    ->getConf('scheme');
  $root = $scheme . '://';
  $is_root = $field_uri == $root;
  $path = $is_root ? '.' : substr($field_uri, strlen($root));
  $folders = $imceFM
    ->getConf('folders');
  $perms = \Drupal::service('plugin.manager.imce.plugin')
    ->permissionInfo();
  $folders['.']['permissions']['all'] = FALSE;
  $folders[$path]['permissions']['all'] = FALSE;
  foreach ($perms as $perm => $title) {
    $folders['.']['permissions'][$perm] = FALSE;
    $folders[$path]['permissions'][$perm] = in_array($perm, [
      'browse_files',
    ]) ? TRUE : FALSE;
  }
  $imceFM
    ->setConf('folders', $folders);
}