Problem/Motivation

Steps to reproduce

If you want keep to use login_security,
you can not uninstall ban module if you choose to use advban module.

Proposed resolution

Add support for advban module.

Remaining tasks

...

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

steveoriol created an issue. See original summary.

anybody’s picture

Version: 2.0.0 » 2.x-dev
pearls’s picture

Is there any plan to support advban module?
Thanks

anybody’s picture

Status: Active » Postponed

I totally agree. Now that ban is also contrib, there should be only one ban module combining both. That would also fix the logical issues... guess it would make sense to discuss in the ban and advban module to join forces now!

Nothing good we can do about here, I think.

orkutmuratyilmaz’s picture

anybody’s picture

Status: Postponed » Active

Okay let's do it. Anyone willing to implement a MR?

https://www.drupal.org/project/crowdsec did similar and already supports both: #3553801: Remove dependency on ban module

I guess the implementation there can be used as template!

anybody’s picture

Title: require ban OR advban will be cool ;-) » Make ban dependency optional and alternatively allow advban
anybody’s picture

jiskra made their first commit to this issue’s fork.

jiskra’s picture

I updated the new Ban service with check Protected IP addresses for AdvBan module

jiskra’s picture

Status: Active » Needs review
anybody’s picture

Status: Needs review » Needs work

Thanks @jiskra That doesn't look bad, please see my comment.

Could we add some information to the README.md of the module to let users know one of both modules is needed?

Furthermore we should add a hook_requirements() check to ensure one of both dependencies is present?

klemendev’s picture

Any updates on this since 11.3 is out and marks core Ban module as deprecated?

lrwebks made their first commit to this issue’s fork.

lrwebks’s picture

Status: Needs work » Needs review

Fixed your two comments and added the README section, @anybody. Unfortunately, I cannot resolve the threads as I am not maintainer of this module.

anybody’s picture

Status: Needs review » Needs work

I left a comment. Please test accordingly with only one of the modules present.

anybody’s picture

Issue tags: +Needs manual testing
lrwebks’s picture

Status: Needs work » Needs review

I have tested the ban functionality with all combinations of modules:

  1. Ban: Works as expected
  2. AdvBan: Works as expected
  3. Both modules: Works as expected (prioritizes AdvBan over Ban)
  4. No modules: Breaks the site because of the exception thrown in getBanIpManager(), which is why I have surrounded all calls to it with a try block

So, it should be in a fully working condition now!

anybody’s picture

Status: Needs review » Needs work
klemendev’s picture

I agree that both modules should be optional

anybody’s picture

My point is: The end-user sees the exception, not the admin... that's the problem.

Then we need a setting to opt-in, which we could set to enabled by default using an update hook, but FALSE for new installations. On hook_install() we could then detect the setting.

lrwebks’s picture

Assigned: Unassigned » lrwebks

@anybody and I have come to a conclusion about how we want to handle this going forward. We will employ the use of hook_requirements to both prevent the module from installing if neither the Ban nor AdvBan modules are present, as well as showing a site status error when the Ban/AdvBan module is uninstalled later.

lrwebks’s picture

Assigned: lrwebks » Unassigned
Status: Needs work » Needs review
StatusFileSize
new31.5 KB
new45.81 KB

Implemented the hook and works as expected now. I will attach screenshots of the installation and status messages, respectively. The messages themselves are still a bit crudely formulated, though. If anyone has a better suggestion for the wording, go ahead!

The rest of the code (including the try blocks) is still necessary, of course, to cover the “uninstall AdvBan while keeping login security” case and not throw any errors in that situation but rather do nothing.

anybody’s picture

Status: Needs review » Needs work

@LRwebks: Some final points.

Re #21 and #23: Correct. Previously ban was a hard dependency and we'll keep the requirement of a ban module. Without that it makes things a lot more complicated and it's the core functionality. Not worth further edge-cases. If anyone REALLY needs it optional, a follow-up can be made by the person. But I don't see really good reasons.

lrwebks’s picture

Status: Needs work » Needs review
anybody’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs issue summary update, -Needs manual testing

Thanks @lrwebks let's do it!

anybody’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

anybody’s picture

Please note that RequirementSeverity was introduced in Drupal Core 11.2 so I had to revert that part of the change. See https://www.drupal.org/node/3410939

amjad1233’s picture

Hi Could this be a solution for site-installs ?

Status: Fixed » Closed (fixed)

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