mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-13 13:59:17 +00:00
perf: 登录资产的 ACL 支持 ip 控制 (#10581)
Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
from common.utils.timezone import local_now
|
||||
|
||||
|
||||
def contains_time_period(time_periods):
|
||||
def contains_time_period(time_periods, ctime=None):
|
||||
"""
|
||||
time_periods: [{"id": 1, "value": "00:00~07:30、10:00~13:00"}, {"id": 2, "value": "00:00~00:00"}]
|
||||
"""
|
||||
if not time_periods:
|
||||
return False
|
||||
return None
|
||||
|
||||
current_time = local_now().strftime('%H:%M')
|
||||
if ctime is None:
|
||||
ctime = local_now()
|
||||
current_time = ctime.strftime('%H:%M')
|
||||
today_time_period = next(filter(lambda x: str(x['id']) == local_now().strftime("%w"), time_periods))
|
||||
today_time_period = today_time_period['value']
|
||||
if not today_time_period:
|
||||
|
Reference in New Issue
Block a user