Skip to content
Snippets Groups Projects
Commit 9b97b6b3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

privilegesToExport removed

parent 8fa01dbd
No related branches found
No related tags found
1 merge request!836Resolve "Implement Spring Security"
Pipeline #11832 failed
......@@ -305,36 +305,6 @@ User.prototype.revokePrivilege = function (authority) {
}
};
/**
*
* @param {Configuration} configuration
*
* @returns {Object}
*/
User.prototype.privilegesToExport = function (configuration) {
var self = this;
var result = {};
var validTypes = {};
var i;
for (i = 0; i < configuration.getPrivilegeTypes().length; i++) {
validTypes[configuration.getPrivilegeTypes()[i].getName()] = true;
}
for (i = 0; i < self.getPrivileges().length; i++) {
var privilege = self.getPrivileges()[i];
if (validTypes[privilege.privilegeType]) {
if (result[privilege.privilegeType] === undefined) {
result[privilege.privilegeType] = {};
}
if (privilege.objectId !== undefined) {
result[privilege.privilegeType][privilege.objectId] = privilege.value;
} else {
result[privilege.privilegeType] = privilege.value;
}
}
}
return result;
};
/**
*
* @param {User} user
......
......@@ -115,7 +115,7 @@ describe('EditUserDialog', function () {
var serializedPrivileges;
return ServerConnector.getUser("anonymous").then(function (result) {
user = result;
serializedPrivileges = user.privilegesToExport(helper.getConfiguration());
serializedPrivileges = user.getPrivileges().slice();
return ServerConnector.getProject();
}).then(function (result) {
project = result;
......@@ -126,7 +126,7 @@ describe('EditUserDialog', function () {
checkbox.checked = !checkbox.checked;
return helper.triggerJqueryEvent(checkbox, "click");
}).then(function () {
expect(serializedPrivileges).not.to.deep.equal(user.privilegesToExport(helper.getConfiguration()));
expect(serializedPrivileges).not.to.deep.equal(user.getPrivileges());
dialog.destroy();
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment