From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 16DF5469719 for ; Thu, 20 Feb 2020 13:52:44 +0300 (MSK) Date: Thu, 20 Feb 2020 13:47:24 +0300 From: Igor Munkin Message-ID: <20200220104724.GA404@tarantool.org> References: <1582130122.751366742@f143.i.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1582130122.751366742@f143.i.mail.ru> Subject: Re: [Tarantool-patches] [PATCH] box: user.grant error should be versatile List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Maria Khaydich Cc: tarantool-patches , Vladislav Shpilevoy Masha, Thanks for the patch. It LGTM except the one minor comment below. On 19.02.20, Maria Khaydich wrote: > > Error message on granted privileges was not flexible and > did not distinguish between universal or any other priviliges > leaving either 'nil' or simply '' at the end. >   > Closes #714 > ---------------------------------------------------------------------- > Issue: > https://github.com/tarantool/tarantool/issues/714   > Branch: > https://github.com/tarantool/tarantool/tree/eljashm/gh-714-box-schema-user-grant-invalid-error   >   >  src/box/errcode.h        |  2 +- >  src/box/lua/schema.lua   |  3 +++ >  test/box/access.result   | 30 ++++++++++++++++++++++++++++-- >  test/box/access.test.lua | 14 ++++++++++++++ >  4 files changed, 46 insertions(+), 3 deletions(-) >   > diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua > index 50c96a335..228f8798a 100644 > --- a/src/box/lua/schema.lua > +++ b/src/box/lua/schema.lua > @@ -2408,6 +2408,9 @@ local function grant(uid, name, privilege, object_type, >                 privilege == 'execute' then >                  box.error(box.error.ROLE_GRANTED, name, object_name) >              else > +                if object_type ~= 'universe' then > +                    object_name = ' \''..object_name..'\'' Minor: the way you build the resulting error string seems to be inconvenient to me. Please consider the following and choose the one you guess fits more: | object_name = " '" .. object_name .. "'" or | object name = string.format(" '%s'", object_name) > +                end >                  box.error(box.error.PRIV_GRANTED, name, privilege, >                            object_type, object_name) >              end >   > --  > 2.24.0 >   > -- > Maria Khaydich -- Best regards, IM