Browse Source

Merge pull request #7057 from jumpserver/pr@dev@acl_bug

fix: 修复acl 选择时间段为空bug
pull/7059/head
feng626 3 years ago committed by GitHub
parent
commit
705f352cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/common/utils/time_period.py

4
apps/common/utils/time_period.py

@ -10,6 +10,10 @@ def contains_time_period(time_periods):
current_time = local_now().strftime('%H:%M') current_time = local_now().strftime('%H:%M')
today_time_period = next(filter(lambda x: str(x['id']) == local_now().strftime("%w"), time_periods)) 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:
return False
for time in today_time_period['value'].split(''): for time in today_time_period['value'].split(''):
start, end = time.split('~') start, end = time.split('~')
end = "24:00" if end == "00:00" else end end = "24:00" if end == "00:00" else end

Loading…
Cancel
Save