Skip to content

Commit

Permalink
doc: tweak admin user creation doc
Browse files Browse the repository at this point in the history
As per the current user management scheme,
there is no constraint for admin users to be
a part of `admin` user group.
Only `is_superuser=true` flag is required while
creating admin users.
Update documentation accordingly.

Signed-off-by: Jeny Sadadia <[email protected]>
  • Loading branch information
Jeny Sadadia authored and JenySadadia committed May 22, 2024
1 parent 663e823 commit ae87ef7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions doc/api-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ $ curl -X 'POST'
{'id': '615f30020eb7c3c6616e5ac3', 'email': '[email protected]', 'is_active':true, 'is_superuser':false, 'is_verified':false, 'username': 'test', 'groups': []}
```

An user accout can be added to multiple user groups by providing user group names to request query parameter. All the admin users
should be added to `admin` group by default.
To create an admin user, provide username, email, password, `"groups": ["admin"]`, and `"is_superuser": 1` to request data dictionary.
To create an admin user, provide username, email, password, and `"is_superuser": 1` to request data dictionary.
A user account can be added to multiple user groups by providing a list of user group names to request dictionary.

For example, the below command will create an admin user and add it to `kernelci` user group.

```
$ curl -X 'POST' 'http://localhost:8001/latest/user/register' -H 'accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0Iiwic2NvcGVzIjpbImFkbWluIiwidXNlciJdfQ.KhcIWfMRr3xTFSCLcr5L4KTUVSsfSsLeyRDEjgkQRBg' -d '{"username": "test_admin", "email": "[email protected]", "password": "admin", "groups": ["admin"], "is_superuser": 1}'
{'_id': '615f30020eb7c3c6616e5ac6', 'username': 'test_admin', 'email': '[email protected]', 'is_active':true, 'is_superuser':true, 'is_verified':false, 'groups': [{'id':'648c07a70fccad400a122509','name':'admin'}]}
$ curl -X 'POST' 'http://localhost:8001/latest/user/register' -H 'accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0Iiwic2NvcGVzIjpbImFkbWluIiwidXNlciJdfQ.KhcIWfMRr3xTFSCLcr5L4KTUVSsfSsLeyRDEjgkQRBg' -d '{"username": "test_admin", "email": "[email protected]", "password": "admin", "is_superuser": 1, "groups": ["kernelci"]}'
{'_id': '615f30020eb7c3c6616e5ac6', 'username': 'test_admin', 'email': '[email protected]', 'is_active':true, 'is_superuser':true, 'is_verified':false, 'groups': [{"id":"648ff894bd39930355ed16ad","name":"kernelci"}]}
```

Another way of creating users is to use `kci user add` tool from kernelci-core.
Expand Down
3 changes: 1 addition & 2 deletions doc/local-instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ tool provided in the `kernelci-api` repository which has a wrapper script
```
$ ./scripts/setup_admin_user --email EMAIL
Creating kernelci-api_api_run ... done
Creating admin group...
Password for user 'admin':
Creating admin user...
```
Expand Down Expand Up @@ -122,7 +121,7 @@ $ curl -X 'GET' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib2IifQ.KHkILtsJaCmueOfFCj79HGr6kHamuZFdB1Yz_5GqcC4'
{"id":"615f30020eb7c3c6616e5ac3", "email": "[email protected]", "is_active":true, "is_superuser":true, "is_verified":true,
"groups": [{"id":"648c07a70fccad400a122509","name":"admin"}], "username":"admin"}
"groups": [], "username":"admin"}
```

### Setup SSH keys
Expand Down

0 comments on commit ae87ef7

Please sign in to comment.