Skip to content

Commit 1e019a9

Browse files
[1.3.x] RHIDP-3709: how admins can track RHDH usage by users (#515)
* RHIDP-3709: how admins can track RHDH usage by users * Peer comments --------- Co-authored-by: Heena Manwani <[email protected]>
1 parent b8b3c6b commit 1e019a9

File tree

5 files changed

+108
-0
lines changed

5 files changed

+108
-0
lines changed

assemblies/assembly-configuring-authorization-in-rhdh.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ include::modules/admin/proc-rbac-ui-edit-role.adoc[leveloffset=+2]
3737
include::modules/admin/proc-rbac-ui-delete-role.adoc[leveloffset=+2]
3838

3939

40+
include::modules/admin/con-user-stats-rhdh.adoc[leveloffset=+1]
41+
42+
43+
include::modules/admin/proc-download-user-stats-rhdh.adoc[leveloffset=+2]
44+
45+
4046
include::modules/admin/con-rbac-rest-api.adoc[leveloffset=+1]
4147

4248

modules/admin/con-rbac-rest-api.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Base URL::
3939
--
4040

4141
The base URL for RBAC REST API requests is `pass:c[http://SERVER:PORT/api/permission/policies]`, such as `pass:c[http://localhost:7007/api/permission/policies]`.
42+
4243
--
4344

4445
Endpoints::
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[id='con-user-stats-rhdh_{context}']
2+
= User statistics in {product}
3+
4+
In {product}, the `licensed-users-info-backend` plugin provides statistical information about the logged-in users using the Web UI or REST API endpoints.
5+
6+
The `licensed-users-info-backend` plugin enables administrators to monitor the number of active users on {product-short}. Using this feature, organizations can compare their actual usage with the number of licenses they have purchased. Additionally, you can share the user metrics with {company-name} for transparency and accurate licensing.
7+
8+
The `licensed-users-info-backend` plugin is enabled by default. This plugin enables a *Download User List* link at the bottom of the *Administration -> RBAC* tab.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[id='proc-download-user-stats-rhdh_{context}']
2+
= Downloading active users list in {product}
3+
4+
You can download the list of users in CSV format using the {product-short} web interface.
5+
6+
.Prerequisites
7+
8+
* RBAC plugins (`@janus-idp/backstage-plugin-rbac` and `@janus-idp/backstage-plugin-rbac-backend`) must be enabled in {product}.
9+
* An administrator role must be assigned.
10+
11+
.Procedure
12+
13+
. In {product}, navigate to *Administration* and select the *RBAC* tab.
14+
. At the bottom of the *RBAC* page, click *Download User List*.
15+
. Optional: Modify the file name in the *Save as* field and click *Save*.
16+
. To access the downloaded users list, go to the *Downloads* folder on your local machine and open the CSV file.

modules/admin/ref-rbac-rest-api-endpoints.adoc

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,3 +975,80 @@ Deletes a conditional policy for the specified ID.
975975
----
976976
--
977977

978+
== User statistics
979+
980+
The `licensed-users-info-backend` plugin exposes various REST API endpoints to retrieve data related to logged-in users.
981+
982+
No additional configuration is required for the `licensed-users-info-backend` plugin. If the RBAC backend plugin is enabled, then an administrator role must be assigned to access the endpoints, as the endpoints are protected by the `policy.entity.read` permission.
983+
984+
The base URL for user statistics endpoints is `pass:c[http://SERVER:PORT/api/licensed-users-info]`, such as `pass:c[http://localhost:7007/api/licensed-users-info]`.
985+
986+
[GET] /users/quantity::
987+
+
988+
--
989+
Returns the total number of logged-in users.
990+
991+
.Example request
992+
[source,bash]
993+
----
994+
curl -X GET "http://localhost:7007/api/licensed-users-info/users/quantity" \
995+
-H "Content-Type: application/json" \
996+
-H "Authorization: Bearer $token"
997+
----
998+
999+
.Example response
1000+
[source,json]
1001+
----
1002+
{ "quantity": "2" }
1003+
----
1004+
--
1005+
1006+
[GET] /users::
1007+
+
1008+
--
1009+
Returns a list of logged-in users with their details.
1010+
1011+
.Example request
1012+
[source,bash]
1013+
----
1014+
curl -X GET "http://localhost:7007/api/licensed-users-info/users" \
1015+
-H "Content-Type: application/json" \
1016+
-H "Authorization: Bearer $token"
1017+
----
1018+
1019+
.Example response
1020+
[source,json]
1021+
----
1022+
[
1023+
{
1024+
"userEntityRef": "user:default/dev",
1025+
"lastTimeLogin": "Thu, 22 Aug 2024 16:27:41 GMT",
1026+
"displayName": "John Leavy",
1027+
"email": "[email protected]"
1028+
}
1029+
]
1030+
----
1031+
--
1032+
1033+
[GET] /users::
1034+
+
1035+
--
1036+
Returns a list of logged-in users in CSV format.
1037+
1038+
.Example request
1039+
[source,bash]
1040+
----
1041+
curl -X GET "http://localhost:7007/api/licensed-users-info/users" \
1042+
-H "Content-Type: text/csv" \
1043+
-H "Authorization: Bearer $token"
1044+
----
1045+
1046+
.Example response
1047+
[source,csv]
1048+
----
1049+
userEntityRef,displayName,email,lastTimeLogin
1050+
user:default/dev,John Leavy,[email protected],"Thu, 22 Aug 2024 16:27:41 GMT"
1051+
----
1052+
--
1053+
1054+

0 commit comments

Comments
 (0)