added access_control to combinedequipment
parent
b9de4e3c43
commit
fb31837efa
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
app.controller('CombinedEquipmentController', function ($scope, $translate, $uibModal, CombinedEquipmentService, CostCenterService, toaster, SweetAlert) {
|
app.controller('CombinedEquipmentController', function ($scope, $window, $translate, $uibModal, CombinedEquipmentService, CostCenterService, toaster, SweetAlert) {
|
||||||
|
$scope.cur_user = JSON.parse($window.localStorage.getItem("myems_admin_ui_current_user"));
|
||||||
$scope.getAllCombinedEquipments = function () {
|
$scope.getAllCombinedEquipments = function () {
|
||||||
CombinedEquipmentService.getAllCombinedEquipments(function (response) {
|
CombinedEquipmentService.getAllCombinedEquipments(function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 200) {
|
if (angular.isDefined(response.status) && response.status === 200) {
|
||||||
|
@ -36,7 +36,8 @@ app.controller('CombinedEquipmentController', function ($scope, $translate, $uib
|
||||||
});
|
});
|
||||||
modalInstance.result.then(function (combinedequipment) {
|
modalInstance.result.then(function (combinedequipment) {
|
||||||
combinedequipment.cost_center_id = combinedequipment.cost_center.id;
|
combinedequipment.cost_center_id = combinedequipment.cost_center.id;
|
||||||
CombinedEquipmentService.addCombinedEquipment(combinedequipment, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentService.addCombinedEquipment(combinedequipment, headers,function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 201) {
|
if (angular.isDefined(response.status) && response.status === 201) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -76,8 +77,9 @@ app.controller('CombinedEquipmentController', function ($scope, $translate, $uib
|
||||||
});
|
});
|
||||||
|
|
||||||
modalInstance.result.then(function (modifiedCombinedEquipment) {
|
modalInstance.result.then(function (modifiedCombinedEquipment) {
|
||||||
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
modifiedCombinedEquipment.cost_center_id = modifiedCombinedEquipment.cost_center.id;
|
modifiedCombinedEquipment.cost_center_id = modifiedCombinedEquipment.cost_center.id;
|
||||||
CombinedEquipmentService.editCombinedEquipment(modifiedCombinedEquipment, function (response) {
|
CombinedEquipmentService.editCombinedEquipment(modifiedCombinedEquipment, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 200) {
|
if (angular.isDefined(response.status) && response.status === 200) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -115,7 +117,8 @@ app.controller('CombinedEquipmentController', function ($scope, $translate, $uib
|
||||||
},
|
},
|
||||||
function (isConfirm) {
|
function (isConfirm) {
|
||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
CombinedEquipmentService.deleteCombinedEquipment(combinedequipment, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentService.deleteCombinedEquipment(combinedequipment, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 204) {
|
if (angular.isDefined(response.status) && response.status === 204) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
app.controller('CombinedEquipmentEquipmentController', function ($scope, $translate, CombinedEquipmentService, EquipmentService, CombinedEquipmentEquipmentService, toaster, SweetAlert) {
|
app.controller('CombinedEquipmentEquipmentController', function ($scope, $window, $translate, CombinedEquipmentService, EquipmentService, CombinedEquipmentEquipmentService, toaster, SweetAlert) {
|
||||||
|
$scope.cur_user = JSON.parse($window.localStorage.getItem("myems_admin_ui_current_user"));
|
||||||
$scope.currentCombinedEquipment = {selected:undefined};
|
$scope.currentCombinedEquipment = {selected:undefined};
|
||||||
|
|
||||||
$scope.getAllEquipments = function () {
|
$scope.getAllEquipments = function () {
|
||||||
|
@ -42,7 +43,8 @@ app.controller('CombinedEquipmentEquipmentController', function ($scope, $transl
|
||||||
$scope.pairEquipment = function (dragEl, dropEl) {
|
$scope.pairEquipment = function (dragEl, dropEl) {
|
||||||
var equipmentid = angular.element('#' + dragEl).scope().equipment.id;
|
var equipmentid = angular.element('#' + dragEl).scope().equipment.id;
|
||||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||||
CombinedEquipmentEquipmentService.addPair(combinedequipmentid, equipmentid, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentEquipmentService.addPair(combinedequipmentid, equipmentid, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 201) {
|
if (angular.isDefined(response.status) && response.status === 201) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -69,7 +71,8 @@ app.controller('CombinedEquipmentEquipmentController', function ($scope, $transl
|
||||||
}
|
}
|
||||||
var combinedequipmentequipmentid = angular.element('#' + dragEl).scope().combinedequipmentequipment.id;
|
var combinedequipmentequipmentid = angular.element('#' + dragEl).scope().combinedequipmentequipment.id;
|
||||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||||
CombinedEquipmentEquipmentService.deletePair(combinedequipmentid, combinedequipmentequipmentid, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentEquipmentService.deletePair(combinedequipmentid, combinedequipmentequipmentid, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 204) {
|
if (angular.isDefined(response.status) && response.status === 204) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
app.controller('CombinedEquipmentMeterController', function ($scope, $timeout, $uibModal, $translate, MeterService, VirtualMeterService, OfflineMeterService, CombinedEquipmentMeterService, CombinedEquipmentService, toaster, SweetAlert) {
|
app.controller('CombinedEquipmentMeterController', function ($scope, $window, $timeout, $uibModal, $translate, MeterService, VirtualMeterService, OfflineMeterService, CombinedEquipmentMeterService, CombinedEquipmentService, toaster, SweetAlert) {
|
||||||
|
$scope.cur_user = JSON.parse($window.localStorage.getItem("myems_admin_ui_current_user"));
|
||||||
$scope.currentCombinedEquipment = { selected: undefined };
|
$scope.currentCombinedEquipment = { selected: undefined };
|
||||||
|
|
||||||
$scope.getAllCombinedEquipments = function (id) {
|
$scope.getAllCombinedEquipments = function (id) {
|
||||||
|
@ -111,7 +112,8 @@ app.controller('CombinedEquipmentMeterController', function ($scope, $timeout, $
|
||||||
modalInstance.result.then(function (is_output) {
|
modalInstance.result.then(function (is_output) {
|
||||||
var meterid = angular.element('#' + dragEl).scope().meter.id;
|
var meterid = angular.element('#' + dragEl).scope().meter.id;
|
||||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||||
CombinedEquipmentMeterService.addPair(combinedequipmentid, meterid, $scope.currentMeterType, is_output, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentMeterService.addPair(combinedequipmentid, meterid, $scope.currentMeterType, is_output, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 201) {
|
if (angular.isDefined(response.status) && response.status === 201) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -141,7 +143,8 @@ app.controller('CombinedEquipmentMeterController', function ($scope, $timeout, $
|
||||||
var combinedequipmentmeterid = angular.element('#' + dragEl).scope().combinedequipmentmeter.id;
|
var combinedequipmentmeterid = angular.element('#' + dragEl).scope().combinedequipmentmeter.id;
|
||||||
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
var combinedequipmentid = $scope.currentCombinedEquipment.id;
|
||||||
var metertype = angular.element('#' + dragEl).scope().combinedequipmentmeter.metertype;
|
var metertype = angular.element('#' + dragEl).scope().combinedequipmentmeter.metertype;
|
||||||
CombinedEquipmentMeterService.deletePair(combinedequipmentid, combinedequipmentmeterid, metertype, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentMeterService.deletePair(combinedequipmentid, combinedequipmentmeterid, metertype, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 204) {
|
if (angular.isDefined(response.status) && response.status === 204) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
|
|
@ -73,8 +73,8 @@ app.controller('CombinedEquipmentParameterController', function (
|
||||||
if (combinedequipmentparameter.denominator_meter != null) {
|
if (combinedequipmentparameter.denominator_meter != null) {
|
||||||
combinedequipmentparameter.denominator_meter_uuid = combinedequipmentparameter.denominator_meter.uuid;
|
combinedequipmentparameter.denominator_meter_uuid = combinedequipmentparameter.denominator_meter.uuid;
|
||||||
}
|
}
|
||||||
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
CombinedEquipmentParameterService.addCombinedEquipmentParameter(combinedequipmentid, combinedequipmentparameter, function (response) {
|
CombinedEquipmentParameterService.addCombinedEquipmentParameter(combinedequipmentid, combinedequipmentparameter, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 201) {
|
if (angular.isDefined(response.status) && response.status === 201) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -123,7 +123,8 @@ app.controller('CombinedEquipmentParameterController', function (
|
||||||
if (modifiedCombinedEquipmentParameter.denominator_meter != null) {
|
if (modifiedCombinedEquipmentParameter.denominator_meter != null) {
|
||||||
modifiedCombinedEquipmentParameter.denominator_meter_uuid = modifiedCombinedEquipmentParameter.denominator_meter.uuid;
|
modifiedCombinedEquipmentParameter.denominator_meter_uuid = modifiedCombinedEquipmentParameter.denominator_meter.uuid;
|
||||||
}
|
}
|
||||||
CombinedEquipmentParameterService.editCombinedEquipmentParameter($scope.currentCombinedEquipment.id, modifiedCombinedEquipmentParameter, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentParameterService.editCombinedEquipmentParameter($scope.currentCombinedEquipment.id, modifiedCombinedEquipmentParameter, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 200) {
|
if (angular.isDefined(response.status) && response.status === 200) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
@ -160,7 +161,8 @@ app.controller('CombinedEquipmentParameterController', function (
|
||||||
},
|
},
|
||||||
function (isConfirm) {
|
function (isConfirm) {
|
||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
CombinedEquipmentParameterService.deleteCombinedEquipmentParameter($scope.currentCombinedEquipment.id, combinedequipmentparameter.id, function (response) {
|
let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
|
||||||
|
CombinedEquipmentParameterService.deleteCombinedEquipmentParameter($scope.currentCombinedEquipment.id, combinedequipmentparameter.id, headers, function (response) {
|
||||||
if (angular.isDefined(response.status) && response.status === 204) {
|
if (angular.isDefined(response.status) && response.status === 204) {
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
|
|
@ -17,24 +17,24 @@ app.factory('CombinedEquipmentService', function($http) {
|
||||||
callback(response);
|
callback(response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addCombinedEquipment: function(combinedequipment, callback) {
|
addCombinedEquipment: function(combinedequipment, headers, callback) {
|
||||||
$http.post(getAPI()+'combinedequipments',{data:combinedequipment})
|
$http.post(getAPI()+'combinedequipments',{data:combinedequipment}, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editCombinedEquipment: function(combinedequipment, callback) {
|
editCombinedEquipment: function(combinedequipment, headers, callback) {
|
||||||
$http.put(getAPI()+'combinedequipments/'+combinedequipment.id,{data:combinedequipment})
|
$http.put(getAPI()+'combinedequipments/'+combinedequipment.id,{data:combinedequipment}, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteCombinedEquipment: function(combinedequipment, callback) {
|
deleteCombinedEquipment: function(combinedequipment, headers, callback) {
|
||||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipment.id)
|
$http.delete(getAPI()+'combinedequipments/'+combinedequipment.id, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
app.factory('CombinedEquipmentEquipmentService', function($http) {
|
app.factory('CombinedEquipmentEquipmentService', function($http) {
|
||||||
return {
|
return {
|
||||||
addPair: function(combinedequipmentID,equipmentID,callback) {
|
addPair: function(combinedequipmentID,equipmentID, headers, callback) {
|
||||||
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments',{data:{'equipment_id':equipmentID}})
|
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments',{data:{'equipment_id':equipmentID}} ,{headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
@ -10,8 +10,8 @@ app.factory('CombinedEquipmentEquipmentService', function($http) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deletePair: function(combinedequipmentID, equipmentID, callback) {
|
deletePair: function(combinedequipmentID, equipmentID, headers, callback) {
|
||||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments/'+equipmentID)
|
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/equipments/'+equipmentID, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
app.factory('CombinedEquipmentMeterService', function ($http) {
|
app.factory('CombinedEquipmentMeterService', function ($http) {
|
||||||
return {
|
return {
|
||||||
addPair: function (combinedequipmentID, meterID, metertype, is_output, callback) {
|
addPair: function (combinedequipmentID, meterID, metertype, is_output, headers, callback) {
|
||||||
var meter = {};
|
var meter = {};
|
||||||
if (metertype == 'meters') {
|
if (metertype == 'meters') {
|
||||||
meter = { 'meter_id': meterID, is_output: is_output };
|
meter = { 'meter_id': meterID, is_output: is_output };
|
||||||
|
@ -10,7 +10,7 @@ app.factory('CombinedEquipmentMeterService', function ($http) {
|
||||||
} else {
|
} else {
|
||||||
meter = { 'offline_meter_id': meterID, is_output: is_output };
|
meter = { 'offline_meter_id': meterID, is_output: is_output };
|
||||||
}
|
}
|
||||||
$http.post(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype, { data: meter })
|
$http.post(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype, { data: meter }, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
@ -18,8 +18,8 @@ app.factory('CombinedEquipmentMeterService', function ($http) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deletePair: function (combinedequipmentID, meterID, metertype, callback) {
|
deletePair: function (combinedequipmentID, meterID, metertype, headers, callback) {
|
||||||
$http.delete(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype + '/' + meterID)
|
$http.delete(getAPI() + 'combinedequipments/' + combinedequipmentID + '/' + metertype + '/' + meterID, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
|
|
@ -10,16 +10,17 @@ app.factory('CombinedEquipmentParameterService', function($http) {
|
||||||
callback(response);
|
callback(response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addCombinedEquipmentParameter: function(combinedequipmentID, combinedequipmentparameter,callback) {
|
addCombinedEquipmentParameter: function(combinedequipmentID, combinedequipmentparameter, headers, callback) {
|
||||||
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters',{data:combinedequipmentparameter})
|
$http.post(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters',{data:combinedequipmentparameter}, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editCombinedEquipmentParameter: function(combinedequipmentID,combinedequipmentparameter,callback) {
|
editCombinedEquipmentParameter: function(combinedequipmentID,combinedequipmentparameter, headers, callback) {
|
||||||
$http.put(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+combinedequipmentparameter.id,{data:combinedequipmentparameter})
|
$http.put(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+combinedequipmentparameter.id,{data:combinedequipmentparameter}
|
||||||
|
, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
@ -27,8 +28,8 @@ app.factory('CombinedEquipmentParameterService', function($http) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteCombinedEquipmentParameter: function(combinedequipmentID, parameterID, callback) {
|
deleteCombinedEquipmentParameter: function(combinedequipmentID, parameterID, headers, callback) {
|
||||||
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+parameterID)
|
$http.delete(getAPI()+'combinedequipments/'+combinedequipmentID+'/parameters/'+parameterID, {headers})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
callback(response);
|
callback(response);
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import simplejson as json
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
import config
|
import config
|
||||||
import uuid
|
import uuid
|
||||||
from core.useractivity import user_logger
|
from core.useractivity import user_logger, access_control
|
||||||
|
|
||||||
|
|
||||||
class CombinedEquipmentCollection:
|
class CombinedEquipmentCollection:
|
||||||
|
@ -62,6 +62,7 @@ class CombinedEquipmentCollection:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp):
|
def on_post(req, resp):
|
||||||
"""Handles POST requests"""
|
"""Handles POST requests"""
|
||||||
|
access_control(req)
|
||||||
try:
|
try:
|
||||||
raw_json = req.stream.read().decode('utf-8')
|
raw_json = req.stream.read().decode('utf-8')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -204,6 +205,7 @@ class CombinedEquipmentItem:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_delete(req, resp, id_):
|
def on_delete(req, resp, id_):
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -279,6 +281,7 @@ class CombinedEquipmentItem:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_put(req, resp, id_):
|
def on_put(req, resp, id_):
|
||||||
"""Handles PUT requests"""
|
"""Handles PUT requests"""
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -376,6 +379,7 @@ class CombinedEquipmentItem:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp, id_):
|
def on_post(req, resp, id_):
|
||||||
"""Handles PUT requests"""
|
"""Handles PUT requests"""
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -566,6 +570,7 @@ class CombinedEquipmentEquipmentCollection:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp, id_):
|
def on_post(req, resp, id_):
|
||||||
"""Handles POST requests"""
|
"""Handles POST requests"""
|
||||||
|
access_control(req)
|
||||||
try:
|
try:
|
||||||
raw_json = req.stream.read().decode('utf-8')
|
raw_json = req.stream.read().decode('utf-8')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -640,6 +645,7 @@ class CombinedEquipmentEquipmentItem:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_delete(req, resp, id_, eid):
|
def on_delete(req, resp, id_, eid):
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -824,6 +830,7 @@ class CombinedEquipmentParameterCollection:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp, id_):
|
def on_post(req, resp, id_):
|
||||||
"""Handles POST requests"""
|
"""Handles POST requests"""
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -1132,6 +1139,7 @@ class CombinedEquipmentParameterItem:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_delete(req, resp, id_, pid):
|
def on_delete(req, resp, id_, pid):
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -1180,6 +1188,7 @@ class CombinedEquipmentParameterItem:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_put(req, resp, id_, pid):
|
def on_put(req, resp, id_, pid):
|
||||||
"""Handles PUT requests"""
|
"""Handles PUT requests"""
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -1439,6 +1448,7 @@ class CombinedEquipmentMeterCollection:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp, id_):
|
def on_post(req, resp, id_):
|
||||||
"""Handles POST requests"""
|
"""Handles POST requests"""
|
||||||
|
access_control(req)
|
||||||
try:
|
try:
|
||||||
raw_json = req.stream.read().decode('utf-8')
|
raw_json = req.stream.read().decode('utf-8')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -1519,6 +1529,7 @@ class CombinedEquipmentMeterItem:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_delete(req, resp, id_, mid):
|
def on_delete(req, resp, id_, mid):
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -1629,6 +1640,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp, id_):
|
def on_post(req, resp, id_):
|
||||||
"""Handles POST requests"""
|
"""Handles POST requests"""
|
||||||
|
access_control(req)
|
||||||
try:
|
try:
|
||||||
raw_json = req.stream.read().decode('utf-8')
|
raw_json = req.stream.read().decode('utf-8')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -1710,6 +1722,7 @@ class CombinedEquipmentOfflineMeterItem:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_delete(req, resp, id_, mid):
|
def on_delete(req, resp, id_, mid):
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
@ -1820,6 +1833,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_post(req, resp, id_):
|
def on_post(req, resp, id_):
|
||||||
"""Handles POST requests"""
|
"""Handles POST requests"""
|
||||||
|
access_control(req)
|
||||||
try:
|
try:
|
||||||
raw_json = req.stream.read().decode('utf-8')
|
raw_json = req.stream.read().decode('utf-8')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -1901,6 +1915,7 @@ class CombinedEquipmentVirtualMeterItem:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@user_logger
|
@user_logger
|
||||||
def on_delete(req, resp, id_, mid):
|
def on_delete(req, resp, id_, mid):
|
||||||
|
access_control(req)
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
description='API.INVALID_COMBINED_EQUIPMENT_ID')
|
||||||
|
|
Loading…
Reference in New Issue