Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ public void analyze(Analyzer analyzer) throws AnalysisException {
userIdent = ConnectContext.get().getCurrentUserIdentity();
}
}
boolean isSelf = userIdent != null && ConnectContext.get().getCurrentUserIdentity().equals(userIdent);
Preconditions.checkState(isAll || userIdent != null);
UserIdentity self = ConnectContext.get().getCurrentUserIdentity();

// if show all grants, or show other user's grants, need global GRANT priv.
if (isAll || !self.equals(userIdent)) {
if (isAll || !isSelf) {
if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), PrivPredicate.GRANT)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "GRANT");
}
}
if (userIdent != null && !Env.getCurrentEnv().getAccessManager().getAuth().doesUserExist(userIdent)) {
// ldap user not exist in userManager, so should not check
if (userIdent != null && !isSelf && !Env.getCurrentEnv().getAccessManager().getAuth()
.doesUserExist(userIdent)) {
throw new AnalysisException(String.format("User: %s does not exist", userIdent));
}
}
Expand Down