mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-03 17:08:47 +01:00 
			
		
		
		
	Check that permissions are working when accessing to API pages
Signed-off-by: Yohann D'ANELLO <yohann.danello@gmail.com>
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from functools import lru_cache
 | 
			
		||||
from time import time
 | 
			
		||||
 | 
			
		||||
@@ -38,6 +38,10 @@ def memoize(f):
 | 
			
		||||
 | 
			
		||||
        nonlocal last_collect
 | 
			
		||||
 | 
			
		||||
        if "test" in sys.argv:
 | 
			
		||||
            # In a test environment, don't memoize permissions
 | 
			
		||||
            return f(*args, **kwargs)
 | 
			
		||||
 | 
			
		||||
        if time() - last_collect > 60:
 | 
			
		||||
            # Clear cache
 | 
			
		||||
            collect()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user