Hi all,

I'm preparing a patch to consolidate some duplicate code in
sentry-provider-db, and have a question:

CommandUtil.convertToTSentryPrivilege:

https://github.com/apache/sentry/blob/186e75543a23f286e24c56f73859099405b7b73a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/tools/command/hive/CommandUtil.java#L38

is identical to SentryServiceUtil.convertToTSentryPrivilege:

https://github.com/apache/sentry/blob/186e75543a23f286e24c56f73859099405b7b73a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java#L56

apart from two differences:

a) The CommandUtil version sets:
tSentryPrivilege.setAction(AccessConstants.ALL); for the
PRIVILEGE_URI_NAME case.
b) The CommandUtil version "validates" the privilege hierarchy, throwing an
exception if one of the names is not specified.

Ideally I'd like to remove CommandUtil altogether and just reference the
methods in SentryServiceUtil. Should these extra pieces also be in
SentryServiceUtil? Or is there a reason that they are different?

Colm.


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Reply via email to