Enabling redfish support under configuration.
This commit contains:
1) Enabling redfish support under configuration.
While loading header, get the redfish root node
and sets the redfishSupport configuration param.
2) Depending on redfish support flag, it decide to
use redfish URI or REST uri for user password
change.
Tested:
- Tested both redfish enable and dsiable scenarios.
Change-Id: I98ecc7f419ddcfdbfac9c212ad2834479e9986b5
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 759d12c..31a2958 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -509,25 +509,35 @@
});
},
changePassword: function(user, newPassword) {
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: DataService.getHost() + '/xyz/openbmc_project/user/' + user +
- '/action/SetPassword',
- withCredentials: true,
- data: JSON.stringify({'data': [newPassword]}),
- responseType: 'arraybuffer'
- })
- .then(
- function(response, status, headers) {
- deferred.resolve(
- {data: response, status: status, headers: headers});
- },
- function(error) {
- console.log(error);
- deferred.reject(error);
- });
- return deferred.promise;
+ if (DataService.configJson.redfishSupportEnabled) {
+ return $http({
+ method: 'PATCH',
+ url: DataService.getHost() +
+ '/redfish/v1/AccountService/Accounts/' + user,
+ withCredentials: true,
+ data: JSON.stringify({'Password': newPassword})
+ });
+ } else {
+ var deferred = $q.defer();
+ $http({
+ method: 'POST',
+ url: DataService.getHost() + '/xyz/openbmc_project/user/' + user +
+ '/action/SetPassword',
+ withCredentials: true,
+ data: JSON.stringify({'data': [newPassword]}),
+ responseType: 'arraybuffer'
+ })
+ .then(
+ function(response, status, headers) {
+ deferred.resolve(
+ {data: response, status: status, headers: headers});
+ },
+ function(error) {
+ console.log(error);
+ deferred.reject(error);
+ });
+ return deferred.promise;
+ }
},
chassisPowerOff: function() {
var deferred = $q.defer();