tSentryPrivilege.setDbName(tAuthorizable.getDb());
tSentryPrivilege.setServerName(tAuthorizable.getServer());
tSentryPrivilege.setTableName(tAuthorizable.getTable());
tSentryPrivilege.setURI(tAuthorizable.getUri());
tSentryPrivilege.setGrantorPrincipal(grantorPrincipal);
PrivilegeScope scope;
if (tSentryPrivilege.getTableName() != null) {
scope = PrivilegeScope.TABLE;
} else if (tSentryPrivilege.getDbName() != null) {
scope = PrivilegeScope.DATABASE;
} else if (tSentryPrivilege.getURI() != null) {
scope = PrivilegeScope.URI;
} else {
scope = PrivilegeScope.SERVER;
}
tSentryPrivilege.setPrivilegeScope(scope.name());
tSentryPrivilege.setAction(AccessConstants.ALL);
return tSentryPrivilege;
}