示例#1
0
def delete_properties(request):
    response = {'status': -1}

    api = NavigatorApi(request.user)
    entity_id = json.loads(request.POST.get('id', ''))
    keys = json.loads(request.POST.get('keys', []))

    is_allowed = request.user.has_hue_permission(action='write',
                                                 app='metadata')

    request.audit = {
        'allowed': is_allowed,
        'operation': 'NAVIGATOR_DELETE_PROPERTIES',
        'operationText':
        'Deleting property %s of entity %s' % (keys, entity_id)
    }

    if not entity_id or not keys or not isinstance(keys, list):
        response['error'] = _(
            "update_properties requires an 'id' parameter and 'keys' parameter that is a non-empty list"
        )
    else:
        response['entity'] = api.delete_properties(entity_id, keys)
        response['status'] = 0

    return JsonResponse(response)
示例#2
0
def delete_properties(request):
  response = {'status': -1}

  api = NavigatorApi()
  entity_id = json.loads(request.POST.get('id', ''))
  keys = json.loads(request.POST.get('keys', []))

  if not entity_id or not keys or not isinstance(keys, list):
    response['error'] = _("update_properties requires an 'id' parameter and 'keys' parameter that is a non-empty list")
  else:
    response['entity'] = api.delete_properties(entity_id, keys)
    response['status'] = 0

  return JsonResponse(response)
示例#3
0
def delete_properties(request):
  response = {'status': -1}

  api = NavigatorApi()
  entity_id = json.loads(request.POST.get('id', ''))
  keys = json.loads(request.POST.get('keys', []))

  if not entity_id or not keys or not isinstance(keys, list):
    response['error'] = _("update_properties requires an 'id' parameter and 'keys' parameter that is a non-empty list")
  else:
    response['entity'] = api.delete_properties(entity_id, keys)
    response['status'] = 0

  return JsonResponse(response)