Commit 5ebf8c92 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

privilege types changed

parent be94d8fc
......@@ -112,9 +112,10 @@ CommentsAdminPanel.prototype.refreshComments = function () {
comments = result;
return self.getServerConnector().getLoggedUser();
}).then(function (user) {
var type = self.getConfiguration().getPrivilegeType(PrivilegeType.EDIT_COMMENTS_PROJECT);
var disable = false;
if (!user.hasPrivilege(type, self.getProject().getId())) {
var writeAccess = self.getConfiguration().getPrivilegeType(PrivilegeType.WRITE_PROJECT);
var isAdmin = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN);
var disable = true;
if (user.hasPrivilege(writeAccess, self.getProject().getId()) || user.hasPrivilege(isAdmin)) {
disable = true;
}
......
......@@ -749,9 +749,10 @@ EditProjectDialog.prototype.initUsersTab = function () {
EditProjectDialog.prototype.refreshOverlays = function () {
var self = this;
return self.getServerConnector().getLoggedUser().then(function (user) {
var privilege = self.getConfiguration().getPrivilegeType(PrivilegeType.USER_MANAGEMENT);
var curatorPrivilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_CURATOR);
var adminPrivilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN);
//we need to refresh users as well because of privileges
if (user.hasPrivilege(privilege)) {
if (user.hasPrivilege(curatorPrivilege) || user.hasPrivilege(adminPrivilege)) {
return self.getServerConnector().getOverlays({
projectId: self.getProject().getProjectId()
}).then(function (overlays) {
......@@ -781,9 +782,10 @@ EditProjectDialog.prototype.refreshMaps = function () {
EditProjectDialog.prototype.refreshUsers = function () {
var self = this;
return self.getServerConnector().getLoggedUser().then(function (user) {
var privilege = self.getConfiguration().getPrivilegeType(PrivilegeType.USER_MANAGEMENT);
var curatorPrivilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_CURATOR);
var adminPrivilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN);
//we need to refresh users as well because of privileges
if (user.hasPrivilege(privilege)) {
if (user.hasPrivilege(curatorPrivilege) || user.hasPrivilege(adminPrivilege)) {
return ServerConnector.getUsers(true).then(function (users) {
return self.setUsers(users);
});
......
......@@ -416,9 +416,10 @@ MapsAdminPanel.prototype.onRefreshClicked = function () {
}).then(function () {
return ServerConnector.getLoggedUser();
}).then(function (user) {
var privilege = self.getConfiguration().getPrivilegeType(PrivilegeType.USER_MANAGEMENT);
var curatorPrivilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_CURATOR);
var adminPrivilege = self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN);
//we need to refresh users as well because of privileges
if (user.hasPrivilege(privilege)) {
if (user.hasPrivilege(curatorPrivilege) || user.hasPrivilege(adminPrivilege)) {
return ServerConnector.getUsers(true);
} else {
return Promise.resolve();
......
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