Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: Maria Khaydich <maria.khaydich@tarantool.org>
Cc: tarantool-patches <tarantool-patches@dev.tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH] box: user.grant error should be versatile
Date: Thu, 20 Feb 2020 13:47:24 +0300	[thread overview]
Message-ID: <20200220104724.GA404@tarantool.org> (raw)
In-Reply-To: <1582130122.751366742@f143.i.mail.ru>

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(-)
>  

<snipped>

> 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
>  

<snipped>

> -- 
> 2.24.0
>  
> --
> Maria Khaydich

-- 
Best regards,
IM

  reply	other threads:[~2020-02-20 10:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 16:35 Maria Khaydich
2020-02-20 10:47 ` Igor Munkin [this message]
2020-02-20 15:48   ` Maria Khaydich
2020-02-20 22:44 ` Vladislav Shpilevoy
2020-02-20 22:45   ` Vladislav Shpilevoy
2020-02-24 19:57     ` Kirill Yukhin
2020-02-25 11:53     ` Maria Khaydich
2020-02-25 22:20 ` Kirill Yukhin
2020-02-26 14:21   ` Maria Khaydich
2020-02-26 14:55     ` Igor Munkin
2020-02-26 15:16       ` Alexander Tikhonov
2020-02-27 14:30     ` Igor Munkin
2020-02-27 21:06       ` Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200220104724.GA404@tarantool.org \
    --to=imun@tarantool.org \
    --cc=maria.khaydich@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] box: user.grant error should be versatile' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox