Commit d2ec5a43 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

PrivilegeTypes changed

parent 4fd867b9
......@@ -159,7 +159,7 @@ ConfigurationAdminPanel.prototype.init = function () {
return self.getServerConnector().getLoggedUser();
}).then(function (user) {
var configuration = self.getConfiguration();
var privilege = configuration.getPrivilegeType(PrivilegeType.CONFIGURATION_MANAGE);
var privilege = configuration.getPrivilegeType(PrivilegeType.IS_ADMIN);
if (user.hasPrivilege(privilege)) {
return self.setOptions(configuration.getOptions());
} else {
......
......@@ -168,7 +168,7 @@ GenomeAdminPanel.prototype.init = function () {
return AbstractAdminPanel.prototype.init.call(this).then(function () {
return self.getServerConnector().getLoggedUser();
}).then(function (user) {
if (user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.MANAGE_GENOMES))) {
if (user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN))) {
return self.onRefreshClicked();
} else {
self.disablePanel("You have no privilege to manage genomes");
......
......@@ -193,7 +193,8 @@ MapsAdminPanel.prototype.init = function () {
return self.getServerConnector().getLoggedUser();
}).then(function (user) {
var configuration = self.getConfiguration();
var canAddProject = user.hasPrivilege(configuration.getPrivilegeType(PrivilegeType.ADD_MAP));
var canAddProject = user.hasPrivilege(configuration.getPrivilegeType(PrivilegeType.IS_CURATOR)) ||
user.hasPrivilege(configuration.getPrivilegeType(PrivilegeType.IS_ADMIN));
$("[name='addProject']", self.getElement()).attr("disabled", !canAddProject);
});
};
......@@ -242,7 +243,8 @@ MapsAdminPanel.prototype.projectToTableRow = function (project, row, user) {
row[4] = status;
var disabled = " disabled ";
if (user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.PROJECT_MANAGEMENT))
if ((user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN)) ||
user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.IS_CURATOR)))
&& (status.indexOf("Ok") === 0 || status.indexOf("Failure") === 0)) {
disabled = "";
}
......@@ -332,7 +334,7 @@ MapsAdminPanel.prototype.addUpdateListener = function (project) {
for (var i = 0; i < length; i++) {
var row = dataTable.row(i);
var data = row.data();
if (data[0].indexOf(">" + project.getProjectId() + "<")>=0) {
if (data[0].indexOf(">" + project.getProjectId() + "<") >= 0) {
self.projectToTableRow(project, data, user);
row.data(data).draw();
}
......
......@@ -143,7 +143,7 @@ PluginAdminPanel.prototype.init = function () {
return AbstractAdminPanel.prototype.init.call(this).then(function () {
return self.getServerConnector().getLoggedUser();
}).then(function (user) {
if (user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.MANAGE_PLUGINS))) {
if (user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN))) {
return self.onRefreshClicked();
} else {
self.disablePanel("You have no privilege to manage plugins");
......
......@@ -252,7 +252,7 @@ UsersAdminPanel.prototype.init = function () {
return AbstractAdminPanel.prototype.init.call(this).then(function () {
return self.getServerConnector().getLoggedUser();
}).then(function (user) {
var privilege = self.getConfiguration().getPrivilegeType(PrivilegeType.USER_MANAGEMENT);
var privilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN);
if (user.hasPrivilege(privilege)) {
return self.getServerConnector().getUsers().then(function (users) {
return self.setUsers(users);
......
......@@ -30,14 +30,11 @@ function PrivilegeType(data, name) {
PrivilegeType.prototype = Object.create(ObjectWithListeners.prototype);
PrivilegeType.prototype.constructor = PrivilegeType;
PrivilegeType.CONFIGURATION_MANAGE = 'CONFIGURATION_MANAGE';
PrivilegeType.MANAGE_GENOMES = 'MANAGE_GENOMES';
PrivilegeType.MANAGE_PLUGINS = 'MANAGE_PLUGINS';
PrivilegeType.PROJECT_MANAGEMENT = 'PROJECT_MANAGEMENT';
PrivilegeType.ADD_MAP = 'ADD_MAP';
PrivilegeType.USER_MANAGEMENT = 'USER_MANAGEMENT';
PrivilegeType.LAYOUT_MANAGEMENT = 'LAYOUT_MANAGEMENT';
PrivilegeType.EDIT_COMMENTS_PROJECT = 'EDIT_COMMENTS_PROJECT';
PrivilegeType.READ_PROJECT = 'READ_PROJECT';
PrivilegeType.WRITE_PROJECT = 'WRITE_PROJECT';
PrivilegeType.IS_ADMIN = 'IS_ADMIN';
PrivilegeType.IS_CURATOR = 'IS_CURATOR';
PrivilegeType.CAN_CREATE_OVERLAYS = 'CAN_CREATE_OVERLAYS';
/**
......
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