Skip to content

Commit e31358f

Browse files
anju15bhartiANJU BHARTI
andauthored
Include members of session user in permission check of sys.server_permissions (#3940)
Include members of session user in permission check of sys.server_permissions Issues Resolved BABEL-5961 Signed-off-by: ANJU BHARTI <abanju@amazon.com> Co-authored-by: ANJU BHARTI <abanju@amazon.com>
1 parent 71fe5a6 commit e31358f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

contrib/babelfishpg_tsql/sql/sys_views.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,8 +3324,8 @@ FROM pg_catalog.pg_roles AS Base
33243324
INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname
33253325
WHERE(pg_has_role(sys.suser_id(), 'sysadmin'::TEXT, 'MEMBER')
33263326
OR pg_has_role(sys.suser_id(), 'securityadmin'::TEXT, 'MEMBER')
3327-
OR Base.rolname = sys.suser_name() COLLATE sys.database_default
3328-
OR Base.rolname = (SELECT pg_get_userbyid(super_user) FROM super_user))
3327+
OR pg_has_role(sys.suser_id(), Ext.rolname, 'MEMBER')
3328+
OR Base.rolname = (SELECT pg_get_userbyid(super_user) FROM super_user) COLLATE sys.database_default)
33293329
AND Ext.type IN ('S', 'U')
33303330
UNION ALL
33313331
SELECT

contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--5.2.0--5.3.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ FROM pg_catalog.pg_roles AS Base
136136
INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname
137137
WHERE(pg_has_role(sys.suser_id(), 'sysadmin'::TEXT, 'MEMBER')
138138
OR pg_has_role(sys.suser_id(), 'securityadmin'::TEXT, 'MEMBER')
139-
OR Base.rolname = sys.suser_name() COLLATE sys.database_default
140-
OR Base.rolname = (SELECT pg_get_userbyid(super_user) FROM super_user))
139+
OR pg_has_role(sys.suser_id(), Ext.rolname, 'MEMBER')
140+
OR Base.rolname = (SELECT pg_get_userbyid(super_user) FROM super_user) COLLATE sys.database_default)
141141
AND Ext.type IN ('S', 'U')
142142
UNION ALL
143143
SELECT

0 commit comments

Comments
 (0)