I have an Editor role on my drupal site and I add all permission to the role where it can access and manage modals. After I logged in to the user with this role it can't access to the administration page or can't create or manage the modals.

Comments

csakiistvan created an issue. See original summary.

renatog’s picture

really makes sense. Thanks for reporting.

It happens because we have a Views with permission perm: 'administer site configuration'

https://git.drupalcode.org/project/modal_page/-/blob/8.x-2.x/config/opti...

We need to fix that to allow views with manage modals permissions.

csakiistvan’s picture

StatusFileSize
new488 bytes

You are right, and we need to change the other permissions too https://git.drupalcode.org/project/modal_page/-/blob/8.x-2.x/modal_page....

I can create a patch for that

csakiistvan’s picture

StatusFileSize
new2.58 KB
csakiistvan’s picture

If I use the #4 patch, the role what use all modal_page permission has access denied page on "admin/structure/modal" and the others page

renatog’s picture

Status: Active » Needs work

Good patch @csakiistvan!! Very good! Thanks a lot!

But we need to create as well a hook_update to update this views in website that already have Modal Page installed.

Example: https://git.drupalcode.org/project/modal_page/-/blob/8.x-2.x/modal_page....

renatog’s picture

P.s. The code probably will be the same.

/**
 * Implements hook_update_N().
 */
function modal_page_update_8201() {

  if (empty(\Drupal::moduleHandler()->moduleExists('views'))) {
    return FALSE;
  }

  $config_views_path = drupal_get_path('module', 'modal_page') . '/config/optional/views.view.list_modal.yml';

  $data = Yaml::decode(file_get_contents($config_views_path));

  \Drupal::configFactory()->getEditable('views.view.list_modal')->setData($data)->save(TRUE);

  \Drupal::service('cache.render')->invalidateAll();
}

My recommendation is to create a function called update_modal_page_views () and the hook update call this function

wil2091’s picture

StatusFileSize
new27.55 KB

I have updated the views configs and added hook_update_n(). Please verify.

wil2091’s picture

Status: Needs work » Needs review
renatog’s picture

Issue tags: +Needs manual testing

Thanks a lot for your help @wil2091

The function update_modal_page_views(); was a good catch!

I'll test soon

Thanks

renatog’s picture

StatusFileSize
new4.17 KB

New patch re-rol

ilgnerfagundes’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new94.11 KB

Permission works for a new user who is not an administrator.

renatog’s picture

Issue tags: -Needs manual testing

Tested with new user with new role and really works well now

  • RenatoG committed ab135d3 on 8.x-2.x
    Issue #3120795 by csakiistvan, RenatoG, wil2091, ilgnerfagundes: The...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the dev branch. @csakiistvan Thanks for reporting this.

renatog’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.