From nobody Sun Dec 22 14:22:46 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556795893; cv=none; d=zoho.com; s=zohoarc; b=eMKCRbTcpUpyDVAd0Q+sC3oOo08/eHmwYl23x7UlO+VReTTflfwG2oEIv+xihK5hesOMhX2xoGYyCyn7SQxo3cDYg1ZA+j3CLsxf4y5CPutzTxE0SQQRqXWLDCAnqVc7ceAPvrCP11Rgr6AkNByHREDP9SNpvW2Cd3m7bov/7B0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556795893; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DxOZsVwUemIJ5fHMoHKSaVGLt2jzylY4r2JGwgOkhbo=; b=ev63LIXnShKoUTccPoC4zxCZbQT1f9mEcDkMLqZCj4Jt2sTJBcvAv1hQMFzOyOoNfqJel0Awd+xE9cinjPIYJjJtaMu8eCECJ9ssuBcwhsPRA1gwoEtgMkA84pdqGCiYu4RAxcUtoAVB5/epbPTT1TyfYDO0cluUk9hiAYHKW7M= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1556795893381478.82692922610977; Thu, 2 May 2019 04:18:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D95283099FE3; Thu, 2 May 2019 11:18:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEDA58ADAA; Thu, 2 May 2019 11:18:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BFF6141F3D; Thu, 2 May 2019 11:18:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x42BIAt2008917 for ; Thu, 2 May 2019 07:18:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 032F15DA35; Thu, 2 May 2019 11:18:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F27975DA34 for ; Thu, 2 May 2019 11:18:07 +0000 (UTC) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A01E7C058CB4 for ; Thu, 2 May 2019 11:18:06 +0000 (UTC) Received: by mail-oi1-f171.google.com with SMTP id t189so1277055oih.12 for ; Thu, 02 May 2019 04:18:06 -0700 (PDT) Received: from localhost.localdomain ([198.59.53.9]) by smtp.gmail.com with ESMTPSA id o1sm19095697otj.11.2019.05.02.04.18.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 04:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qELwC6ud+IXgGkmmgoYHp+SpyCvRSVl/jDwKyochCyw=; b=u5qaAIFoHg/HdUHPKm4Djf8IfhsGGaJ155SUcHLTuyt8dwjVOCwp4+wiPIMBzWdfB2 +vKQOCdKm0nNmwrQ6VnTHNFpv4ziHIYmAfzBTT1sfZYvGzdrkKLBMDX1zixNycMZMhZ1 ltkobrgOcbRZrxNB/ZxXSnLnPZyVn4Ov9ELeC4A+ZePO/RfNA5oKbk7R/e9QjfDtZ23l +SLSdNCxKNCjJZVPuWZggjBbpHJyX/7KjrfVyu1xw8OyOdgoUx1tGcsL5+kFbfOpSPOH PucJXkLHvJxb/Joe2xuzhCTcXSFaIZIs7ts37LDV7J55ynhR8PNXedRajHGRdiT1YzJZ /pnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qELwC6ud+IXgGkmmgoYHp+SpyCvRSVl/jDwKyochCyw=; b=XSVfyF8oA09IXz432hdzkpKX3oYNq2pWZHiS+IQajSaE7WXiM2FJKUHi3N3J4AYkff MzFbf77MS4fsWjF1N1JLtduXRsZsafxvi0wGCbeR5tDG+cPNYuAqSuXPG2T/rGpl4hzf F7vyhWxkYi8QJGR8/o6F5SUT9TGpwOPHdIRIL5BL3dBfNshbswP8+Otyp9r9ykJXvYlp LreGU58CtjaxrVtvDooPCw638pwS1RPUL2zzMWUIbA3Sha99dcb1AEo2RgcdDnmDL2i5 NTlgJkKOyR5EHSdPHvRpi5B4W/ikNcPDEUPaTZIJPhVIy/sz8g+elUeMQ1oxxivFpH56 Y01Q== X-Gm-Message-State: APjAAAW8mE2fHlXB3MO+Mz3TV2uy9/TUcaNSps4kJ6HOBkt+aPwXpz+B Lv9v+4lOV3kWz1q9FB4pbDoqpiv9mKI= X-Google-Smtp-Source: APXvYqwI3/125V4BPZXcC33h1yfAKCqeWkBaxQwEzS0N8R0l+NwvYAKIxXOmRjnb04r6FSJed37iRg== X-Received: by 2002:aca:550e:: with SMTP id j14mr1958069oib.41.1556795885792; Thu, 02 May 2019 04:18:05 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 2 May 2019 05:17:48 -0600 Message-Id: <20190502111804.15843-2-pbonzini@redhat.com> In-Reply-To: <20190502111804.15843-1-pbonzini@redhat.com> References: <20190502111804.15843-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 May 2019 11:18:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 May 2019 11:18:06 +0000 (UTC) for IP:'209.85.167.171' DOMAIN:'mail-oi1-f171.google.com' HELO:'mail-oi1-f171.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.125 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS, T_FILL_THIS_FORM_SHORT) 209.85.167.171 mail-oi1-f171.google.com 209.85.167.171 mail-oi1-f171.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 01/17] api, patchew-cli: remove commands to directly access properties X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 02 May 2019 11:18:11 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" set-properties was completely unused; get-project-properties was not needed for the Javascript interface, only for the "project property" command. The Django admin is enough if one needs that kind of fine-grained access. --- api/views.py | 23 -------------------- patchew-cli | 61 ---------------------------------------------------- 2 files changed, 84 deletions(-) diff --git a/api/views.py b/api/views.py index 48a3587..d323ba3 100644 --- a/api/views.py +++ b/api/views.py @@ -111,16 +111,6 @@ class AddProjectView(APILoginRequiredView): p.save() =20 =20 -class GetProjectPropertiesView(APILoginRequiredView): - name =3D "get-project-properties" - - def handle(self, request, project): - po =3D Project.objects.get(name=3Dproject) - if not po.maintained_by(request.user): - raise PermissionDenied("Access denied to this project") - return po.get_properties() - - class UpdateProjectHeadView(APILoginRequiredView): name =3D "update-project-head" allowed_groups =3D ["importers"] @@ -135,19 +125,6 @@ class UpdateProjectHeadView(APILoginRequiredView): return ret =20 =20 -class SetPropertyView(APILoginRequiredView): - name =3D "set-properties" - allowed_groups =3D ["importers"] - - def handle(self, request, project, message_id, properties): - mo =3D Message.objects.filter(project__name=3Dproject, - message_id=3Dmessage_id).first() - if not mo: - raise Http404("Message not found") - for k, v in properties.items(): - mo.set_property(k, v) - - class SetProjectPropertiesView(APILoginRequiredView): name =3D "set-project-properties" allowed_groups =3D ["maintainers"] diff --git a/patchew-cli b/patchew-cli index 7fa7d49..efc6f13 100755 --- a/patchew-cli +++ b/patchew-cli @@ -346,42 +346,10 @@ class ProjectCommand(SubCommand): finally: shutil.rmtree(wd) =20 - def project_property(self, argv): - parser =3D argparse.ArgumentParser() - parser.add_argument("name", help=3D"Name of the project") - parser.add_argument("prop", nargs=3D"?", help=3D"Name of the prope= rty") - parser.add_argument("--delete", "-d", action=3D"store_true", - help=3D"""delete the property with the given n= ame. - Must give a property name""") - parser.add_argument("value", nargs=3D"?", help=3D"Value of the pro= perty to set") - args =3D parser.parse_args(argv) - if not args.value and not args.delete: - # Get property and print them or the specified one - r =3D self.api_do("get-project-properties", - project=3Dargs.name) - if not args.prop: - for k, v in iter(r.items()) if r else []: - print(k, v) - else: - if r and args.prop in r: - print(args.prop, r[args.prop]) - else: - print("Property Not found:", args.prop) - if r and list(r.keys()): - print("There are:", ", ".join(list(r.keys()))) - else: - if args.delete: - args.value =3D None - # Set property - self.api_do("set-project-properties", project=3Dargs.name, - properties=3D{args.prop: args.value}) - def do(self, args, argv): if argv: if argv[0] =3D=3D "add": return self.add_project(argv[1:]) - elif argv[0] =3D=3D "property": - return self.project_property(argv[1:]) elif argv[0] =3D=3D "info": return self.show_project(argv[1:]) elif argv[0] =3D=3D "update": @@ -420,35 +388,6 @@ class UntestCommand(SubCommand): self.api_do("untest", terms=3Dargs.term) return 0 =20 -class SetPropertyCommand(SubCommand): - name =3D "set-property" - want_argv =3D True - - def arguments(self, parser): - parser.add_argument("--project", "-p", required=3DTrue, - help=3D"Project name") - parser.add_argument("--message-id", "-m", required=3DTrue, - help=3D"Project name") - parser.add_argument("--file", action=3D"store_true", - help=3D"Read property values from given file") - parser.add_argument("--json", action=3D"store_true", - help=3D"Read property values as json") - - def do(self, args, argv): - if not argv: - return 0 - if len(argv) % 2: - print("Name and value unpaired:", argv[-1]) - props =3D dict(list(zip(argv[::2], argv[1::2]))) - if args.file: - props =3D dict([(k, open(v, "r").read()) for k, v in props.ite= ms()]) - if args.json: - props =3D dict([(k, json.loads(v)) for k, v in props.items()]) - self.api_do("set-properties", project=3Dargs.project, - message_id=3Dargs.message_id, - properties=3Dprops) - return 0 - class TesterCommand(SubCommand): name =3D "tester" want_argv =3D True --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel