Commit 9b97b6b3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

privilegesToExport removed

parent 8fa01dbd
Pipeline #11832 failed with stage
in 16 minutes and 41 seconds
......@@ -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();
});
});
......
Supports Markdown
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