Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
6b2a11b5
Commit
6b2a11b5
authored
Apr 01, 2019
by
Piotr Gawron
Browse files
remove comment is disabled for users without proper privileges
parent
67b94844
Pipeline
#9566
passed with stage
in 8 minutes and 41 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
6b2a11b5
...
...
@@ -4,6 +4,8 @@ minerva (12.2.1) stable; urgency=medium
*
Bug
fix
:
removing
active
plugin
didn
't switch plugin tab to the next loaded
plugin (#757)
* Bug fix: closed submap will not be reopened after page refresh (#763)
* Bug fix: comment remove button is disabled for users without proper
privileges (#766)
* Bug fix: invalid pubmed identifier could break clicking on element
containing it (#764, #765, #769)
...
...
frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js
View file @
6b2a11b5
...
...
@@ -4,6 +4,7 @@ var AbstractGuiElement = require('../AbstractGuiElement');
var
Functions
=
require
(
'
../../Functions
'
);
var
GuiConnector
=
require
(
'
../../GuiConnector
'
);
var
PrivilegeType
=
require
(
'
../../map/data/PrivilegeType
'
);
// noinspection JSUnusedLocalSymbols
var
logger
=
require
(
'
../../logger
'
);
...
...
@@ -16,7 +17,7 @@ var xss = require('xss');
* @param {Object} params
* @param {HTMLElement} params.element
* @param {Configuration} params.configuration
* @param {Project}
[
params.project
]
* @param {Project} params.project
* @param {ServerConnector} [params.serverConnector]
*
* @constructor
...
...
@@ -93,7 +94,7 @@ CommentsAdminPanel.prototype._createGui = function () {
*/
CommentsAdminPanel
.
prototype
.
init
=
function
()
{
var
self
=
this
;
return
self
.
refresh
Projec
ts
();
return
self
.
refresh
Commen
ts
();
};
/**
...
...
@@ -112,6 +113,12 @@ CommentsAdminPanel.prototype.refreshComments = function () {
data
.
push
(
self
.
commentToTableRow
(
comments
[
i
]));
}
dataTable
.
clear
().
rows
.
add
(
data
).
draw
();
return
self
.
getServerConnector
().
getLoggedUser
();
}).
then
(
function
(
user
)
{
var
type
=
self
.
getConfiguration
().
getPrivilegeType
(
PrivilegeType
.
EDIT_COMMENTS_PROJECT
);
if
(
!
user
.
hasPrivilege
(
type
,
self
.
getProject
().
getId
()))
{
$
(
"
[name='removeComment']
"
,
self
.
getElement
()).
attr
(
"
disabled
"
,
true
);
}
});
};
...
...
frontend-js/src/main/js/gui/admin/EditProjectDialog.js
View file @
6b2a11b5
...
...
@@ -33,6 +33,7 @@ var xss = require('xss');
function
EditProjectDialog
(
params
)
{
AbstractGuiElement
.
call
(
this
,
params
);
var
self
=
this
;
guiUtils
.
setConfiguration
(
params
.
configuration
);
self
.
setConfiguration
(
params
.
configuration
);
self
.
registerListenerType
(
"
onSave
"
);
$
(
self
.
getElement
()).
addClass
(
"
minerva-edit-project-dialog
"
);
...
...
frontend-js/src/main/js/map/data/PrivilegeType.js
View file @
6b2a11b5
...
...
@@ -37,6 +37,8 @@ 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
'
;
/**
*
...
...
frontend-js/src/test/js/gui/admin/CommentsAdminPanel-test.js
View file @
6b2a11b5
...
...
@@ -14,11 +14,13 @@ var assert = chai.assert;
describe
(
'
CommentsAdminPanel
'
,
function
()
{
function
createDialog
()
{
return
ServerConnector
.
get
Configuration
().
then
(
function
(
configuration
)
{
return
ServerConnector
.
get
Project
().
then
(
function
(
project
)
{
return
new
CommentsAdminPanel
({
element
:
testDiv
,
configuration
:
configuration
,
customMap
:
null
configuration
:
helper
.
getConfiguration
(),
customMap
:
null
,
project
:
project
,
serverConnector
:
ServerConnector
});
});
}
...
...
@@ -75,4 +77,29 @@ describe('CommentsAdminPanel', function () {
});
});
});
describe
(
'
remove comment
'
,
function
()
{
it
(
'
admin can remove
'
,
function
()
{
helper
.
loginAsAdmin
();
var
dialog
;
return
createDialog
().
then
(
function
(
result
)
{
dialog
=
result
;
return
dialog
.
init
();
}).
then
(
function
()
{
assert
.
ok
(
$
(
"
[name='removeComment']
"
).
is
(
'
:enabled
'
));
return
dialog
.
destroy
();
});
});
it
(
'
anonymous cannot remove
'
,
function
()
{
var
dialog
;
return
createDialog
().
then
(
function
(
result
)
{
dialog
=
result
;
return
dialog
.
init
();
}).
then
(
function
()
{
assert
.
ok
(
$
(
"
[name='removeComment']
"
).
is
(
'
:disabled
'
));
return
dialog
.
destroy
();
});
});
});
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment