Commit 4b5a0ea8 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Merge remote-tracking branch 'remotes/origin/devel_12.1.x' into 659-updateUser-fix

# Conflicts:
#	frontend-js/src/main/js/ServerConnector.js
parents dda185dc 69929e66
minerva (12.1.7) stable; urgency=medium
* Bug fix: problems with updating privileges introduced in 12.1.6 fixed
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 6 Feb 2019 15:30:00 +0200
minerva (12.1.6) stable; urgency=medium
* Bug fix: logo on login page was broken with image link being full url
* Bug fix: plugin API had sometimes problems with fetching reactions
......
This diff is collapsed.
......@@ -1233,18 +1233,28 @@ 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) && parseInt(privilege.value) === 1;
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) && parseInt(privilege.value) === 1;
});
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)});
});
};
/**
......
{"connectedToLdap":"Unknown column","email":"test_user","id":6,"ldapAccountAvailable":"Unknown column","login":"test_user","maxColor":null,"minColor":null,"name":"test_user","neutralColor":null,"privileges":[{"objectId":4,"type":"VIEW_PROJECT","value":1},{"objectId":4,"type":"EDIT_COMMENTS_PROJECT","value":0},{"objectId":4,"type":"LAYOUT_MANAGEMENT","value":0},{"objectId":null,"type":"VIEW_PROJECT","value":1},{"objectId":null,"type":"EDIT_COMMENTS_PROJECT","value":0},{"objectId":null,"type":"LAYOUT_MANAGEMENT","value":0},{"type":"CUSTOM_LAYOUTS","value":5},{"type":"CUSTOM_LAYOUTS_AVAILABLE","value":5}],"removed":false,"simpleColor":null,"surname":"test_user","termsOfUseConsent":true}
\ No newline at end of file
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