From nobody Tue Jul 1 09:25:29 2025 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=1555495802; cv=none; d=zoho.com; s=zohoarc; b=etJ3IILyOyrfSXvN86i4RgqciAYB3SLh2NMT1HpgIzeuAO9E0jPBJ0GO7aVijTBcwgz4Wtjto2X2eYXs+CmSkGH5A18E49G4wKd5OzxTp6Qw3AW31IMJLEm7R0LAKR7DyE3Qg5ovaQNd9sKSVTPwZbUlpPv+HOvS1nctqxQiZuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555495802; 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=FdmTRpHLRzNUZcbHUMl2wp0y/ix3ON8Sw5Zogf8zESx7VDWNbeazrdGeZQNI7CSV5kXeDdlCri25TkP30a3x8x11Iek67ejwTPAtHQQG+cP4dUqNqD6tpQ/iPSbKV0YALN4+wgnyoRzoMZVlG3XeWMKATAPgBPRvslUiQ+eiDRo= 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 1555495802502541.5330051551384; Wed, 17 Apr 2019 03:10:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C46D3092673; Wed, 17 Apr 2019 10:10:01 +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 3F2FD1001E8C; Wed, 17 Apr 2019 10:10:01 +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 2EC3541F3D; Wed, 17 Apr 2019 10:10:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3HA9xiM013077 for ; Wed, 17 Apr 2019 06:09:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6516419C71; Wed, 17 Apr 2019 10:09:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EB9619C58 for ; Wed, 17 Apr 2019 10:09:56 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (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 D255536961 for ; Wed, 17 Apr 2019 10:09:55 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id y197so2871699wmd.0 for ; Wed, 17 Apr 2019 03:09:55 -0700 (PDT) Received: from donizetti.redhat.com ([2001:b07:6468:f312:ac27:aac4:c65c:6eb]) by smtp.gmail.com with ESMTPSA id c13sm4949719wrx.88.2019.04.17.03.09.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Apr 2019 03:09:53 -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=kWmWOmeeES43oCDmJwgUj9+pO5NzbuOQCOXENAsWMh1w/DoDjv+00Xd9NI7RkqRAr8 NUPk+V8yoLhy+p7Bd2Z3S0H8pnLR9KekI2yzLF45jv5VNjYPKE5FCi5kvdWov8KyRabB ouKqkAzxx+PnSE6RKnlfOPB6kdIA3cnLANy/BdkdX9Smq1r0jHMcqLSOSBsa8sCxmLBE sN9KkdDAljsQ47hUgprbch2iJ2k9kmFrtFHrJNJu1CFnP6UqGTR0WInIZ9qwKkcLfCEQ LoRjMy4V+1EPNRa0yawS8iLxr94ciux+nab9K3mHbhufdjycEoSHfyE3K2szbWRb/3Vk Ahvw== 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=p3Zg7fhtEXxQSLlKNh+SEYYmyIF8pLhHQxxu9SBvi2yBJe22KxOyuBYLubHL5c9JtL gEaH+y9tR+93vlj/0ydqXOxdbzE8WcFMeUTW+WKld6z2ySyBCaeq4gvuMGUhBS7PppRj c+MjkZR0RN16qj2aNt0WE9pC6mOwMWXUCr6e2dAmLdfDx/EeuLR8a6vu1lO0GAOmyp4A G01R4zt+OJ79EU8RonzMNHS3LAdiz3knDe0ZBLZcmdJ0uCMdhmVxMAdP5nj9/cefFTlO /hFi32CRsIzB2gg6BzqZDMBPfkIo8s273f3+8mvjT3KfPpuE5f0uNB5EZah37fD/hSv2 81rg== X-Gm-Message-State: APjAAAXmCGHhSNa4Twa8WWDrM8o1dHUCe7dIDckhKx2aCrA8+YO3uW1a JzlFCnMMmSSzGf0AeqJKVFUy4qsb X-Google-Smtp-Source: APXvYqxxMQAxyu8IZHRHxNJjlPoB92TRlXGqzAS7l3IpFzooskvSB5X/vygMSeas+Y2exEJlcvnXVw== X-Received: by 2002:a1c:7f10:: with SMTP id a16mr31333864wmd.30.1555495794267; Wed, 17 Apr 2019 03:09:54 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Wed, 17 Apr 2019 12:09:45 +0200 Message-Id: <20190417100948.8810-5-pbonzini@redhat.com> In-Reply-To: <20190417100948.8810-1-pbonzini@redhat.com> References: <20190417100948.8810-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.30]); Wed, 17 Apr 2019 10:09:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 17 Apr 2019 10:09:56 +0000 (UTC) for IP:'209.85.128.68' DOMAIN:'mail-wm1-f68.google.com' HELO:'mail-wm1-f68.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.244 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_FILL_THIS_FORM_SHORT) 209.85.128.68 mail-wm1-f68.google.com 209.85.128.68 mail-wm1-f68.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 4/7] 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 17 Apr 2019 10:10:01 +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