Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
restrict_ip
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
restrict_ip
Commits
30feb23d
Commit
30feb23d
authored
4 months ago
by
Stephen Mustgrave
Browse files
Options
Downloads
Plain Diff
Merge branch '3391850-drush-command-to' into '5.0.x'
Issue
#3391850
by paul_leclerc, anybody: Drush command to disable restrict_ip See merge request
!28
parents
16e00c4b
2d64a013
No related branches found
No related tags found
No related merge requests found
Pipeline
#378035
passed with warnings
4 months ago
Stage: build
Stage: validate
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+8
-0
8 additions, 0 deletions
README.md
restrict_ip.services.yml
+5
-0
5 additions, 0 deletions
restrict_ip.services.yml
src/Drush/Commands/RestrictIpCommands.php
+28
-0
28 additions, 0 deletions
src/Drush/Commands/RestrictIpCommands.php
with
41 additions
and
0 deletions
README.md
+
8
−
0
View file @
30feb23d
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
*
About
*
About
*
Installation
*
Installation
*
Configuration
*
Configuration
*
Drush commands
*
Modules that expand on restrict IP
*
Questions and Answers
*
Questions and Answers
*
Support
*
Support
...
@@ -34,6 +36,12 @@ $config['restrict_ip.settings']['ip_whitelist'] = [
...
@@ -34,6 +36,12 @@ $config['restrict_ip.settings']['ip_whitelist'] = [
'111.111.111.2',
'111.111.111.2',
];
];
### Drush commands
If you don't have access/permissions on settings files, you can also use a restrict_ip drush command :
`drush ripd 1/0`
### Modules that expand on restrict IP
### Modules that expand on restrict IP
1.
[
IP-based Determination of a Visitor's Country
](
https://www.drupal.org/project/ip2country
)
1.
[
IP-based Determination of a Visitor's Country
](
https://www.drupal.org/project/ip2country
)
...
...
This diff is collapsed.
Click to expand it.
restrict_ip.services.yml
+
5
−
0
View file @
30feb23d
...
@@ -4,6 +4,11 @@ parameters:
...
@@ -4,6 +4,11 @@ parameters:
restrict_ip.event_subscriber.class
:
Drupal\restrict_ip\EventSubscriber\RestrictIpEventSubscriber
restrict_ip.event_subscriber.class
:
Drupal\restrict_ip\EventSubscriber\RestrictIpEventSubscriber
services
:
services
:
restrict_ip.commands
:
class
:
\Drupal\restrict_ip\Drush\Commands\RestrictIpCommands
tags
:
-
{
name
:
drush.command
}
restrict_ip.mapper
:
restrict_ip.mapper
:
class
:
Drupal\restrict_ip\Mapper\RestrictIpMapper
class
:
Drupal\restrict_ip\Mapper\RestrictIpMapper
arguments
:
arguments
:
...
...
This diff is collapsed.
Click to expand it.
src/Drush/Commands/RestrictIpCommands.php
0 → 100644
+
28
−
0
View file @
30feb23d
<?php
namespace
Drupal\restrict_ip\Drush\Commands
;
use
Drush\Commands\DrushCommands
;
final
class
RestrictIpCommands
extends
DrushCommands
{
/**
* Disable/Enable restrict_ip.
*
* @param string $disable
* 1/0
*
* @command restrict_ip:disable
* @aliases ripd
* @usage restrict_ip:disable off
*/
public
function
ipRestrictDisable
(
string
$disable
):
void
{
$configF
=
\Drupal
::
configFactory
();
$edit
=
$configF
->
getEditable
(
'restrict_ip.settings'
);
$edit
->
set
(
'enable'
,
(
boolean
)
$disable
);
$edit
->
save
();
$disableString
=
$disable
?
'enable'
:
'disable'
;
$this
->
logger
()
->
success
(
t
(
'restrict_ip '
.
$disableString
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment