Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'sa' login equivalent 'jdbc_user' login for non-sysadmin login in server_princiapls #1948

Conversation

anju15bharti
Copy link
Contributor

Description

sys.server_principals view was returning only the rows for current login and fixed_server_role(sysadmin).
Added 'sa' SQL_LOGIN sql server equivalent babelfish 'jdbc_user' SQL_LOGIN for non-sysadmin login in server_princiapls

Task: BABEL-4361 (add on)
Authored-by: Anju Bharti [email protected]
Signed-off-by: Anju Bharti [email protected]

Issues Resolved
JIRA BABEL-4361 (add on)
sys.server_principals view was returning only the rows for current login and fixed_server_role(sysadmin).

Test Scenarios Covered

  • Use case based -

  • Boundary conditions -

  • Arbitrary inputs -

  • Negative test cases -

  • Minor version upgrade tests -

  • Major version upgrade tests -

  • Performance tests -

  • Tooling impact -

  • Client tests -

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…in server_princiapls view.

Signed-off-by: ANJU BHARTI <[email protected]>
@@ -326,6 +326,7 @@ CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.is_fixed_role END AS sys.BIT) AS i
FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname
WHERE pg_has_role(suser_id(), 'sysadmin'::TEXT, 'MEMBER')
OR Ext.orig_loginname = suser_name()
OR Ext.orig_loginname = 'jdbc_user'
Copy link
Contributor

Choose a reason for hiding this comment

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

loginname is not necessarily jdbc_user always. We have created this role in init.sh, it could be anything else provided by the customer.

Please don't hardcode this value.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@@ -326,6 +326,7 @@ CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.is_fixed_role END AS sys.BIT) AS i
FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname
WHERE pg_has_role(suser_id(), 'sysadmin'::TEXT, 'MEMBER')
OR Ext.orig_loginname = suser_name()
OR Ext.orig_loginname = 'jdbc_user'
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@shalinilohia50 shalinilohia50 self-requested a review October 25, 2023 09:13
@@ -233,7 +233,7 @@ sys-schema-name
sys-schemas
sys-schemas-dep
sys-selective_xml_index_paths
sys-server_principals
sys-server_principals_before-15_5
Copy link
Contributor

Choose a reason for hiding this comment

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

Name is incorrect, so the tests are failing.
It should be sys-server_principals-before-15_5

@shardgupta shardgupta merged commit b919797 into babelfish-for-postgresql:BABEL_3_X_DEV Oct 26, 2023
27 checks passed
@shardgupta shardgupta deleted the JIRA-BABEL-4361-new branch October 26, 2023 05:59
anju15bharti added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Nov 6, 2023
…in server_princiapls (babelfish-for-postgresql#1948)

sys.server_principals view was returning only the rows for current login and fixed_server_role(sysadmin).
Added 'sa' SQL_LOGIN sql server equivalent babelfish 'jdbc_user' SQL_LOGIN for non-sysadmin login in server_princiapls

Task: BABEL-4361 (add on)

Signed-off-by: Anju Bharti [email protected]
anju15bharti added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Nov 6, 2023
…in server_princiapls (babelfish-for-postgresql#1948)

sys.server_principals view was returning only the rows for current login and fixed_server_role(sysadmin).
Added 'sa' SQL_LOGIN sql server equivalent babelfish 'jdbc_user' SQL_LOGIN for non-sysadmin login in server_princiapls

Task: BABEL-4361 (add on)

Signed-off-by: Anju Bharti [email protected]
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.

4 participants