You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "Hadoop QA (JIRA)" <ji...@apache.org> on 2016/12/08 10:18:58 UTC

[jira] [Commented] (SENTRY-1541) toSentryPrivilege() should not copy fields that are not set in the source

    [ https://issues.apache.org/jira/browse/SENTRY-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15731758#comment-15731758 ] 

Hadoop QA commented on SENTRY-1541:
-----------------------------------

Here are the results of testing the latest attachment
https://issues.apache.org/jira/secure/attachment/12842313/SENTRY-1541.v1.patch against master.

{color:green}Overall:{color} +1 all checks pass

{color:green}SUCCESS:{color} all tests passed

Console output: https://builds.apache.org/job/PreCommit-SENTRY-Build/2191/console

This message is automatically generated.

> toSentryPrivilege() should not copy fields that are not set in the source
> -------------------------------------------------------------------------
>
>                 Key: SENTRY-1541
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1541
>             Project: Sentry
>          Issue Type: Improvement
>          Components: Sentry
>    Affects Versions: 1.8.0, sentry-ha-redesign
>            Reporter: Alexander Kolbasov
>            Assignee: Vamsee Yarlagadda
>         Attachments: SENTRY-1541.v1.patch
>
>
> The SentryStore.toSentryPrivilege() function:
> {code}
>   private TSentryPrivilege toSentryPrivilege(TSentryAuthorizable tAuthorizable)
>       throws SentryInvalidInputException {
>     TSentryPrivilege tSentryPrivilege = new TSentryPrivilege();
>     tSentryPrivilege.setDbName(fromNULLCol(tAuthorizable.getDb()));
>     tSentryPrivilege.setServerName(fromNULLCol(tAuthorizable.getServer()));
>     tSentryPrivilege.setTableName(fromNULLCol(tAuthorizable.getTable()));
>     tSentryPrivilege.setColumnName(fromNULLCol(tAuthorizable.getColumn()));
>     tSentryPrivilege.setURI(fromNULLCol(tAuthorizable.getUri()));
>     PrivilegeScope scope;
>     if (!isNULL(tSentryPrivilege.getColumnName())) {
>       scope = PrivilegeScope.COLUMN;
>     } else if (!isNULL(tSentryPrivilege.getTableName())) {
>       scope = PrivilegeScope.TABLE;
>     } else if (!isNULL(tSentryPrivilege.getDbName())) {
>       scope = PrivilegeScope.DATABASE;
>     } else if (!isNULL(tSentryPrivilege.getURI())) {
>       scope = PrivilegeScope.URI;
>     } else {
>       scope = PrivilegeScope.SERVER;
>     }
>     tSentryPrivilege.setPrivilegeScope(scope.name());
>     tSentryPrivilege.setAction(AccessConstants.ALL);
>     return tSentryPrivilege;
>   }
> {code}
> Note that it blindly copies all fields from the source, replacing null with empty strings and both itself and other consumers downstream do not know which fields were actually set and which were not. Instead it should just clone fields that were set.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)