Add permission to view the block

Created on 17 November 2023, 12 months ago

We need to create a new permission and implement blockAceess() method in the block.

πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine AstonVictor

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @AstonVictor
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 12 months ago
    4 pass
  • @astonvictor opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Created a new MR.

    Added a new permission to view information about git in the block.

    Note that we didn't use the permission before. So, merging changes will hide the block for all users (except admins).
    in that case, we can implement an update hook to add the permission to both Anonymous & Authenticated roles.
    Let me know what you think about it.

    thanks

  • πŸ‡³πŸ‡΄Norway eiriksm Norway

    Thanks, that makes sense.

    Please create an update hook and add the permissions, that is certainly needed :)

  • Status changed to Needs work 12 months ago
  • πŸ‡³πŸ‡΄Norway eiriksm Norway
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 12 months ago
    4 pass
  • Status changed to Needs review 12 months ago
  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Done. Implemented an update hook.

  • πŸ‡¬πŸ‡§United Kingdom schillerm

    Hi, I installed !MR9 on my local (D9 site) and got this error when trying to place the Info block.

    Error: Class "eiriksm\GitInfo\GitInfo" not found in include() (line 14 of /app/web/modules/contrib/git_info/src/GitInfo.php)

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Hi there,

    you should install dependencies for the module.
    or you can install the module via composer.

  • πŸ‡¬πŸ‡§United Kingdom schillerm

    Hi again, ok I was able to get this working by doing the following extra steps ..

    * ran composer require 'drupal/git_info:^2.0' (install latest version with all dependencies)
    * delete the git_info module folder (created by previous command)

    Then run normal issue commands to clone the git_info module (git clone https://git.drupalcode.org/project/git_info.git) and checkout the MR branch. After that install git_info module (in GUI) and run tests.

    Please let me know if you think I could have done this in a better way.

    Testing : The Info block places on the page, with no errors as admin. The block is hidden when viewing the page as unauthenticated user.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Hi @schillerm,

    your testing is incorrect.

    for new sites/projects, you should manage permissions to view the block on the permission page.
    for the existing project (with already installed and enabled module), the visibility of the block should not be changed after applying changes from the current issue.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Hi @eiriksm,

    any updates?

  • Status changed to Fixed 29 days ago
  • πŸ‡³πŸ‡΄Norway eiriksm Norway

    Thanks everyone β™₯οΈπŸŽ‰

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

Production build 0.71.5 2024