From reviews-return-32424-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Wed Apr 27 09:10:16 2016 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D85D19A0E for ; Wed, 27 Apr 2016 09:10:16 +0000 (UTC) Received: (qmail 42098 invoked by uid 500); 27 Apr 2016 09:10:16 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 42070 invoked by uid 500); 27 Apr 2016 09:10:16 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 42054 invoked by uid 99); 27 Apr 2016 09:10:15 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2016 09:10:15 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 0B9902B3505; Wed, 27 Apr 2016 09:10:11 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============6839597802324417046==" MIME-Version: 1.0 Subject: Re: Review Request 46203: Added authorization of the '/flags' endpoint. From: Adam B To: Benjamin Bannier , Adam B , Alexander Rojas Cc: Jan Schlicht , Alexander Rukletsov , mesos Date: Wed, 27 Apr 2016 09:10:11 -0000 Message-ID: <20160427091011.26196.4590@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Adam B X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/46203/ X-Sender: Adam B References: <20160427082444.26196.5670@reviews.apache.org> In-Reply-To: <20160427082444.26196.5670@reviews.apache.org> X-ReviewBoard-Diff-For: src/tests/slave_authorization_tests.cpp Reply-To: Adam B X-ReviewRequest-Repository: mesos --===============6839597802324417046== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On April 27, 2016, 1:24 a.m., Alexander Rojas wrote: > > src/slave/http.cpp, line 798 > > > > > > This looks like a bad pattern here, you could use instead `slave->self().id == pathComponents[0]`. > > > > Remember that `!(p && q) == !p || !q`. It might improve readability in this expression. > > Jan Schlicht wrote: > `!(p && q)` is the more readable option here (compare rev 18 to rev 17), because I'd have to add an additional check if I'd want to do `!p || !q`. > > Adam B wrote: > Not true. Due to boolean short-circuiting, `if (pathComponents.size() != 2u)` (e.g. `0`), then we skip the second half of the `||` and go right to `return Failure`. Otherwise, `pathComponents.size() == 2u`, so it's ok to call `strings::startsWith(pathComponents[0], "slave(")`. > The `pathComponents.size() > 0` is unnecessary. FWIW, since it's the same number of lines, I prefer the `!p || !q` version, because it means I see the `!` on each line and don't have to guess about where the `!` ends. - Adam ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/46203/#review130731 ----------------------------------------------------------- On April 27, 2016, 1:54 a.m., Jan Schlicht wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/46203/ > ----------------------------------------------------------- > > (Updated April 27, 2016, 1:54 a.m.) > > > Review request for mesos, Adam B, Alexander Rojas, and Benjamin Bannier. > > > Bugs: MESOS-5142 > https://issues.apache.org/jira/browse/MESOS-5142 > > > Repository: mesos > > > Description > ------- > > See summary. > > > Diffs > ----- > > docs/configuration.md 2796a812b72f2089999b1ae2d65a4ba843b50d70 > include/mesos/authorizer/acls.proto c50deeb5565dfd5b3e5e7210283d9a36a3bfd579 > include/mesos/authorizer/authorizer.proto 40d93ea257d1df8d22eee8a21667db90d579a8fe > src/Makefile.am e024c6d65608a55765e527a8668c415723dcfcca > src/authorizer/local/authorizer.cpp 0a3805fe4ce8eb89e096e8cd4326035513ba892b > src/slave/flags.cpp a319d60c006d1104836c1c40f3617ceac9cb7b1e > src/slave/http.cpp 537736d1fe42e8150bad91326299ef9a17041a8e > src/slave/slave.hpp 57b18882e30e44dcc40449b0e3be8ee970c45bc8 > src/tests/slave_authorization_tests.cpp PRE-CREATION > > Diff: https://reviews.apache.org/r/46203/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Jan Schlicht > > --===============6839597802324417046==--