def assert_request_user_has_resource_api_permission(request, resource_api, permission_type):
 has_permission = request_user_has_resource_api_permission(request=request, resource_api=resource_api, permission_type=permission_type)
 if (not has_permission):
  user_db = get_user_db_from_request(request=request)
  raise ResourceAccessDeniedError(user_db=user_db, resource_db=resource_api, permission_type=permission_type)

def assert_request_user_has_resource_api_permission ( request , resource_api , permission_type ) : has_permission = request_user_has_resource_api_permission ( request = request , resource_api = resource_api , permission_type = permission_type ) if ( not has_permission ) : user_db = get_user_db_from_request ( request = request ) raise ResourceAccessDeniedError ( user_db = user_db , resource_db = resource_api , permission_type = permission_type )
check that currently logged-in user has specified permission for the resource which is to be created .