Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add role list and delete functionality #566

Closed
burmanm opened this issue Nov 11, 2024 · 0 comments · Fixed by #567
Closed

Add role list and delete functionality #566

burmanm opened this issue Nov 11, 2024 · 0 comments · Fixed by #567
Assignees

Comments

@burmanm
Copy link
Contributor

burmanm commented Nov 11, 2024

Currently, the mgmt-api has ability to create roles, but not list them or delete them. This functionality should be present as well to enable management without going through CQL.

Example output would be:

Fetch current roles after creating the cluster (same format as LIST roles; in CQL):

cassandra@cluster2-dc2-r1-sts-0 /]$ curl localhost:8080/api/v0/ops/auth/role
[{"datacenters":"ALL","login":"true","name":"cluster2-superuser","options":"{}","super":"true"},{"datacenters":"ALL","login":"false","name":"cassandra","options":"{}","super":"false"}]
[cassandra@cluster2-dc2-r1-sts-0 /]$

Create role, using the existing functionality:

[cassandra@cluster2-dc2-r1-sts-0 /]$ curl -v -XPOST 'localhost:8080/api/v0/ops/auth/role?username=try&password=hope&can_login=false&is_superuser=false'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> POST /api/v0/ops/auth/role?username=try&password=hope&can_login=false&is_superuser=false HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< connection: keep-alive
< Content-Type: text/plain;charset=UTF-8
< transfer-encoding: chunked
< 
* Connection #0 to host localhost left intact
OK[cassandra@cluster2-dc2-r1-sts-0 /]$

List again:

[cassandra@cluster2-dc2-r1-sts-0 /]$ curl localhost:8080/api/v0/ops/auth/role
[{"datacenters":"ALL","login":"false","name":"try","options":"{}","super":"false"},{"datacenters":"ALL","login":"true","name":"cluster2-superuser","options":"{}","super":"true"},{"datacenters":"ALL","login":"false","name":"cassandra","options":"{}","super":"false"}]
[cassandra@cluster2-dc2-r1-sts-0 /]

Delete:

[cassandra@cluster2-dc2-r1-sts-0 /]$ curl -XDELETE 'localhost:8080/api/v0/ops/auth/role/drop?username=try'
OK[cassandra@cluster2-dc2-r1-sts-0 /]$

And final list:

cassandra@cluster2-dc2-r1-sts-0 /]$ curl localhost:8080/api/v0/ops/auth/role
[{"datacenters":"ALL","login":"true","name":"cluster2-superuser","options":"{}","super":"true"},{"datacenters":"ALL","login":"false","name":"cassandra","options":"{}","super":"false"}]
[cassandra@cluster2-dc2-r1-sts-0 /]$ 

┆Issue is synchronized with this Jira Story by Unito
┆Issue Number: MAPI-80

emerkle826 added a commit that referenced this issue Nov 22, 2024
* [FEATURE] [#566](#566) Add listRoles and dropRole functionality to the REST interface
* [FEATURE] [#571](#571) Add Cassandra 4.0.15 to the build matrix
* [FEATURE] [#569](#569) Add DSE 6.9.4 to the build matrix
* [FEATURE] [#568](#568) Add DSE 6.8.52 to the build matrix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant