Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-19749

ALTER USER | ROLE IF EXISTS creates a user / role if it does not exist

    XMLWordPrintableJSON

Details

    Description

      Let's have:

      authenticator:
        class_name : org.apache.cassandra.auth.PasswordAuthenticator
      authorizer: CassandraAuthorizer
      role_manager: CassandraRoleManager
      

      and do this:

      cassandra@cqlsh> select * from system_auth.roles;
      
       role      | can_login | is_superuser | member_of | salted_hash
      -----------+-----------+--------------+-----------+--------------------------------------------------------------
       cassandra |      True |         True |      null | $2a$10$sFCKeluid5MlW/Z0CU1ygO1U5qpLW4Rgivmu8rZNmNNQ8WeC2y92S
      
      

      Then

      cassandra@cqlsh> ALTER USER IF EXISTS this_does_not_exist SUPERUSER ;
      cassandra@cqlsh> select * from system_auth.roles where role = 'this_does_not_exist';
      
       role                | can_login | is_superuser | member_of | salted_hash
      ---------------------+-----------+--------------+-----------+-------------
       this_does_not_exist |      null |         True |      null |        null
      
      

      It seems to be same behaviour for ALTER ROLE too.

      cassandra@cqlsh> ALTER ROLE IF EXISTS this_role_is_not_there WITH SUPERUSER = true ;
      cassandra@cqlsh> select * from system_auth.roles where role = 'this_role_is_not_there';
      
       role                   | can_login | is_superuser | member_of | salted_hash
      ------------------------+-----------+--------------+-----------+-------------
       this_role_is_not_there |      null |         True |      null |        null
      
      

      Attachments

        Issue Links

          Activity

            People

              smiklosovic Stefan Miklosovic
              smiklosovic Stefan Miklosovic
              Stefan Miklosovic
              Brandon Williams
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m