From nobody Tue Apr 23 07:37:03 2024 Delivered-To: importer@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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522860876392672.3357767311162; Wed, 4 Apr 2018 09:54:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75F6EC057FAB; Wed, 4 Apr 2018 16:54:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5001184F6; Wed, 4 Apr 2018 16:54:35 +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 3891B1800C9E; Wed, 4 Apr 2018 16:54:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w34GsWEQ019455 for ; Wed, 4 Apr 2018 12:54:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id CE7D82C8C8; Wed, 4 Apr 2018 16:54:32 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C414D611AF for ; Wed, 4 Apr 2018 16:54:29 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (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 89C8D6147B for ; Wed, 4 Apr 2018 16:54:28 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id r131so44323207wmb.2 for ; Wed, 04 Apr 2018 09:54:28 -0700 (PDT) Received: from donizetti.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id n143sm5678392wmd.29.2018.04.04.09.54.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Apr 2018 09:54:26 -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; bh=4/uUE4+ToKYwl07donXMUHEvqSKAPsvk1r23iWWUpWQ=; b=jy9yaiLkR75rBctE7PgElaT7GMT6CWWnwfNDUrlMvHwzhRjirkEnOC5eT56bLejeNi aalrIjS6rXgD8IOnpHODzX52x0iLXCF0g7PGqBrGdNPwyxD4+CH5G7No81ciWT+I6muN HHYdwpKeJITRTOsivBtZEzWjmXJjTPD0+2VqGamFvGlctHXzJUzIP3kEbW0NVes5d4pn ydebwIJtp82QB4Q/H1wi4YiobBQLiD5NHFpFcDZ5X0FIvby2Fz0NRLUSQEnalgaXkudJ T1yiqaY7kPvuJ3K+/DMt6/BRj6/FcM3LvxfqswaaJ3yE44Pu+SEmOf3MTj/+++HmEKyb rVyw== 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; bh=4/uUE4+ToKYwl07donXMUHEvqSKAPsvk1r23iWWUpWQ=; b=lTE9IPvbw3ywMUMj1maCgQ+P1LkCC4S2i5KPN2mY7QFKy4TNV0321jHO8R0AnhuwYG UQk7eVsHsZe3bY6B/KC18CxsCqB9tDJwCOJvFnxq6k2dvBz5UQIFUCdpAQP494pw0VDQ 8Qh6NwBOZzvrzVsPNDM5ijY066vZQ5iHlXvgCDcb6gyyIqrKD0j8gmFMeSBZivlIbRht 9nj5fDIygVP2KkoWk4N26FAPB4X8VKwxDhs+U8Zb77yioi1uPfEemevndzcuhCDgBOC+ 6esJfh2ie2PzSe8mJ4JSz4F37Bv/hYIgVvkEWqy/NCy7y3gN/OPyRuDmRMg+Eq2avkBg +k0w== X-Gm-Message-State: AElRT7FoI/an6/sNNTATJ57IFdaN20py6dOgyyMuFua4LvgJ6v/zSglp ejFvSDDv27KqHQo7eGFKhp8mtKIs X-Google-Smtp-Source: AIpwx49U2srxeAUNJndBtJcCRH57faMXI1TABju8FzSIvG4DyrGkHaKVR0cYeyJ/o+e1gzt75iGivA== X-Received: by 10.28.106.17 with SMTP id f17mr8722104wmc.92.1522860866934; Wed, 04 Apr 2018 09:54:26 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Wed, 4 Apr 2018 18:54:10 +0200 Message-Id: <20180404165410.27070-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Apr 2018 16:54:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Apr 2018 16:54:28 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.469 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] rest: allow IsMaintainerOrReadOnly that applies to Message 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Apr 2018 16:54:35 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- I had to apply this for Shubham's patch to allow non-administrator access. api/rest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/rest.py b/api/rest.py index bb56b4b..3e0cbc3 100644 --- a/api/rest.py +++ b/api/rest.py @@ -41,6 +41,8 @@ class IsMaintainerOrReadOnly(permissions.BasePermission): Allows access only to admin users or maintainers. """ def has_object_permission(self, request, view, obj): + if isinstance(obj, Message): + obj =3D obj.project return request.method in permissions.SAFE_METHODS or \ obj.maintained_by(request.user) =20 --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel