Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
30980a2
grant and revoke stmts
rakhi-prathap Jul 14, 2025
5252e36
Add CREATE USER
rakhi-prathap Jul 17, 2025
58c8ef5
Add ALTER USER
rakhi-prathap Jul 17, 2025
4731c5b
Add DROP
rakhi-prathap Jul 17, 2025
5328f1f
Add CREATE GROUP
rakhi-prathap Jul 18, 2025
3e86640
Update CREATE GROUP
rakhi-prathap Jul 28, 2025
55aa690
Add DROP GROUP
rakhi-prathap Jul 29, 2025
ba73be1
Update GRANT
rakhi-prathap Aug 4, 2025
60edf44
Update REVOKE
rakhi-prathap Aug 4, 2025
cf25385
More statements
rakhi-prathap Aug 5, 2025
fd4346d
Minor edits to GRANT and REVOKE
rakhi-prathap Aug 7, 2025
b6c0737
Adding new SQL++ statements
rakhi-prathap Aug 10, 2025
78e51fb
Update GRANT and REVOKE statements
rakhi-prathap Aug 11, 2025
cdc68fb
Refine the content
rakhi-prathap Aug 11, 2025
240aea3
Update HEAD.yml
rakhi-prathap Aug 11, 2025
67aa778
Add a custom preview.yml
rakhi-prathap Aug 11, 2025
1b5fcb9
Revert preview.yml changes
rakhi-prathap Aug 11, 2025
da20aa2
Incorporating tech review feedback
rakhi-prathap Aug 26, 2025
b2bac7b
Incorporating tech review feedback
rakhi-prathap Aug 26, 2025
f866dd7
Add new examples using IF EXISTS/IF NOT EXISTS
rakhi-prathap Sep 1, 2025
0f01135
Apply suggestions from code review
rakhi-prathap Sep 3, 2025
e037fc1
Apply changes from review
rakhi-prathap Sep 4, 2025
391a3bc
Apply suggestions from code review
rakhi-prathap Sep 4, 2025
f371eaa
Apply suggestions from code review
rakhi-prathap Sep 4, 2025
eaf1021
Minor fix
rakhi-prathap Sep 4, 2025
f6823c7
Apply suggestions from code review
rakhi-prathap Sep 4, 2025
0566c24
Update EBNF to remove quotes
rakhi-prathap Sep 8, 2025
13473f9
Resolve conflicts
rakhi-prathap Sep 8, 2025
a60f34e
Add drop-bucket to the drop-statement list
rakhi-prathap Sep 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modules/n1ql/assets/images/n1ql-language-reference/grant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modules/n1ql/assets/images/n1ql-language-reference/revoke.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions modules/n1ql/pages/n1ql-language-reference/alterbucket.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
= ALTER BUCKET
:description: The ALTER BUCKET statement enables you to update an existing bucket's configuration.
:page-topic-type: reference
:page-status: Couchbase Server 8.0
:imagesdir: ../../assets/images

:identifier: xref:n1ql-language-reference/identifiers.adoc
:roles: xref:learn:security/roles.adoc
:bucket-parameters: xref:rest-api:rest-bucket-create.adoc#parameter-groups
:buckets: xref:learn:buckets-memory-and-storage/buckets.adoc
:manage-buckets: xref:manage:manage-buckets/bucket-management-overview.adoc
:buckets-api: xref:rest-api:rest-bucket-intro.adoc
:couchbase-cli-bucket-edit: xref:cli:cbcli/couchbase-cli-bucket-edit.adoc

[abstract]
{description}

== Purpose

Use the ALTER BUCKET statement to modify the configuration of a bucket in your Couchbase cluster.
You can update only a limited set of bucket settings.
You cannot change its core properties such as the bucket name and type.
For more information, see the <<alterbucket-syntax,Syntax>> section.

== RBAC Privileges

Only administrators with the following roles can execute the ALTER BUCKET statement:

* Full Admin
* Cluster Admin
* Bucket Admin (if privileges are extended to the specific bucket or all buckets on the cluster)

For more information about roles and privileges, see {roles}[Roles].

[[alterbucket-syntax]]
== Syntax

