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

BI-4885: add test RLS configs #37

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/bad
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'Москва': user1, user2
'Самара':user1, user3
2 changes: 2 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/bad_login
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'Москва': user1, user2
'Самара': user1, user3, robot-user2
38 changes: 38 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/iam_subjects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"id": "1120000000000529",
"email": "[email protected]",
"title": "user1",
"subject_type": "USER_ACCOUNT"
},
{
"id": "1120000000001062",
"email": "[email protected]",
"title": "user4",
"subject_type": "USER_ACCOUNT"
},
{
"id": "1120000000000251",
"email": "[email protected]",
"title": "user5",
"subject_type": "USER_ACCOUNT"
},
{
"id": "1120000000013893",
"email": "[email protected]",
"title": "user6",
"subject_type": "USER_ACCOUNT"
},
{
"id": "1120000000019416",
"email": "[email protected]",
"title": "user2",
"subject_type": "USER_ACCOUNT"
},
{
"id": "1120000000001001",
"email": "[email protected]",
"title": "user3",
"subject_type": "USER_ACCOUNT"
}
]
4 changes: 4 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/missing_login
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'Москва': user1, user2, robot-user2
'Самара': user1, user3
'Омск': user5
'Самара': user3, someuser
58 changes: 58 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/missing_login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000019416",
"subject_type": "user",
"subject_name": "user2"
}
},
{
"allowed_value": "Москва",
"subject": {
"subject_id": "",
"subject_type": "notfound",
"subject_name": "!FAILED_robot-user2"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000001001",
"subject_type": "user",
"subject_name": "user3"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "",
"subject_type": "notfound",
"subject_name": "!FAILED_someuser"
}
},
{
"allowed_value": "Омск",
"subject": {
"subject_id": "1120000000000251",
"subject_type": "user",
"subject_name": "user5"
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'Москва': user2, !FAILED_robot-user2, user1
'Самара': user3, !FAILED_someuser, user1
'Омск': user5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'Москва': user2, user1
'Самара': user3, !FAILED_someuser, user1
'Омск': user5, pg
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000019416",
"subject_type": "user",
"subject_name": "user2"
}
},
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000001001",
"subject_type": "user",
"subject_name": "user3"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "",
"subject_type": "notfound",
"subject_name": "!FAILED_someuser"
}
},
{
"allowed_value": "Омск",
"subject": {
"subject_id": "1120000000000251",
"subject_type": "user",
"subject_name": "user5"
}
},
{
"allowed_value": "Омск",
"subject": {
"subject_id": "1120000000000251",
"subject_type": "user",
"subject_name": "pg"
}
}
]
4 changes: 4 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'Москва': user1,user2
'Самара': user1, user3
'Омск': user5
'Самара': user3
42 changes: 42 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/simple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000019416",
"subject_type": "user",
"subject_name": "user2"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000001001",
"subject_type": "user",
"subject_name": "user3"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Омск",
"subject": {
"subject_id": "1120000000000251",
"subject_type": "user",
"subject_name": "user5"
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'Москва': user1, user2
'Самара': user1, user3
'Омск': user5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'Москва': user2
'Самара': user1, user3
'Омск': user5, pg
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"allowed_value": "Москва",
"subject": {
"subject_id": "1120000000019416",
"subject_type": "user",
"subject_name": "user2"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000001001",
"subject_type": "user",
"subject_name": "user3"
}
},
{
"allowed_value": "Самара",
"subject": {
"subject_id": "1120000000000529",
"subject_type": "user",
"subject_name": "user1"
}
},
{
"allowed_value": "Омск",
"subject": {
"subject_id": "1120000000000251",
"subject_type": "user",
"subject_name": "user5"
}
},
{
"allowed_value": "Омск",
"subject": {
"subject_id": "1120000000000251",
"subject_type": "user",
"subject_name": "pg"
}
}
]
7 changes: 7 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/wildcards
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'Москва': *
'Санкт-Петербург': *
*: user1
*: user4, user5
'Омск': user5
userid: userid
'Владивосток': user6
34 changes: 34 additions & 0 deletions lib/dl_testing/dl_testing/test_data/rls_configs/wildcards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"allowed_value": "Москва",
"subject": {"subject_type": "all", "subject_id": "*", "subject_name": "*"}
},
{
"allowed_value": "Санкт-Петербург",
"subject": {"subject_type": "all", "subject_id": "*", "subject_name": "*"}
},
{
"pattern_type": "all", "allowed_value": null,
"subject": {"subject_type": "user", "subject_id": "1120000000000529", "subject_name": "user1"}
},
{
"pattern_type": "all", "allowed_value": null,
"subject": {"subject_type": "user", "subject_id": "1120000000001062", "subject_name": "user4"}
},
{
"pattern_type": "all", "allowed_value": null,
"subject": {"subject_type": "user", "subject_id": "1120000000000251", "subject_name": "user5"}
},
{
"allowed_value": "Омск",
"subject": {"subject_type": "user", "subject_id": "1120000000000251", "subject_name": "user5"}
},
{
"pattern_type": "userid", "allowed_value": null,
"subject": {"subject_type": "userid", "subject_id": "", "subject_name": "userid"}
},
{
"allowed_value": "Владивосток",
"subject": {"subject_type": "user", "subject_id": "1120000000013893", "subject_name": "user6"}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'Москва': *
'Санкт-Петербург': *
*: user1, user4, user5
'Омск': user5
userid: userid
'Владивосток': user6
Loading