You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user that has CREATE permissions on a keyspace cannot CREATE types, but can create tables fine. This is potentially similar to the issue in #2373.
The user has the following permissions:
GRANT CREATE ON KEYSPACE accounts_api TO accounts_api;
Then as accounts_api try to create a type in that keyspace:
CREATE TYPE IF NOT EXISTS accounts_api.mytype (id TEXT);
Gives an error:
Unauthorized: Error from server: code=2100 [Unauthorized] message="Unauthorized. User accounts_api has no CREATE permission on <all keyspaces> or any of its parents
CREATE TYPE IF NOT EXISTS accounts_api.mytype (id TEXT);
^^^^^^
(ql error -4)"
But the user has CREATE permissions on that keyspace:
…ons for keyspace.
Summary:
Fixed permissions check for CREATE TYPE in the CQL parser tree node.
Fixed permissions check for CREATE/DROP TYPE in PreparedStatement.
Note: similar fix for DROP TYPE (diff D7254) was done before:
ddorian@2ec2e22
Test Plan:
ybd --java-test org.yb.cql.TestAuthorizationEnforcement#testDropTypeWithAllKeyspacesPermission
ybd --java-test org.yb.cql.TestAuthorizationEnforcement#testCreateTypeWithKeyspacePermission
ybd --java-test org.yb.cql.TestAuthorizationEnforcement#testPreparedCreateDropTypeWithAllKeyspacesPermission
ybd --java-test org.yb.cql.TestAuthorizationEnforcement#testPreparedCreateDropTypeWithKeyspacePermission
Reviewers: hector
Reviewed By: hector
Subscribers: kannan, yql
Differential Revision: https://phabricator.dev.yugabyte.com/D7373
A user that has
CREATE
permissions on a keyspace cannot CREATE types, but can create tables fine. This is potentially similar to the issue in #2373.The user has the following permissions:
Then as
accounts_api
try to create a type in that keyspace:Gives an error:
But the user has CREATE permissions on that keyspace:
The text was updated successfully, but these errors were encountered: