-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73dc5de
commit 52f00d0
Showing
10 changed files
with
231 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
{ | ||
"metadata": { | ||
"next_page": null, | ||
"next_page_token": null | ||
}, | ||
"data": [ | ||
{ | ||
"id": "df502160-ff21-4314-becc-0d14583144ad", | ||
"event_at": "2023-10-15T23:03:05.287Z", | ||
"type": "auth.login", | ||
"user_id": "4ef9fca4-beb3-46fb-a5d5-13e57fa89ef4", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "web", | ||
"agent": "", | ||
"metadata": "{}", | ||
"remote_ip": "2a06:98c0:3600::103", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "38f69f3a-69f6-4b24-8f68-1b12f3970e4a", | ||
"event_at": "2023-10-15T23:18:50.651Z", | ||
"type": "auth.login", | ||
"user_id": "c30d8eb8-317f-43b4-bc87-b63e9a5f7311", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "Go-http-client/2.0", | ||
"metadata": "{}", | ||
"remote_ip": "", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "bb62b60f-2c42-4970-aa19-113f7ea256ff", | ||
"event_at": "2023-10-15T23:18:51.681Z", | ||
"type": "auth.login", | ||
"user_id": "c30d8eb8-317f-43b4-bc87-b63e9a5f7311", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "service", | ||
"agent": "Go-http-client/2.0", | ||
"metadata": "{}", | ||
"remote_ip": "10.253.134.238", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "6d403b11-cb10-4d27-9bf7-1cfe72064383", | ||
"event_at": "2023-10-15T23:18:56.124Z", | ||
"type": "sensor.sensor_metadata_updated", | ||
"user_id": "c30d8eb8-317f-43b4-bc87-b63e9a5f7311", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "grpc-go/1.58.2", | ||
"metadata": "{\"source_id\":\"196451697411935\",\"source_name\":\"s12test\"}", | ||
"remote_ip": "", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "31ae09dd-6e40-4684-b450-5db5ac83126c", | ||
"event_at": "2023-10-15T23:19:52.181Z", | ||
"type": "sensor.gateway_deprovisioned", | ||
"user_id": "c30d8eb8-317f-43b4-bc87-b63e9a5f7311", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "grpc-go/1.58.0", | ||
"metadata": "{\"source_id\":\"153591697411991\",\"source_name\":\"s12test\"}", | ||
"remote_ip": "10.254.11.167", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "9f5238f7-ce83-416d-9e0f-fd529ea540a3", | ||
"event_at": "2023-10-15T23:19:52.457Z", | ||
"type": "sensor.sensor_metadata_updated", | ||
"user_id": "c30d8eb8-317f-43b4-bc87-b63e9a5f7311", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "grpc-go/1.58.2", | ||
"metadata": "{\"source_id\":\"148661697411992\",\"source_name\":\"s12test\"}", | ||
"remote_ip": "", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "78a9df0e-711a-4ad4-9e9d-dcb85f8aa9c1", | ||
"event_at": "2023-10-15T23:19:52.565Z", | ||
"type": "sensor.sensor_metadata_updated", | ||
"user_id": "c30d8eb8-317f-43b4-bc87-b63e9a5f7311", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "grpc-go/1.58.2", | ||
"metadata": "{\"source_id\":\"102591697411992\",\"source_name\":\"s12test\"}", | ||
"remote_ip": "", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "f9068f8f-a800-4882-98c4-ecedb87d6988", | ||
"event_at": "2023-10-15T23:20:04.415Z", | ||
"type": "auth.login", | ||
"user_id": "148e564c-1f62-4445-b8b3-2aa57acd6e34", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "Go-http-client/2.0", | ||
"metadata": "{}", | ||
"remote_ip": "", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "efe70b32-3d5a-4021-a812-5c3e205ca3b2", | ||
"event_at": "2023-10-15T23:20:05.452Z", | ||
"type": "auth.login", | ||
"user_id": "148e564c-1f62-4445-b8b3-2aa57acd6e34", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "service", | ||
"agent": "Go-http-client/2.0", | ||
"metadata": "{}", | ||
"remote_ip": "10.254.8.44", | ||
"initiator": "INITIATOR_USER" | ||
}, | ||
{ | ||
"id": "437ca49b-859a-410d-8e29-79344bcceb06", | ||
"event_at": "2023-10-15T23:20:05.635Z", | ||
"type": "sensor.sensor_metadata_updated", | ||
"user_id": "148e564c-1f62-4445-b8b3-2aa57acd6e34", | ||
"organisation_id": "a08b6ac0-8a05-11e2-9951-ddd1182f65d8", | ||
"client_class": "sc_service", | ||
"agent": "grpc-go/1.58.2", | ||
"metadata": "{\"source_id\":\"154161697412005\",\"source_name\":\"s12test\"}", | ||
"remote_ip": "", | ||
"initiator": "INITIATOR_USER" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
event_id,event_at,type,user_id,organisation_id,client_class,agent,initiator,exported_at | ||
31ae09dd-6e40-4684-b450-5db5ac83126c,--date--,sensor.gateway_deprovisioned,c30d8eb8-317f-43b4-bc87-b63e9a5f7311,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,grpc-go/1.58.0,INITIATOR_USER,--date-- | ||
38f69f3a-69f6-4b24-8f68-1b12f3970e4a,--date--,auth.login,c30d8eb8-317f-43b4-bc87-b63e9a5f7311,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,Go-http-client/2.0,INITIATOR_USER,--date-- | ||
437ca49b-859a-410d-8e29-79344bcceb06,--date--,sensor.sensor_metadata_updated,148e564c-1f62-4445-b8b3-2aa57acd6e34,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,grpc-go/1.58.2,INITIATOR_USER,--date-- | ||
6d403b11-cb10-4d27-9bf7-1cfe72064383,--date--,sensor.sensor_metadata_updated,c30d8eb8-317f-43b4-bc87-b63e9a5f7311,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,grpc-go/1.58.2,INITIATOR_USER,--date-- | ||
78a9df0e-711a-4ad4-9e9d-dcb85f8aa9c1,--date--,sensor.sensor_metadata_updated,c30d8eb8-317f-43b4-bc87-b63e9a5f7311,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,grpc-go/1.58.2,INITIATOR_USER,--date-- | ||
9f5238f7-ce83-416d-9e0f-fd529ea540a3,--date--,sensor.sensor_metadata_updated,c30d8eb8-317f-43b4-bc87-b63e9a5f7311,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,grpc-go/1.58.2,INITIATOR_USER,--date-- | ||
bb62b60f-2c42-4970-aa19-113f7ea256ff,--date--,auth.login,c30d8eb8-317f-43b4-bc87-b63e9a5f7311,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,service,Go-http-client/2.0,INITIATOR_USER,--date-- | ||
df502160-ff21-4314-becc-0d14583144ad,--date--,auth.login,4ef9fca4-beb3-46fb-a5d5-13e57fa89ef4,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,web,,INITIATOR_USER,--date-- | ||
efe70b32-3d5a-4021-a812-5c3e205ca3b2,--date--,auth.login,148e564c-1f62-4445-b8b3-2aa57acd6e34,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,service,Go-http-client/2.0,INITIATOR_USER,--date-- | ||
f9068f8f-a800-4882-98c4-ecedb87d6988,--date--,auth.login,148e564c-1f62-4445-b8b3-2aa57acd6e34,a08b6ac0-8a05-11e2-9951-ddd1182f65d8,sc_service,Go-http-client/2.0,INITIATOR_USER,--date-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
user_id,group_id,organisation_id,exported_at | ||
user_1,role_group1,role_123,--date-- | ||
user_2,role_group1,role_123,--date-- | ||
user_1,role_group2,role_123,--date-- | ||
user_2,role_group2,role_123,--date-- | ||
user_1,role_group1,role_ada3042f16a44249915ddc088adef92a,--date-- | ||
user_2,role_group1,role_ada3042f16a44249915ddc088adef92a,--date-- | ||
user_1,role_group2,role_ada3042f16a44249915ddc088adef92a,--date-- | ||
user_2,role_group2,role_ada3042f16a44249915ddc088adef92a,--date-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
event_id,event_at,type,user_id,organisation_id,client_class,agent,initiator,exported_at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package util_test | ||
|
||
import ( | ||
"github.com/SafetyCulture/safetyculture-exporter/pkg/internal/util" | ||
"github.com/gofrs/uuid" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestConvertS12ToUUID(t *testing.T) { | ||
expectedUUID, err := uuid.FromString("ada3042f-16a4-4249-915d-dc088adef92a") | ||
require.NoError(t, err) | ||
|
||
tests := []struct { | ||
name string | ||
stringID string | ||
expected uuid.UUID | ||
}{ | ||
{ | ||
name: "should pass as S12", | ||
stringID: "role_ada3042f16a44249915ddc088adef92a", | ||
expected: expectedUUID, | ||
}, | ||
{ | ||
name: "should pass as UUID", | ||
stringID: "ada3042f-16a4-4249-915d-dc088adef92a", | ||
expected: expectedUUID, | ||
}, | ||
{ | ||
name: "should return UUID ZERO in case of error", | ||
stringID: "xyz", | ||
expected: uuid.Nil, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
res := util.ConvertS12ToUUID(tt.stringID) | ||
if res != tt.expected { | ||
t.Errorf("got %s, want %s", res, tt.expected) | ||
} | ||
}) | ||
} | ||
} |