mirror of https://github.com/citusdata/citus.git
Merge pull request #5721 from citusdata/fix/reuse-get-rolespec
reuse GetRoleSpecObjectForUserpull/5707/head
commit
754d894375
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue