stephb9959
2023-10-19 16:23:55 -07:00
parent 35f4e26ca4
commit ab95733067
2 changed files with 20 additions and 4 deletions

View File

@@ -1003,6 +1003,14 @@ components:
- $ref: '#/components/schemas/RRM_bss_transition' - $ref: '#/components/schemas/RRM_bss_transition'
- $ref: '#/components/schemas/RRM_neighbors' - $ref: '#/components/schemas/RRM_neighbors'
RRM_actions:
type: object
properties:
actions:
type: array
items:
$ref: '#/components/schemas/RRM_action'
######################################################################################### #########################################################################################
## ##
## These are endpoints that all services in the uCentral stack must provide ## These are endpoints that all services in the uCentral stack must provide
@@ -2929,9 +2937,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: array $ref: '#/components/schemas/RRM_actions'
items:
$ref: '#/components/schemas/RRM_action'
responses: responses:
200: 200:
$ref: '#/components/responses/Success' $ref: '#/components/responses/Success'

View File

@@ -1346,6 +1346,7 @@ namespace OpenWifi {
const std::string &CMD_UUID, uint64_t CMD_RPC, const std::string &CMD_UUID, uint64_t CMD_RPC,
[[maybe_unused]] std::chrono::milliseconds timeout, [[maybe_unused]] std::chrono::milliseconds timeout,
[[maybe_unused]] const GWObjects::DeviceRestrictions &Restrictions) { [[maybe_unused]] const GWObjects::DeviceRestrictions &Restrictions) {
poco_debug(Logger_, fmt::format("RRM({},{}): TID={} user={} serial={}", CMD_UUID, poco_debug(Logger_, fmt::format("RRM({},{}): TID={} user={} serial={}", CMD_UUID,
CMD_RPC, TransactionId_, Requester(), SerialNumber_)); CMD_RPC, TransactionId_, Requester(), SerialNumber_));
@@ -1354,8 +1355,17 @@ namespace OpenWifi {
return BadRequest(RESTAPI::Errors::SimulatedDeviceNotSupported); return BadRequest(RESTAPI::Errors::SimulatedDeviceNotSupported);
} }
const auto & Actions = *ParsedBody_->getArray("actions"); if(UserInfo_.userinfo.userRole != SecurityObjects::ROOT &&
UserInfo_.userinfo.userRole != SecurityObjects::ADMIN) {
CallCanceled("RRM", CMD_UUID, CMD_RPC, RESTAPI::Errors::ACCESS_DENIED);
return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED);
}
if(!ParsedBody_->has("actions") || !ParsedBody_->isArray("actions")) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
const auto &Actions = *ParsedBody_->getArray("actions");
// perform some validation on the commands. // perform some validation on the commands.
for(const auto &action:Actions) { for(const auto &action:Actions) {
auto ActionDetails = action.extract<Poco::JSON::Object::Ptr>(); auto ActionDetails = action.extract<Poco::JSON::Object::Ptr>();