[source,ebnf]
----
include::partial$grammar/ddl.ebnf[tag=alter-bucket]
----

image::n1ql-language-reference/alter-bucket.png["Syntax diagram: refer to source code listing", align=left]

The `BUCKET` and `DATABASE` keywords are synonyms.
You can use either of them.

[horizontal]
name::
(Required) An {identifier}[identifier] that represents the name of the bucket that you want to update.

with-fields:: (Optional)
A JSON object containing a list of name-value pairs that specify additional options for the bucket.
For a list of valid fields names and values, see {bucket-parameters}[Bucket Parameter Groups] in the REST API documentation.

NOTE: You cannot alter the following fields of a bucket: `bucketType`, `storageBackend`, `replicaIndex`, and `conflictResolutionType`.

== Example

.Alter a bucket and update its memory quota, maximum TTL, and durability level
====
[source,sqlpp]
----
ALTER BUCKET `student-records`
WITH {
"ramQuota": 256,
"maxTTL": 86400,
"durabilityMinLevel": "majority"
};
----
====

== Related Links

* For an overview of buckets, see {buckets}[Buckets].
* For step-by-step procedures for bucket management, see {manage-buckets}[Manage Buckets].
* For managing buckets with the REST API, see {buckets-api}[Buckets API].
142 changes: 142 additions & 0 deletions modules/n1ql/pages/n1ql-language-reference/altergroup.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
= ALTER GROUP
:description: The ALTER GROUP statement enables you to update an existing group.
:page-topic-type: reference
:page-status: Couchbase Server 8.0
:imagesdir: ../../assets/images

:from: xref:n1ql-language-reference/from.adoc
:from-keyspace-ref: {from}#from-keyspace-ref

[abstract]
{description}

== Purpose

Use the ALTER GROUP statement to modify an existing group within the Couchbase Server Role-Based Access Control (RBAC) system.
You can update the group's description and its roles.
You can either add new roles or remove all the existing ones.
When you update a role for a group, all users in the group inherit the updated permissions automatically.

CAUTION: When you add new roles to a group, the ALTER GROUP statement replaces the group's existing role assignments with the new ones you provide.
It updates the entire role list, so any existing roles not included in the new list will be removed.
If you want to add or remove specific roles without affecting the others, use the xref:n1ql:n1ql-language-reference/grant.adoc[GRANT] and xref:n1ql:n1ql-language-reference/revoke.adoc[REVOKE] statements instead.

== RBAC Privileges

To execute the ALTER GROUP statement, you must have either the Full Admin or the Security Admin role.
For more information about user roles, see xref:learn:security/authorization-overview.adoc[Authorization].

== Syntax

[source,ebnf]
----
include::partial$grammar/ddl.ebnf[tag=alter-group]
----

image::n1ql-language-reference/alter-group.png["Syntax diagram: refer to source code listing", align=left]

[horizontal]
name::
(Required) The unique identifier of the group you want to update.

description::
(Optional) A quoted string containing the updated description for the group.

rbac-role::
(Optional)
<<roles,Update Roles>>

[NOTE]
====
When altering a group, you can update its roles using one of the following options: `ROLE`, `ROLES`, or `NO ROLES`.
You can specify only one of these options per statement.

* `ROLE` assigns a single role to the group.
* `ROLES` assigns multiple roles to group (the names must be separated by commas).
* `NO ROLES` removes all roles from the group.
====

[[roles]]
=== Update Roles

[source,ebnf]
----
include::partial$grammar/ddl.ebnf[tag=rbac-role]
----

image::n1ql-language-reference/rbac-role.png["Syntax diagram: refer to source code listing", align=left]

[horizontal]

role::
One of the xref:learn:security/authorization-overview.adoc[RBAC role names predefined] by Couchbase Server.
+
The following roles have short forms that can be used as well:

* `query_select` → `select`
* `query_insert` → `insert`
* `query_update` → `update`
* `query_delete` → `delete`

keyspace-ref:: <<keyspace-ref>>

[[keyspace-ref]]
==== Keyspace Reference

[source,ebnf]
----
include::partial$grammar/dql.ebnf[tag=keyspace-ref]
----

