Prestashop: Disable maintenance mode for BO-logged in users

Created on 1 May 2020  ·  9Comments  ·  Source: PrestaShop/PrestaShop

Is your feature request related to a problem?

It's annoying to add ip addresses to exceptions every day/hour my public ip changes.

Describe the solution you'd like

It would be good to automatically show FO to users, that are logged in BO.

Or add it as an option - “Enable store for logged in employees”.

Specifications

https://github.com/PrestaShop/prestashop-specs/pull/183/files

BO Developer Feature Improvement Maintenance PM ✔️ To Do

Most helpful comment

@LouiseBonnard Everything is possible.
We can add a checkbox and I think the @Hlavtox fix is right, there is nothing complicated here :)

All 9 comments

Thanks for opening this issue! We will help you to keep its state consistent

Right !

Hi @Hlavtox, thanks for this nice improvement idea! It is because you have dynamic IP addresses, right?

@PrestaShop/prestashop-core-developers, would it be possible to enable the same profile's different IP addresses to access the front office when a store is in maintenance?

@LouiseBonnard Yes, it's using IPv6 and changing all the time...

  1. We could add a checkbox to Maintenance settings:

"Enable store for logged in employees" / "This setting will automatically display the store to logged in employees, even if the shop is in maintenance mode".
This checkbox would change a config value of, for example, PS_MAINTENANCE_ALLOW_EMPLOYEES

  1. We could do something like following in classes/controller/FrontController::displayMaintenancePage:
// If employee is logged in and it's allowed to let them in.
if (isset($this->context->employee) && Configuration::get('PS_MAINTENANCE_ALLOW_EMPLOYEES') === true) {
  return;
}

@LouiseBonnard Everything is possible.
We can add a checkbox and I think the @Hlavtox fix is right, there is nothing complicated here :)

@PierreRambaud I tried it and it could not be done this way, unfortuantely. :(

$this->context->employee is empty when accessing it in that file...

@PierreRambaud I tried it and it could not be done this way, unfortuantely. :(

$this->context->employee is empty when accessing it in that file...

I'm sure it's not complicated, the employee is not available when we are outside the admin directory, but we can change id if needed.

@PierreRambaud If it's not complicated, good.

BUT, we need to be careful when we do it, because there are some pieces in the code that detect if it's BO or FO by this variable if (isset($this->context->employee)). I had a module that added empty Employee object to $this->context->employee and it fucked up half of the system, payment modules didn't work etc... 😄

@PierreRambaud If it's not complicated, good.

BUT, we need to be careful when we do it, because there are some pieces in the code that detect if it's BO or FO by this variable if (isset($this->context->employee)). I had a module that added empty Employee object to $this->context->employee and it fucked up half of the system, payment modules didn't work etc...

:scream: Ok so it's maybe not a good first issue :sweat:

Was this page helpful?
0 / 5 - 0 ratings