Commit bf776824 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

fixing regression bug

parent 0f014818
Pipeline #8583 failed with stage
in 1 minute and 52 seconds
......@@ -1233,19 +1233,29 @@ ServerConnector.updateUser = function (user) {
connectedToLdap: user.isConnectedToLdap()
}
};
var canModifyPrivileges = false;
return self.sendPatchRequest(self.getUserUrl(queryParams), filterParams).then(function (response) {
canModifyPrivileges = JSON.parse(response).privileges.some(function (privilege) {
return privilege.type === PrivilegeType.USER_MANAGEMENT
|| privilege.type === PrivilegeType.PROJECT_MANAGEMENT;
return self.sendPatchRequest(self.getUserUrl(queryParams), filterParams)
.then(function () {
var currentLogin = ServerConnector.getSessionData().getLogin();
return self.sendGetRequest(self.getUserUrl({login: currentLogin}, {}));
})
.then(function (response) {
canModifyPrivileges = JSON.parse(response).privileges.some(function (privilege) {
return privilege.type === PrivilegeType.USER_MANAGEMENT
|| privilege.type === PrivilegeType.PROJECT_MANAGEMENT;
});
return self.getConfiguration();
})
.then(function (configuration) {
if (!canModifyPrivileges) {
return Promise.resolve(user);
}
return self.updateUserPrivileges({user: user, privileges: user.privilegesToExport(configuration)});
});
return self.getConfiguration();
}).then(function (configuration) {
if (!canModifyPrivileges) {
return Promise.resolve(user);
}
return self.updateUserPrivileges({user: user, privileges: user.privilegesToExport(configuration)});
});
};
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment