Hi,
Version: 4.6.2-3905 Enterprise Edition (build-3905)
Java SDK as follows:
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>java-client</artifactId>
<version>2.4.7</version>
</dependency>
I am puzzled why I can’t create a new User with code as follows and I am connecting with the Administrator username and password running a single server on my Mac BUT I am getting error “Could not update user: FAILURE, msg: Method Not Allowed” and I can’t seem to understand why I can’t perform this action?
Code:
UserSettings userSettings = UserSettings.build()
.name(username)
.password(password)
.roles(Arrays.asList(
// Roles required for the reading of data from
// the bucket.
new UserRole("bucket_admin", bucketName),
//new UserRole("cluster_admin"),
new UserRole("data_reader", "*"),
new UserRole("query_select", "*"),
// Roles required for the writing of data into
// the bucket.
new UserRole("data_writer", bucketName),
new UserRole("query_insert", bucketName),
new UserRole("query_delete", bucketName),
// Role required for the creation of indexes
// on the bucket.
new UserRole("query_manage_index", bucketName)));
clusterManager.upsertUser(username, userSettings);
Error: Why am I not allowed to do this when I can create a Bucket without any issue?
com.couchbase.client.core.CouchbaseException: Could not update user: FAILURE, msg: Method Not Allowed
at com.couchbase.client.java.cluster.DefaultAsyncClusterManager$18.call(DefaultAsyncClusterManager.java:329)
If I create a bucket that works fine, why is User creation failing?
BucketSettings bucketSettings = new DefaultBucketSettings.Builder()
.type(BucketType.COUCHBASE)
.name(bucketName) // name of bucket to create
.quota(120) // 120 megabytes
.replicas(1)
.indexReplicas(true)
.enableFlush(true)
.build();
clusterManager.insertBucket(bucketSettings);
Current roles for the Admistrator user as follows:
$ couchbase-cli admin-role-manage -c localhost:8091 -u Administrator -p welcome1 --my-roles
SUCCESS: my roles:
{
"id": "Administrator",
"roles": [
{
"role": "admin"
}
]
}
and
pasapicella@pas-macbook:~/pivotal/software/couchbase$ couchbase-cli admin-role-manage -c localhost:8091 -u Administrator -p welcome1 --get-roles
SUCCESS: user/role list:
[
{
"id": "Administrator",
"roles": [
{
"role": "cluster_admin"
},
{
"bucket_name": "*",
"role": "bucket_admin"
},
{
"bucket_name": "*",
"role": "views_admin"
}
]
},