gocb icon indicating copy to clipboard operation
gocb copied to clipboard

Unable to specify role scope when creating group

Open ludydoo opened this issue 6 months ago • 0 comments

Current behavior When using cluster.Users().UpsertGroup, I am unable to specify the scope for the group roles. The specified scope is ignored and "*" is used instead. The resulting role is data_reader[myBucket:*:*]

Expected behavior The specified group scope would be stored. The resulting scope should be data_reader[myBucket:myScope:*]

cluster, err: = gocb.Connect("couchbase://localhost", gocb.ClusterOptions {
    Authenticator: gocb.PasswordAuthenticator {
        Username: cbUsername,
        Password: cbPassword,
    },
})
if err != nil {
    return err
}

bucket: = cluster.Bucket("myBucket")
err = bucket.WaitUntilReady(10 * time.Second, nil)
if err != nil {
    return err
}

if err: = bucket.CollectionsV2().CreateScope("myScope", nil);
err != nil {
    return err
}

time.Sleep(5 * time.Second)

err: = cluster.Users().UpsertGroup(gocb.Group{
    Name: "someGroup",
    Roles: [] gocb.Role {
        {
            Name: "data_reader",
            Bucket: "myBucket",
            Scope: "myScope",
        },
    },
}, nil)

The resulting scope is ignored and * is stored.

ludydoo avatar Apr 04 '25 15:04 ludydoo