-
Notifications
You must be signed in to change notification settings - Fork 2
Adding Grantor Information in sys.babelfish_schema_permissions catalog #132
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
base: bbf-database-permission-view
Are you sure you want to change the base?
Changes from 4 commits
f5c15e2
cc699cd
cba6fda
fdbe3ec
f4300bc
8e1ff4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,6 +173,7 @@ static void recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid | |
|
|
||
| tsql_has_linked_srv_permissions_hook_type tsql_has_linked_srv_permissions_hook = NULL; | ||
| bbf_execute_grantstmt_as_dbsecadmin_hook_type bbf_execute_grantstmt_as_dbsecadmin_hook = NULL; | ||
| update_bbf_schema_permissions_catalog_hook_type update_bbf_schema_permissions_catalog_hook = NULL; | ||
| pltsql_allow_storing_init_privs_hook_type pltsql_allow_storing_init_privs_hook = NULL; | ||
| /* | ||
| * If is_grant is true, adds the given privileges for the list of | ||
|
|
@@ -2040,7 +2041,7 @@ ExecGrant_Relation(InternalGrant *istmt) | |
| { | ||
| (*bbf_execute_grantstmt_as_dbsecadmin_hook) (objtype, relOid, ownerId, this_privileges, &grantorId, &avail_goptions); | ||
| } | ||
|
|
||
| /* | ||
| * Restrict the privileges to what we can actually grant, and emit | ||
| * the standards-mandated warning and error messages. | ||
|
|
@@ -2052,6 +2053,16 @@ ExecGrant_Relation(InternalGrant *istmt) | |
| NameStr(pg_class_tuple->relname), | ||
| 0, NULL); | ||
|
|
||
| /* Call the hook to add the permission in bbf_schema_permissions catalog | ||
| * If the hook returns false, indicates that object-level and schema-level grants both are present and schema-level grant is revoked. | ||
| * In such case we remove schema-level entry from the bbf_schema_permissions catalog but skip the execution of revoke as object-level grants exist. | ||
| */ | ||
shreyeah38 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (update_bbf_schema_permissions_catalog_hook && !(*update_bbf_schema_permissions_catalog_hook) (this_privileges, istmt->is_grant, istmt->grantees, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need dialect check?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes there is a dialect check inside the hook. |
||
| istmt->col_privs, pg_class_tuple->oid, GetUserNameFromId(grantorId, false), | ||
| istmt->grant_option, GetUserNameFromId(ownerId, false), istmt->objtype)) | ||
| { | ||
| return; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are inside FOR loop here? do we really want to exit early? |
||
| } | ||
| /* | ||
| * Generate new ACL. | ||
| */ | ||
|
|
@@ -2258,6 +2269,7 @@ ExecGrant_common(InternalGrant *istmt, Oid classid, AclMode default_privs, | |
| (*bbf_execute_grantstmt_as_dbsecadmin_hook) (get_object_type(classid, objectid), objectid, ownerId, istmt->privileges, &grantorId, &avail_goptions); | ||
| } | ||
|
|
||
|
|
||
| nameDatum = SysCacheGetAttrNotNull(cacheid, tuple, | ||
| get_object_attnum_name(classid)); | ||
|
|
||
|
|
@@ -2272,6 +2284,17 @@ ExecGrant_common(InternalGrant *istmt, Oid classid, AclMode default_privs, | |
| NameStr(*DatumGetName(nameDatum)), | ||
| 0, NULL); | ||
|
|
||
| /* Call the hook to add the permission in bbf_schema_permissions catalog | ||
| * If the hook returns false, indicates that object-level and schema-level grants both are present and schema-level grant is revoked. | ||
| * In such case we remove schema-level entry from the bbf_schema_permissions catalog but skip the execution of revoke as object-level grants exist. | ||
| */ | ||
| if ((istmt->objtype == OBJECT_PROCEDURE || istmt->objtype == OBJECT_FUNCTION) && update_bbf_schema_permissions_catalog_hook && !(*update_bbf_schema_permissions_catalog_hook) (this_privileges, istmt->is_grant, istmt->grantees, | ||
| istmt->col_privs, objectid, GetUserNameFromId(grantorId, false), | ||
| istmt->grant_option, GetUserNameFromId(ownerId, false), istmt->objtype)) | ||
| { | ||
| return; | ||
| } | ||
shreyeah38 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /* | ||
| * Generate new ACL. | ||
| */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.