clickhouse version: 22.3.6.5

users.yaml :
```
  public_ro:
    password: "test"
    networks:
      ip: '::/0'
    profile: readonly
    quota: default
    allow_databases:
      - database: public
```
exec result: 
```
clickhouse-0-0.clickhouse-headless.default.svc.cluster.local :) create table test(test Uint32) engine=memory();

CREATE TABLE test
(
    `test` Uint32
)
ENGINE = memory

Query id: c976c324-efa1-418d-a6de-b615a9f8947d


0 rows in set. Elapsed: 0.001 sec. 

Received exception from server (version 22.3.6):
Code: 164. DB::Exception: Received from localhost:9000. DB::Exception: public_ro: Cannot execute query in readonly mode. (READONLY)

clickhouse-0-0.clickhouse-headless.default.svc.cluster.local :) create function test as a -> a*2;

CREATE FUNCTION test AS a -> (a * 2)

Query id: b5b59b1c-5209-4de6-b521-9d6b50f5ce33

Ok.

0 rows in set. Elapsed: 0.003 sec. 

clickhouse-0-0.clickhouse-headless.default.svc.cluster.local :) drop function test;

DROP FUNCTION test

Query id: ee5f2061-4ff0-4627-bd3f-c7052406d484

Ok.

0 rows in set. Elapsed: 0.001 sec. 

```
return access_denied(
                "Not enough privileges. "
                "The required privileges have been granted, but without grant option. "
                "To execute this query it's necessary to have grant "
                    + AccessRightsElement{flags, args...}.toStringWithoutOptions() + " WITH GRANT OPTION",
                ErrorCodes::ACCESS_DENIED);
        }
        return access_denied(
            "Not enough privileges. To execute this query it's necessary to have grant "
                + AccessRightsElement{flags, args...}.toStringWithoutOptions() + (grant_option ? " WITH GRANT OPTION" : ""),
            ErrorCodes::ACCESS_DENIED);
    }
    struct PrecalculatedFlags
    {
        const AccessFlags table_ddl = AccessType::CREATE_DATABASE | AccessType::CREATE_TABLE | AccessType::CREATE_VIEW
            | AccessType::ALTER_TABLE | AccessType::ALTER_VIEW | AccessType::DROP_DATABASE | AccessType::DROP_TABLE | AccessType::DROP_VIEW
            | AccessType::TRUNCATE;
        const AccessFlags dictionary_ddl = AccessType::CREATE_DICTIONARY | AccessType::DROP_DICTIONARY;
        const AccessFlags function_ddl = AccessType::CREATE_FUNCTION | AccessType::DROP_FUNCTION;
        const AccessFlags table_and_dictionary_ddl = table_ddl | dictionary_ddl;
        const AccessFlags write_table_access = AccessType::INSERT | AccessType::OPTIMIZE;
        const AccessFlags write_dcl_access = AccessType::ACCESS_MANAGEMENT - AccessType::SHOW_ACCESS;
        const AccessFlags not_readonly_flags = write_table_access | table_and_dictionary_ddl | write_dcl_access | AccessType::SYSTEM | AccessType::KILL_QUERY;
        const AccessFlags not_readonly_1_flags = AccessType::CREATE_TEMPORARY_TABLE;
        const AccessFlags ddl_flags = table_ddl | dictionary_ddl | function_ddl;
        const AccessFlags introspection_flags = AccessType::INTROSPECTION;
    };
    static const PrecalculatedFlags precalc;
    if (params.readonly)
    {