Skip to content

Conversation

@Sanket-Shelar
Copy link
Contributor

…ge when attempting to GRANT privilege on a database

What changes were proposed in this pull request?

Updated ensureAdminAccess() method to get user from session and if session is null get user from grantor passed.

How was this patch tested?

Build successful, tested for grant scenarios and working.

final boolean isKeyAdmin;

if (StringUtils.isEmpty(grantor)) {
if (StringUtils.isNotEmpty(bizUtil.getCurrentUserLoginId())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated code changes the precedence of user selection. Originally, it prioritized the granter as the admin user, but now it favors the login user. Was this change intentional?
Also, the else block doesn't check if granter is null or empty. Please add this check for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vyommani - Previously it was prioritzing login user due to which there was an issue during non kerberos when the session was empty. To resolve it updated the method to check grantor user but this scenario fails for this scenario when owner user does not have delegate admin permission.
So we have updated code to revert to original precedence and in case of empty session it will also check if grantor is present.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sanket-Shelar thanks for information, I just wanted to confirm the change was intentional.

…ge when attempting to GRANT privilege on a database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants