You are here

README.txt in Metatag 8

Metatag Extended Permissions
----------------------------
This add-on for Metatag creates a new permission for each individual meta tag,
allowing for very fine controlled access over meta tag customization.


Usage
--------------------------------------------------------------------------------
* Enable the Metatag Extended Permissions module.
* Assign the appropriate permissions via the admin/people/permisisons page.


Known issues
--------------------------------------------------------------------------------
This module introduces a possibility for dramatically increasing the number of
checkboxes on the permissions page. This can lead to the following problems:
* The permissions admin page or node forms taking a long time to load.
* PHP timeout errors on the permissions admin or node forms pages.
* Out-of-memory errors loading the above.
* The web server not being able to process the permissions form due to hitting
  PHP's max_input_vars limit.

Because of these, it is advised to fully test this module on a copy of a site
before enabling it on production, to help ensure these problems are not
encountered.


Updating from Metatag Access
--------------------------------------------------------------------------------
The original sandbox module for this functionality was called "Metatag Access".
Sites which used that submodule should switch to this module. Rather than
loosing their configuration, use the following update script to convert the
permissions.

/**
 * Replace Metatag Access with Metatag Extended Perms.
 */
function mysite_update_9001() {
  $installer = \Drupal::service('module_installer');

  // Install the Metatag Extended Permissions module.
  $installer->install(['metatag_extended_perms']);

  // Update the permissions.
  foreach (Role::loadMultiple() as $role) {
    // Keep track of whether the permissions changed for this role.
    $changed = FALSE;
    foreach ($role->getPermissions() as $key => $perm) {
      // Look for permissions that started with the old permission string.
      if (strpos($perm, 'access metatag tag') !== FALSE) {
        // Grand the new permission.
        $role->grantPermission(str_replace('access metatag tag', 'access metatag', $perm));

        // Track that the role's permissions changed.
        $changed = TRUE;
      }
    }

    // If the permissions changed, save the role.
    if ($changed) {
      $role->trustData()->save();
    }
  }

  // Uninstall the Metatag Access module.
  $installer->uninstall(['metatag_access']);
}


Credits / contact
--------------------------------------------------------------------------------
Originally written by Michael Petri [1].


References
--------------------------------------------------------------------------------
1: https://www.drupal.org/u/michaelpetri

File

metatag_extended_perms/README.txt
View source
  1. Metatag Extended Permissions
  2. ----------------------------
  3. This add-on for Metatag creates a new permission for each individual meta tag,
  4. allowing for very fine controlled access over meta tag customization.
  5. Usage
  6. --------------------------------------------------------------------------------
  7. * Enable the Metatag Extended Permissions module.
  8. * Assign the appropriate permissions via the admin/people/permisisons page.
  9. Known issues
  10. --------------------------------------------------------------------------------
  11. This module introduces a possibility for dramatically increasing the number of
  12. checkboxes on the permissions page. This can lead to the following problems:
  13. * The permissions admin page or node forms taking a long time to load.
  14. * PHP timeout errors on the permissions admin or node forms pages.
  15. * Out-of-memory errors loading the above.
  16. * The web server not being able to process the permissions form due to hitting
  17. PHP's max_input_vars limit.
  18. Because of these, it is advised to fully test this module on a copy of a site
  19. before enabling it on production, to help ensure these problems are not
  20. encountered.
  21. Updating from Metatag Access
  22. --------------------------------------------------------------------------------
  23. The original sandbox module for this functionality was called "Metatag Access".
  24. Sites which used that submodule should switch to this module. Rather than
  25. loosing their configuration, use the following update script to convert the
  26. permissions.
  27. /**
  28. * Replace Metatag Access with Metatag Extended Perms.
  29. */
  30. function mysite_update_9001() {
  31. $installer = \Drupal::service('module_installer');
  32. // Install the Metatag Extended Permissions module.
  33. $installer->install(['metatag_extended_perms']);
  34. // Update the permissions.
  35. foreach (Role::loadMultiple() as $role) {
  36. // Keep track of whether the permissions changed for this role.
  37. $changed = FALSE;
  38. foreach ($role->getPermissions() as $key => $perm) {
  39. // Look for permissions that started with the old permission string.
  40. if (strpos($perm, 'access metatag tag') !== FALSE) {
  41. // Grand the new permission.
  42. $role->grantPermission(str_replace('access metatag tag', 'access metatag', $perm));
  43. // Track that the role's permissions changed.
  44. $changed = TRUE;
  45. }
  46. }
  47. // If the permissions changed, save the role.
  48. if ($changed) {
  49. $role->trustData()->save();
  50. }
  51. }
  52. // Uninstall the Metatag Access module.
  53. $installer->uninstall(['metatag_access']);
  54. }
  55. Credits / contact
  56. --------------------------------------------------------------------------------
  57. Originally written by Michael Petri [1].
  58. References
  59. --------------------------------------------------------------------------------
  60. 1: https://www.drupal.org/u/michaelpetri