Fix event_service privileges
Post method:
1) redfish/v1/EventService/Subscriptions/
ConfigureManager -> [ConfigureManager or ConfigureComponents]
This change allows Admin and Operator both users to subscribe to the
particular event, where only admin user has the ability before this
change.
Tested: manually tested on Witherspoon system. Only ConfigureManager or
ConfigureComponents privilege users can subscribe to an event.
TestURL:
curl -k -H "X-Auth-Token: $bmc_token" -X POST -d
'{"Context": "9.3.147.232",
"DeliveryRetryPolicy": "TerminateAfterRetries",
"Destination": "https://9.3.147.232:17443/redfish/events",
"EventFormatType": "Event",
"MessageIds": [],
"MetricReportDefinitions": [],
"Protocol": "Redfish",
"RegistryPrefixes": [],
"ResourceTypes": [],
"SubscriptionType": "RedfishEvent"}'
https://${BMC_IP}/redfish/v1/EventService/Subscriptions
Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com>
Change-Id: I4d3bcfaab7f5a00ada99a30fdb8f17d85531a2a8
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index f1d6f50..67ad014 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -194,10 +194,7 @@
}
});
BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/")
- // The below privilege is wrong, it should be ConfigureManager OR
- // ConfigureComponents
- //.privileges(redfish::privileges::postEventDestinationCollection)
- .privileges({{"ConfigureManager"}})
+ .privileges(redfish::privileges::postEventDestinationCollection)
.methods(boost::beast::http::verb::post)(
[](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
@@ -542,12 +539,10 @@
asyncResp->res.jsonValue["MetricReportDefinitions"] =
mrdJsonArray;
});
- /////redfish/v1/EventService/Subscriptions/
- // ConfigureManager
BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/")
// The below privilege is wrong, it should be ConfigureManager OR
// ConfigureSelf
- // TODO(ed) follow up with DMTF spec and understand ConfigureSelf
+ // https://github.com/openbmc/bmcweb/issues/220
//.privileges(redfish::privileges::patchEventDestination)
.privileges({{"ConfigureManager"}})
.methods(boost::beast::http::verb::patch)(
@@ -604,6 +599,7 @@
BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/")
// The below privilege is wrong, it should be ConfigureManager OR
// ConfigureSelf
+ // https://github.com/openbmc/bmcweb/issues/220
//.privileges(redfish::privileges::deleteEventDestination)
.privileges({{"ConfigureManager"}})
.methods(boost::beast::http::verb::delete_)(