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

project list is not obtained in the panel unless user has a prvilege to list projects

parent cd6afd35
Pipeline #4204 passed with stage
in 1 minute and 7 seconds
......@@ -2,6 +2,8 @@
var Promise = require('bluebird');
var PrivilegeType = require('../../map/data/PrivilegeType');
var AbstractAdminPanel = require('./AbstractAdminPanel');
var EditUserDialog = require('./EditUserDialog');
var SecurityError = require('../../SecurityError');
......@@ -172,13 +174,14 @@ UsersAdminPanel.prototype.getDialog = function (user) {
UsersAdminPanel.prototype.init = function () {
var self = this;
return ServerConnector.getUsers().then(function (users) {
return self.setUsers(users);
}).catch(function (error) {
if (error instanceof SecurityError) {
self.disablePanel("You have no privilege to manage users");
return ServerConnector.getLoggedUser().then(function (user) {
var privilege = self.getConfiguration().getPrivilegeType(PrivilegeType.USER_MANAGEMENT);
if (user.hasPrivilege(privilege)) {
return ServerConnector.getUsers().then(function (users) {
return self.setUsers(users);
});
} else {
throw error;
self.disablePanel("You have no privilege to manage users");
}
});
};
......
......@@ -17,6 +17,8 @@ PrivilegeType.prototype = Object.create(ObjectWithListeners.prototype);
PrivilegeType.prototype.constructor = PrivilegeType;
PrivilegeType.CONFIGURATION_MANAGE = 'CONFIGURATION_MANAGE';
PrivilegeType.USER_MANAGEMENT = 'USER_MANAGEMENT';
PrivilegeType.prototype.setObjectType = function (objectType) {
this._objectType = objectType;
......
[{"id":345331,"modelId":16728,"type":"ALIAS"},{"id":345337,"modelId":16731,"type":"ALIAS"},{"id":345330,"modelId":16729,"type":"ALIAS"}]
\ No newline at end of file
[{"id":345331,"modelId":16728,"type":"ALIAS"},{"id":345330,"modelId":16729,"type":"ALIAS"},{"id":345337,"modelId":16731,"type":"ALIAS"}]
\ No newline at end of file
......@@ -151,7 +151,7 @@ public enum ConfigurationElementType {
*/
REQUEST_ACCOUNT_DEFAULT_CONTENT("Email content used for requesting an account",
"Dear Disease map team,\nI would like to request an account in the system.\nKind regards",
ConfigurationElementEditType.TEXT, true),
ConfigurationElementEditType.TEXT, false),
DEFAULT_VIEW_PROJECT("Default user privilege for: " + PrivilegeType.VIEW_PROJECT.getCommonName(), "true",
ConfigurationElementEditType.BOOLEAN, true),
......
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