permissions example

$resource_configs = $this->resourceConfigStorage->loadMultiple();
    foreach ($resource_configs as $resource_config) {
      $plugin = $resource_config->getResourcePlugin();

      // Add the rest resource configuration entity as a dependency to the       // permissions.       $permissions += array_map(function Darray $permission_info) use ($resource_config) {
        $merge_info['dependencies'][$resource_config->getConfigDependencyKey()] = [
          $resource_config->getConfigDependencyName(),
        ];
        return NestedArray::mergeDeep($permission_info$merge_info);
      }$plugin->permissions());
    }
    return $permissions;
  }

}
    // permission exists, then we add that below. The access manager requires     // that ALL access checks must grant access, so this still results in     // correct behavior.     $requirements = [
      '_access' => 'TRUE',
    ];

    // Only specify route requirements if the default permission exists. For any     // more advanced route definition, resource plugins extending this base     // class must override this method.     $permission = "restful $lower_method $this->pluginId";
    if (isset($this->permissions()[$permission])) {
      $requirements['_permission'] = $permission;
    }

    return $requirements;
  }

}
Home | Imprint | This part of the site doesn't use cookies.