summaryrefslogtreecommitdiffstats
path: root/app/common/services
diff options
context:
space:
mode:
authorAppaRao Puli <apparao.puli@linux.intel.com>2018-12-06 21:51:27 +0530
committerEd Tanous <ed.tanous@intel.com>2018-12-21 22:20:17 +0000
commitf04960f5e6992ac42c4a93bcd8c2d2ff11e8d501 (patch)
tree3139eec31af5ce95300d5b53d2c970bf2e44ffbc /app/common/services
parent86caba11821c4454e1949629ad3ad11d0326db6e (diff)
downloadphosphor-webui-f04960f5e6992ac42c4a93bcd8c2d2ff11e8d501.tar.gz
phosphor-webui-f04960f5e6992ac42c4a93bcd8c2d2ff11e8d501.zip
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>
Diffstat (limited to 'app/common/services')
-rw-r--r--app/common/services/api-utils.js48
-rw-r--r--app/common/services/dataService.js3
2 files changed, 32 insertions, 19 deletions
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 @@ window.angular && (function(angular) {
});
},
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();
diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js
index 7ca13a6..76ab381 100644
--- a/app/common/services/dataService.js
+++ b/app/common/services/dataService.js
@@ -34,6 +34,9 @@ window.angular && (function(angular) {
this.errorModalDetails = {};
this.ignoreHttpError = false;
+
+ this.configJson = require('../../../config.json');
+
this.getServerId = function() {
return this.host.replace(/^https?\:\/\//ig, '');
};
OpenPOWER on IntegriCloud