image::n1ql-language-reference/keyspace-ref.png["Syntax diagram: refer to source code listing", align=left]

[source#keyspace-path,ebnf,reftext="keyspace path"]
----
include::partial$grammar/dql.ebnf[tag=keyspace-path]
----

image::n1ql-language-reference/keyspace-path.png["Syntax diagram: refer to source code listing", align=left]

[source#keyspace-partial,ebnf,reftext="keyspace partial"]
----
include::partial$grammar/dql.ebnf[tag=keyspace-partial]
----

image::n1ql-language-reference/keyspace-partial.png["Syntax diagram: refer to source code listing", align=left]

Use keyspace reference to specify the target for the update.
For more information about each element, see the xref:n1ql-language-reference/from.adoc#from-keyspace-ref[Keyspace Reference] section in the FROM clause.

== Examples

.Alter a group and update its description
====
[source,sqlpp]
----
ALTER GROUP support WITH "Support team for customer queries";
----
====

.Alter a group and add new roles
====
[source,sqlpp]
----
ALTER GROUP support
ROLES
query_select ON `travel-sample`.`inventory`.`airline`,
query_insert ON `travel-sample`.`inventory`.`airline`;
----
====

.Alter a group and remove all roles
====
[source,sqlpp]
----
ALTER GROUP support NO ROLES WITH "Currently unused group";
----
====

== Related Links
* To create a group, see xref:n1ql-language-reference/creategroup.adoc[].
* To delete a group, see xref:n1ql-language-reference/altergroup.adoc[].
* To create a new user, see xref:n1ql-language-reference/createuser.adoc[].
87 changes: 87 additions & 0 deletions modules/n1ql/pages/n1ql-language-reference/alteruser.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
= ALTER USER
:description: The ALTER USER statement enables you to alter the details of an existing user.
:page-topic-type: reference
:page-status: Couchbase Server 8.0
:imagesdir: ../../assets/images

[abstract]
{description}

== Purpose

Use the ALTER USER statement to update a local user's attributes, such as their password, full name, and group.
You can add the user to new groups or remove them from all existing groups.

This statement helps manage access control and keeps user information up to date within Couchbase Server.

CAUTION: When you add new groups to a user, the ALTER USER statement replaces the user's existing group assignments with the new ones you provide.
It updates the entire group list, so any existing groups not included in the new list will be removed.

== RBAC Privileges

To execute the ALTER USER statement, you must have either the Full Admin or the Security Admin role.
For more information about user roles, see xref:learn:security/authorization-overview.adoc[Authorization].

== Syntax

[source,ebnf]
----
include::partial$grammar/ddl.ebnf[tag=alter-user]
----

image::n1ql-language-reference/alter-user.png["Syntax diagram: refer to source code listing", align=left]

[horizontal]
username::
(Required) The unique identifier of the local user.

password::
(Optional) A quoted string containing the user's new password.
It must be at least 6 characters long.

name::
(Optional) A quoted string containing the user's updated name.

group::
(Optional) The group you want to assign the user to.

[NOTE]
====
When altering a user, you can update their group using one of the following options: `GROUP`, `GROUPS`, or `NO GROUPS`.
You can specify only one of these options per statement.

* `GROUP` assigns the user to a single group.
* `GROUPS` assigns the user to multiple groups (the names must be separated by commas).
* `NO GROUPS` removes the user from all groups.
====

== Examples

.Change a user's password and full name
====
[source,sqlpp]
----
ALTER USER Hilary PASSWORD "newpassword" WITH "Hilary Chloe";
----
====

.Assign a user to a new group
====
[source,sqlpp]
----
ALTER USER Alice GROUP support;
----
====

.Remove a user from existing groups
====
[source,sqlpp]
----
ALTER USER Bob NO GROUPS;
----
====

== Related Links
* To create a new user, see xref:n1ql:n1ql-language-reference/createuser.adoc[].
* To delete a user, see xref:n1ql:n1ql-language-reference/dropuser.adoc[].
* To create a new group, see xref:n1ql:n1ql-language-reference/creategroup.adoc[].
Loading
Loading