-
Notifications
You must be signed in to change notification settings - Fork 104
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
Bug fix for: Admin Users must be able to access all monitors #139 #280
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,6 +509,25 @@ class SecureMonitorRestApiIT : AlertingRestTestCase() { | |
) | ||
assertEquals("Search monitor failed", RestStatus.OK, adminSearchResponse.restStatus()) | ||
assertEquals("Monitor not found during search", 1, getDocs(adminSearchResponse)) | ||
|
||
// get as "admin" - must get 1 docs | ||
val id: String = monitorJson["_id"] as String | ||
val adminGetResponse = client().makeRequest( | ||
"GET", | ||
"$ALERTING_BASE_URI/$id", | ||
emptyMap(), | ||
NStringEntity(search, ContentType.APPLICATION_JSON) | ||
) | ||
assertEquals("Get monitor failed", RestStatus.OK, adminGetResponse.restStatus()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a more descriptive error message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that is fine since its is part of the assertion failure which would mean the request failed to get the monitor |
||
|
||
// delete as "admin" | ||
val adminDeleteResponse = client().makeRequest( | ||
"DELETE", | ||
"$ALERTING_BASE_URI/$id", | ||
emptyMap(), | ||
NStringEntity(search, ContentType.APPLICATION_JSON) | ||
) | ||
assertEquals("Delete monitor failed", RestStatus.OK, adminGetResponse.restStatus()) | ||
} finally { | ||
deleteRoleMapping("hr_role") | ||
deleteRole("hr_role") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add assertion check for ID?