Hourly access control

Good day.
Any ideas to block access to the platform during a certain time slot?
For example, I require that users cannot log in at night and early morning, only during the day.

hello. before begining i must say . i m not prof about developement software etc. but about your questions i have idea, you can add some bash script for stop and start tomcat. its ll solve your problem easy way. i mean , for example stop tomcat at 23 00 and one more start tomcat 08 00 etc.

this example for restart but you can modify this for you.

other way, i saw on user details page, there is controls user active or deactive dates. maybe you can change someting on there but for this you must know java… this way more complex and more managable. with this way you can say to user, you can acces from 09 00 to 17 00 and for otfer user can accces all day etc

if you will find other way. pls inform me also… and if i made mistakes about my solitions pls also say me… i want to know and learn


Here is the technical solution which needs some customized development. Event observer can be used to achieve this requirement. You can refer it in details from Events :: Axelor Documentation.

Need to observe PreLogin event and specify your criteria using if conditions and if it’s satisfied you can throw an exception which will prevent the your login for those criteria.

Some code snippet for reference :

import com.axelor.apps.base.AxelorException;
import com.axelor.event.Observes;
import com.axelor.events.PreLogin;
import com.google.inject.servlet.RequestScoped;

public class LoginObserver {

  void preLogin(@Observes PreLogin event) throws AxelorException {

    if (<YOUR_CONDITIONS>) {
      throw new AxelorException(
          "Authentication error");

*replace <YOUR_CONDITIONS> with your criteria
*Need to configure LoginObserver class in AxelorModule (Example : Services & Controllers :: Axelor Documentation)


Hope this will be helpful

Thank you

2 « J'aime »

thanks…lo probare

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.