Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-sb-devops
Commits
82c281de
Commit
82c281de
authored
2 years ago
by
Keshav Prasad
Browse files
Options
Download
Patches
Plain Diff
fix: enabling few report apis to be invoked internally without tokens
parent
9cb8d58e
master
login-changes
loginRegisterBtn
prasath-release-5.1.0
release-5.1.0
release-5.1.0-api
release-5.1.0-apiuat
release-5.1.0-bulk-enrol-unenrol
release-5.1.0-uat
release-5.1.0-uatLatest
release-5.1.0-uatapi
release-5.1.0-upsmf-prod
release-uat-nginx
revert-5-login-changes
upstream/release-5.1.0-vdn
release-5.1.0_RC3
release-5.1.0_RC2
release-5.1.0_RC1
release-5.0.2
release-5.0.2_RC1
release-5.0.1
release-5.0.1_RC1
release-5.0.0
release-5.0.0_RC5
release-5.0.0_RC4
release-5.0.0_RC3
release-5.0.0_RC2
release-5.0.0_RC1
release-4.10.2_RC1
release-4.10.1
release-4.10.1_RC2
release-4.10.1_RC1
release-4.10.0
release-4.10.0_RC1
release-4.9.0
release-4.9.0_RC4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kubernetes/opa/report/policies.rego
+12
-0
kubernetes/opa/report/policies.rego
kubernetes/opa/report/policies_test.rego
+80
-0
kubernetes/opa/report/policies_test.rego
with
92 additions
and
0 deletions
+92
-0
kubernetes/opa/report/policies.rego
+
12
−
0
View file @
82c281de
...
@@ -22,6 +22,10 @@ getReport {
...
@@ -22,6 +22,10 @@ getReport {
super
.
role_check
(
roles
)
super
.
role_check
(
roles
)
}
}
getReport
{
super
.
is_an_internal_request
}
listReports
{
listReports
{
acls
:=
[
"listReports"
]
acls
:=
[
"listReports"
]
roles
:=
[
"REPORT_ADMIN"
,
"REPORT_VIEWER"
,
"ORG_ADMIN"
]
roles
:=
[
"REPORT_ADMIN"
,
"REPORT_VIEWER"
,
"ORG_ADMIN"
]
...
@@ -37,6 +41,10 @@ createReport {
...
@@ -37,6 +41,10 @@ createReport {
input
.
parsed_body
.
request
.
report
.
createdby
==
super
.
userid
input
.
parsed_body
.
request
.
report
.
createdby
==
super
.
userid
}
}
createReport
{
super
.
is_an_internal_request
}
deleteReport
{
deleteReport
{
acls
:=
[
"deleteReport"
]
acls
:=
[
"deleteReport"
]
roles
:=
[
"REPORT_ADMIN"
,
"ORG_ADMIN"
]
roles
:=
[
"REPORT_ADMIN"
,
"ORG_ADMIN"
]
...
@@ -51,6 +59,10 @@ updateReport {
...
@@ -51,6 +59,10 @@ updateReport {
super
.
role_check
(
roles
)
super
.
role_check
(
roles
)
}
}
updateReport
{
super
.
is_an_internal_request
}
publishReport
{
publishReport
{
acls
:=
[
"publishReport"
]
acls
:=
[
"publishReport"
]
roles
:=
[
"REPORT_ADMIN"
,
"ORG_ADMIN"
]
roles
:=
[
"REPORT_ADMIN"
,
"ORG_ADMIN"
]
...
...
This diff is collapsed.
Click to expand it.
kubernetes/opa/report/policies_test.rego
+
80
−
0
View file @
82c281de
...
@@ -26,6 +26,24 @@ test_get_report {
...
@@ -26,6 +26,24 @@ test_get_report {
}
}
}
}
test_get_report_internal_request
{
data
.
main
.
allow
.
allowed
with
data
.
common
.
current_time
as
current_time
with
data
.
common
.
iss
as
iss
with
input
as
{
"attributes"
:
{
"request"
:
{
"http"
:
{
"headers"
:
{},
"path"
:
"/report/get/1656a060-bf3a-11ec-b495-9fb99cdeb463"
,
"host"
:
"1.2.3.4"
}
}
}
}
}
test_list_reports
{
test_list_reports
{
data
.
main
.
allow
.
allowed
data
.
main
.
allow
.
allowed
with
data
.
common
.
current_time
as
current_time
with
data
.
common
.
current_time
as
current_time
...
@@ -90,6 +108,45 @@ test_create_report {
...
@@ -90,6 +108,45 @@ test_create_report {
}
}
}
}
test_create_report_internal_request
{
data
.
main
.
allow
.
allowed
with
data
.
common
.
current_time
as
current_time
with
data
.
common
.
iss
as
iss
with
input
as
{
"attributes"
:
{
"request"
:
{
"http"
:
{
"headers"
:
{},
"path"
:
"/report/create"
,
"host"
:
"1.2.3.4"
}
}
},
"parsed_body"
:
{
"request"
:
{
"report"
:
{
"title"
:
"string"
,
"description"
:
"string"
,
"authorizedroles"
:
[
"string"
],
"status"
:
"string"
,
"type"
:
"string"
,
"createdby"
:
"28b0d08f-c2ea-40d1-bcd0-8ae00fca66be"
,
"reportconfig"
:
{
"id"
:
"string"
,
"label"
:
"string"
,
"title"
:
"string"
,
"description"
:
"string"
,
},
"slug"
:
"string"
,
"reportgenerateddate"
:
"string"
,
"updatefrequency"
:
"string"
}
}
}
}
}
test_delete_report
{
test_delete_report
{
data
.
main
.
allow
.
allowed
data
.
main
.
allow
.
allowed
with
data
.
common
.
current_time
as
current_time
with
data
.
common
.
current_time
as
current_time
...
@@ -133,6 +190,29 @@ test_update_report {
...
@@ -133,6 +190,29 @@ test_update_report {
}
}
}
}
test_update_report_internal_request
{
data
.
main
.
allow
.
allowed
with
data
.
common
.
current_time
as
current_time
with
data
.
common
.
iss
as
iss
with
input
as
{
"attributes"
:
{
"request"
:
{
"http"
:
{
"headers"
:
{},
"path"
:
"/report/update"
,
"host"
:
"1.2.3.4"
}
}
},
"parsed_body"
:
{
"request"
:
{
"report"
:
{}
}
}
}
}
test_publish_report
{
test_publish_report
{
data
.
main
.
allow
.
allowed
data
.
main
.
allow
.
allowed
with
data
.
common
.
current_time
as
current_time
with
data
.
common
.
current_time
as
current_time
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets