Allow bulk unbanning / removal and clearing ip addresses

Created on 13 March 2024, 8 months ago

Problem/Motivation

Currently the banned IP-addresses can only be removed one by one in the UI: /admin/config/people/ban

It would be much better to be able to remove them in bulk.
Additionally, (or as simple first step) it would also be helpful to have a "Clear all" option like in dblog (/admin/reports/dblog/confirm)

The current workaround is to delete the record in the database.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component
Ban 

Last updated about 4 hours ago

No maintainer
Created by

🇩🇪Germany Anybody Porta Westfalica

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

Merge Requests

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇩🇪Germany Anybody Porta Westfalica
  • First commit to issue fork.
  • Merge request !9095Resolve #3427545 "Allow bulk unbanning" → (Open) created by lrwebks
  • 🇩🇪Germany lrwebks Porta Westfalica
  • Assigned to lrwebks
  • Status changed to Needs work 4 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica
  • Pipeline finished with Success
    4 months ago
    Total: 723s
    #245575
  • Status changed to Needs review 4 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica
  • Pipeline finished with Success
    4 months ago
    Total: 541s
    #245596
  • 🇩🇪Germany lrwebks Porta Westfalica

    I'm currently still writing the appropriate tests for the new behaviors, but @Anybody could already take a look at what's implemented!

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @LRWebks looks great! Just some textual changes.

  • Status changed to Needs work 4 months ago
  • 🇩🇪Germany Anybody Porta Westfalica
  • Status changed to Needs review 3 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Added the required test for the bulk unbanning and corrected all occurrences of "unblock" to "unban"! Unfortunately the test file seems to have been modified since we started with this issue - @Anybody, could you try to resolve this as I am not very experienced with resolving core merge conflicts...

  • Pipeline finished with Success
    3 months ago
    Total: 790s
    #259035
  • Status changed to Needs work 3 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    @LRWebks makes sense to learn it then :)

    I think this is hopefully simple: GitLab reports:

    Conflict: This file was modified in the source branch, but removed in the target branch. Ask someone with write access to resolve it.

    for
    core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
    See https://git.drupalcode.org/project/drupal/-/merge_requests/9095/diffs#di...

    So maybe you should first check that. Typically "Update fork" is often enough, but the thing above seems to cause the conflict.

    Changes LGTM.

    This is a good chance to understand how Git & forking works and how to update the issue fork to the target branch.

    Safe hint: Often it's helpful to save the patch (Save target from "plain diff" link above)
    So if things go wrong, you can easily restore the status by applying the patch using 3-way-merge.

  • 🇩🇪Germany Anybody Porta Westfalica

    Reason can be found here: 📌 Convert IpAddressBlockingTest to a Unit and Kernel test and improve Fixed

    The tests were moved 3 days ago!

  • 🇩🇪Germany Anybody Porta Westfalica

    @LRWebks: The learning: Before proceeding work on an (highly active) project (especially core) it makes sense to first update the fork (here in GitLab UI), then pull and then continue working. Then the risk is lower for things like this to happen.

  • Pipeline finished with Failed
    3 months ago
    Total: 179s
    #259229
  • Status changed to Needs review 3 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Well, everything should be in order now - I rebased everything and since the old test file was split into a Kernel and a Unit test, the UI test got its own Functional test class now.

  • Pipeline finished with Failed
    3 months ago
    Total: 175s
    #259268
  • 🇩🇪Germany lrwebks Porta Westfalica

    The pipeline is currently failing, unfortunately, this is due to the new tests established in 📌 Convert IpAddressBlockingTest to a Unit and Kernel test and improve Fixed ... My test is fine, what now?

  • Status changed to Needs work 3 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    phpstan fails

  • 🇩🇪Germany Anybody Porta Westfalica

    @LRWebks you're right, I reported that at 📌 Convert IpAddressBlockingTest to a Unit and Kernel test and improve Fixed

  • 🇩🇪Germany Anybody Porta Westfalica

    @LRWebks no I was wrong and that was misleading. You need to update the tests, as you introduced a new parameter to the constructor!

    That's why it fails.

  • Status changed to Needs review 3 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Okay, I've updated the BanAdminTest to work with our changes. Back to review!

  • Pipeline finished with Success
    3 months ago
    Total: 590s
    #260124
  • Status changed to Needs work 3 months ago
  • 🇺🇸United States smustgrave

    Left some comments on MR.

    Since we are changing UI text may need usability sign off also.

  • Pipeline finished with Success
    3 months ago
    Total: 472s
    #261183
  • Pipeline finished with Failed
    3 months ago
    Total: 520s
    #261218
  • 🇩🇪Germany lrwebks Porta Westfalica

    I've tried for a while now to figure out what is causing the test failures, and I must say that I'm really not sure. I have run the failed tests locally, and they work for me. The test failures also seem unrelated again. It could be because I updated the fork and the new commits are causing this - I'll try updating again and see if that changes anything.

  • Pipeline finished with Success
    3 months ago
    Total: 673s
    #261411
  • Status changed to Needs review 3 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Well, that was really it! So what's left now is:

    • @smustgrave, please respond to my comment so that I can quickly fix the problem
    • Usability Review?
  • Status changed to Needs work 3 months ago
  • 🇩🇪Germany Grevil

    I am not really a big fan of having the "Unban selected" button in the "actions" section:

    I think having the button under the table feels "more organically" and more similiar to other drupal lists:

    Furthermore, it would be nice if the button only appears if any ips are selected (using the states api).

  • 🇩🇪Germany Grevil

    Great work @lrwebks! I added a few more comments, which should be resolved.

    @smustgrave here you said, that changing "unblock" to "unban" might need a "usability sign off" should we instead just use "unblock" instead of "unban" everywhere else?

    Instead of a mixture of "unban", "unblock" and "delete"?

  • 🇩🇪Germany Grevil

    Made a few more comments.

  • Pipeline finished with Success
    2 months ago
    Total: 374s
    #286959
  • Pipeline finished with Failed
    2 months ago
    Total: 480s
    #287020
  • Pipeline finished with Success
    2 months ago
    Total: 357s
    #287033
  • Pipeline finished with Canceled
    2 months ago
    Total: 329s
    #287037
  • Pipeline finished with Failed
    2 months ago
    Total: 423s
    #287042
  • Status changed to Needs review 2 months ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    The pipeline failure seems unrelated, which happened in this issue before already, so the best solution to that is to wait for another commit to 11.x that fixes the issue and then update the fork.
    Until then, this issue can go back to review as all current issues have been resolved.

  • Status changed to Needs work 2 months ago
  • 🇺🇸United States smustgrave

    Gave another round of reviews.

    To get this ready for usability tagging for screenshots to be added to the issue summary so they can easily see the change.

  • Pipeline finished with Success
    about 2 months ago
    Total: 737s
    #291042
  • 🇩🇪Germany lrwebks Porta Westfalica
  • Pipeline finished with Success
    about 2 months ago
    Total: 436s
    #291074
  • 🇩🇪Germany Grevil

    @lrwebks can you add screenshots like @smustgrave asked for?

  • 🇩🇪Germany lrwebks Porta Westfalica

    Here is a screenshot of the new ban admin UI:

    And here is the "Delete Multiple" confirmation form:

    For easy viewing I have also added the screenshots to the issue summary.

  • 🇩🇪Germany Grevil

    Nice! Added 3 more comments!

  • Pipeline finished with Failed
    about 2 months ago
    Total: 568s
    #296684
  • 🇩🇪Germany lrwebks Porta Westfalica
  • Pipeline finished with Success
    about 2 months ago
    Total: 484s
    #296715
  • 🇩🇪Germany Grevil

    Back to "Needs work" based on @anybody's last comment.

  • 🇩🇪Germany lrwebks Porta Westfalica
  • Pipeline finished with Failed
    about 2 months ago
    Total: 112s
    #296834
  • Pipeline finished with Success
    about 2 months ago
    Total: 3260s
    #296843
  • 🇩🇪Germany Grevil

    LGTM! Pipeline green! 😁👍

  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇩🇪Germany Anybody Porta Westfalica

    @LRWebks: The bot reports:

    Running PHPStan on changed files.
    ------ -----------------------------------------------------------------------
    Line src/Form/BanDeleteMultiple.php
    ------ -----------------------------------------------------------------------
    45 Method Drupal\ban\Form\BanDeleteMultiple::create() has no return type
    specified.
    ------ -----------------------------------------------------------------------

    [ERROR] Found 1 error

    Is that correct and can you fix it?

  • First commit to issue fork.
  • Pipeline finished with Success
    about 1 month ago
    Total: 1612s
    #309951
  • 🇮🇳India mrinalini9 New Delhi

    Hi,

    I was getting below error while ran PHPStan on file (core/modules/ban/src/Form/BanDeleteMultiple.php) instead of the error mentioned on #39:

    vendor/bin/phpstan analyse core/modules/ban/src/Form/BanDeleteMultiple.php
    1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

    ------ -----------------------------------------------------------------------------------
    Line BanDeleteMultiple.php
    ------ -----------------------------------------------------------------------------------
    46 Unsafe usage of new static().
    💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    ------ -----------------------------------------------------------------------------------

    [ERROR] Found 1 error

    I have fixed this error and have updated MR, please review it.

    Thanks & Regards,
    Mrinalini

  • 🇩🇪Germany Anybody Porta Westfalica

    @mrinalini9 thanks, but the class needs to be final then, read https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static

  • Pipeline finished with Success
    about 1 month ago
    Total: 664s
    #310069
  • 🇮🇳India mrinalini9 New Delhi

    Hi,

    I have made the class final, please review it.

    Thanks!

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks, back to RTBC.
    Screenshots were provided in #32, so I'm removing that tag.

  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Pipeline finished with Success
    about 1 month ago
    Total: 1173s
    #312252
  • 🇮🇳India mrinalini9 New Delhi

    Fixed PHPStan issues reported by bot in #45, please review it.

    Thanks!

  • 🇺🇸United States smustgrave

    Screenshots of the current UI isn't an actual section of the summary. Before/after screenshots should go under User interface changes to help the usability team.

    Since that section seems to be current UI there appears to be no after in the summary.

    Also taking for a CR for the change in workflow/new service.

    Will still need usability sign off before RTBC.

  • 🇩🇪Germany lrwebks Porta Westfalica
  • 🇩🇪Germany Grevil

    @lrwebks can you create a CR (change record) as well, as @smustgrave suggested? There is a link in the sidebar, which leads you to the CR creation, or you can go there directly, through https://www.drupal.org/node/add/changenotice?field_project=3060&field_is...

  • 🇩🇪Germany lrwebks Porta Westfalica

    Added the CR! Now we are left with the Usability Signoff.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @LRWebks! Needs usability review left now.

  • Pipeline finished with Failed
    3 days ago
    Total: 510s
    #341935
  • Issue was unassigned.
  • 🇩🇪Germany lrwebks Porta Westfalica
  • 🇳🇿New Zealand quietone

    The Ban Module was approved for removal in 📌 [Policy] Deprecate Ban module in Drupal 10 and move it to contrib for Drupal 11 Active .

    This remains Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

    The deprecation work is in 🌱 Deprecate Ban module Active and the removal work in 📌 [12.x] [Meta] Tasks to remove Ban module Postponed .

    Ban will be moved to a contributed project after the Drupal 12.x branch is open.

Production build 0.71.5 2024