Add some more logging
This commit is contained in:
parent
73ee8bd535
commit
ade9a23d85
|
|
@ -3,8 +3,10 @@ import re
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from api.utils import get_object
|
from api.utils import get_object
|
||||||
|
from core.logger import get_logger
|
||||||
from users.models import SchoolClass
|
from users.models import SchoolClass
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
def set_hidden_for(block, visibility_list):
|
def set_hidden_for(block, visibility_list):
|
||||||
for v in visibility_list:
|
for v in visibility_list:
|
||||||
|
|
@ -29,22 +31,27 @@ def is_private_api_call_allowed(user, body):
|
||||||
# logged in users without valid license have only access to logout, me & coupon mutations
|
# logged in users without valid license have only access to logout, me & coupon mutations
|
||||||
|
|
||||||
if user.is_anonymous:
|
if user.is_anonymous:
|
||||||
|
logger.debug('User is anonymous')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if user.is_superuser:
|
if user.is_superuser:
|
||||||
|
logger.debug('User is superuser')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
body_unicode = body.decode('utf-8')
|
body_unicode = body.decode('utf-8')
|
||||||
|
|
||||||
if is_endpoint_allowed(body_unicode):
|
if is_endpoint_allowed(body_unicode):
|
||||||
|
logger.debug('Endpoint allowed')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
license_expiry = user.license_expiry_date
|
license_expiry = user.license_expiry_date
|
||||||
|
|
||||||
# all other resources are denied if the license is not valid
|
# all other resources are denied if the license is not valid
|
||||||
if license_expiry is None:
|
if license_expiry is None:
|
||||||
|
logger.debug('license expiry is None')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
logger.debug('private api call is allowed')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue