reuse GetRoleSpecObjectForUser

pull/5721/head
Nils Dijk 2022-02-17 13:16:10 +01:00
parent ea86f9f94e
commit 768b320470
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
1 changed files with 1 additions and 18 deletions

View File

@ -102,7 +102,6 @@ static GrantStmt * GenerateGrantStmtForRights(ObjectType objectType,
bool withGrantOption); bool withGrantOption);
static List * GetObjectsForGrantStmt(ObjectType objectType, Oid objectId); static List * GetObjectsForGrantStmt(ObjectType objectType, Oid objectId);
static AccessPriv * GetAccessPrivObjectForGrantStmt(char *permission); static AccessPriv * GetAccessPrivObjectForGrantStmt(char *permission);
static RoleSpec * GetRoleSpecObjectForGrantStmt(Oid roleOid);
static List * GenerateGrantOnSchemaQueriesFromAclItem(Oid schemaOid, static List * GenerateGrantOnSchemaQueriesFromAclItem(Oid schemaOid,
AclItem *aclItem); AclItem *aclItem);
static void SetLocalEnableMetadataSync(bool state); static void SetLocalEnableMetadataSync(bool state);
@ -1782,7 +1781,7 @@ GenerateGrantStmtForRights(ObjectType objectType,
stmt->objtype = objectType; stmt->objtype = objectType;
stmt->objects = GetObjectsForGrantStmt(objectType, objectId); stmt->objects = GetObjectsForGrantStmt(objectType, objectId);
stmt->privileges = list_make1(GetAccessPrivObjectForGrantStmt(permission)); stmt->privileges = list_make1(GetAccessPrivObjectForGrantStmt(permission));
stmt->grantees = list_make1(GetRoleSpecObjectForGrantStmt(roleOid)); stmt->grantees = list_make1(GetRoleSpecObjectForUser(roleOid));
stmt->grant_option = withGrantOption; stmt->grant_option = withGrantOption;
return stmt; return stmt;
@ -1831,22 +1830,6 @@ GetAccessPrivObjectForGrantStmt(char *permission)
} }
/*
* GetRoleSpecObjectForGrantStmt creates a RoleSpec object for the given roleOid.
* It will be used when creating GrantStmt objects.
*/
static RoleSpec *
GetRoleSpecObjectForGrantStmt(Oid roleOid)
{
RoleSpec *roleSpec = makeNode(RoleSpec);
roleSpec->roletype = OidIsValid(roleOid) ? ROLESPEC_CSTRING : ROLESPEC_PUBLIC;
roleSpec->rolename = OidIsValid(roleOid) ? GetUserNameFromId(roleOid, false) : NULL;
roleSpec->location = -1;
return roleSpec;
}
/* /*
* SetLocalEnableMetadataSync sets the enable_metadata_sync locally * SetLocalEnableMetadataSync sets the enable_metadata_sync locally
*/ */