Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 590491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:32:07+00:00 2026-05-13T15:32:07+00:00

Good morning, for an existing web application I need to implement time based login

  • 0

Good morning,

for an existing web application I need to implement “time based login constraints”. It means that for each user, later maybe each group, I can define timeslots when they are (not) allowed to log in into the system. As all data for the application is stored in database tables, I need to somehow create a way to model this idea in that way.

My first approach, I will try to explain it here:

  • Create a tree of login constraints (called “timeslots”) with the main “categories”, like “workday”, “weekend”, “public holiday”, etc. on the top level, which are in a “sorted” order (meaning “public holiday” has a higher priority than “weekday”)
  • for each top level node create subnodes, which have a finer timespan, like “monday”, “tuesday”, …
  • below that, create an “hour” level: 0, 1, 2, …, 23. No further details are necessary.
  • set every member to “allowed” by default
  • For every member of the system create a 1:n relationship member:timeslots which defines constraints, e.g. a member A may have A:monday-forbidden and A:tuesday-forbidden
  • Do a depth-first search at every login and check if the member has a constraint.
    Why a depth first search? Well, I thought that it may be that a member has the rules:

A:monday->forbidden, A:monday-10->allowed, A:mondey-11->allowed

So a login on monday at 12:30 would fail, but one at 10:30 succeed.

For performance reasons I could break the relational database paradigm and set a flag for every entry in the member-to-timeslots-table which is set to true if the member has information set for “finer” timeslots, but that’s a second step.

Is this model in principle a good idea? Are there existing models?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:32:07+00:00Added an answer on May 13, 2026 at 3:32 pm

    Wow. That sounds way more complicated than I’d want to deal with. I’d just create a table like this:

    Allowed_Login_Times

    • Weekday_Start
    • Weekday_End
    • Saturday_Start
    • Satruday_End
    • Sunday_Start
    • Sunday_End
    • Holiday_Start
    • Holiday_End

    Each column would be an int from 0 to 23 representing the hour.

    I’d let the application decide what hour it was and which column should be checked.

    Your solution is more flexible, but I can’t imagine trying to create an admin GUI to maintain the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning! I Have an issue with a wysiwyg editor that saves html to
Good morning. I have several pages with content that correspond to some products details.
Good morning SO, I have a class that contains the following static array: public
Good morning, I'm learning MVC using the music store examples on the www.asp.net/mvc page,
I hope you have a good morning. I'd like to use jqGrid in my
Good Morning everyone I'm currently facing a segfault at random on a little piece
good morning, I have created a new content type - petition, a last step
Good Morning, I wrote the code block below on my local Windows 7 PC
Good Morning All, I have created a different background and a few other images
Good Morning All, I'm trying to refactor an SQL stored procedure. I'm no SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.