Banned countries #50

Closed
opened 2026-07-14 10:03:22 +02:00 by alex · 1 comment
Owner

We should be able to block the website access to certain countries.
It will result in a forbidden access status.

Update the BanCheck controller concern

Create a new private method check_banned_country
In case of positive match:

      render plain: "Forbidden access.", status: :forbidden

Create a model BannedCountry

This model needs to be auditable.
We need to store:

  • the country_code : String
    • Format of the country code is ISO 3166-1 alpha-2: wikipedia
  • counter: Integer

Create a controller 'BannedCountriesController`

We need to be able to monitor the current banned countries for admin roles only.
3 actions :

  • create
  • index
  • destroy

Create views:

  • index
    • Should include searcher with country code
  • create

Create seeds

We can take as example RU

Create Test

Model

  • Creation, counter update, destroy

Controller

  • A none banned country
  • A banned country
We should be able to block the website access to certain countries. It will result in a `forbidden access` status. # Update the `BanCheck` controller concern Create a new private method `check_banned_country` In case of positive match: ```ruby render plain: "Forbidden access.", status: :forbidden ``` # Create a model `BannedCountry` This model needs to be `auditable`. We need to store: - the country_code : `String` - Format of the country code is `ISO 3166-1 alpha-2`: [wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) - counter: `Integer` # Create a controller 'BannedCountriesController` We need to be able to monitor the current banned countries for `admin` roles only. 3 actions : - create - index - destroy # Create views: - index - Should include searcher with country code - create # Create seeds We can take as example `RU` # Create Test ## Model - Creation, counter update, destroy ## Controller - A none banned country - A banned country
alex added this to the release/20260717 milestone 2026-07-14 10:03:22 +02:00
alex self-assigned this 2026-07-14 10:03:22 +02:00
alex stopped working 2026-07-14 11:50:35 +02:00
1 hour 47 minutes
alex stopped working 2026-07-14 15:53:39 +02:00
8 minutes 24 seconds
alex stopped working 2026-07-14 19:45:41 +02:00
1 hour 43 minutes
alex stopped working 2026-07-15 10:59:31 +02:00
1 hour 17 minutes
alex changed title from Banned country module to Banned countries module 2026-07-15 11:06:35 +02:00
alex changed title from Banned countries module to Banned countries 2026-07-15 11:06:51 +02:00
Author
Owner
## feature/banned-country-module
A  app/controllers/banned_countries_controller.rb
M  app/controllers/concerns/ban_check.rb
A  app/models/banned_country.rb
A  app/views/banned_countries/index.html.erb
A  app/views/banned_countries/new.html.erb
M  app/views/shared/_menu.html.erb
M  config/locales/activerecord/en.yml
M  config/locales/activerecord/fr.yml
A  config/locales/views/banned_countries/en.yml
A  config/locales/views/banned_countries/fr.yml
M  config/locales/views/shared/en.yml
M  config/locales/views/shared/fr.yml
M  config/routes.rb
A  db/migrate/20260714080404_create_banned_countries.rb
M  db/schema.rb
M  db/seeds.rb
A  test/controllers/banned_countries_controller_test.rb
A  test/fixtures/banned_countries.yml
A  test/models/banned_country_test.rb
```txt ## feature/banned-country-module A app/controllers/banned_countries_controller.rb M app/controllers/concerns/ban_check.rb A app/models/banned_country.rb A app/views/banned_countries/index.html.erb A app/views/banned_countries/new.html.erb M app/views/shared/_menu.html.erb M config/locales/activerecord/en.yml M config/locales/activerecord/fr.yml A config/locales/views/banned_countries/en.yml A config/locales/views/banned_countries/fr.yml M config/locales/views/shared/en.yml M config/locales/views/shared/fr.yml M config/routes.rb A db/migrate/20260714080404_create_banned_countries.rb M db/schema.rb M db/seeds.rb A test/controllers/banned_countries_controller_test.rb A test/fixtures/banned_countries.yml A test/models/banned_country_test.rb ```
alex closed this issue 2026-07-15 12:05:42 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 4 hours 56 minutes
alex
4 hours 56 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
as-consult/starterkit-8#50
No description provided.