Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
e9d017ac
Commit
e9d017ac
authored
May 11, 2020
by
Piotr Gawron
Browse files
Merge branch '1211-remove-plugin' into 'devel_14.0.x'
remove plugin permanently from admin panel See merge request
!1123
parents
8bf23fc5
54e57077
Pipeline
#27347
failed with stage
in 13 minutes and 21 seconds
Changes
5
Pipelines
20
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
e9d017ac
...
...
@@ -6,6 +6,8 @@ minerva (14.0.12) stable; urgency=medium
*
Bug
fix
:
doi
annotation
was
inproperly
parsed
from
CellDesigner
file
and
resulted
in
not
clickable
link
(#
1231
)
*
Bug
fix
:
when
plugin
data
was
too
big
500
error
was
returned
(#
1232
)
*
Bug
fix
:
removing
plugin
in
admin
panel
removes
it
from
server
permanently
(#
1211
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
11
May
2020
17
:
00
:
00
+
0200
...
...
persist/src/main/java/lcsb/mapviewer/persist/dao/plugin/PluginDataEntryDao.java
View file @
e9d017ac
...
...
@@ -43,4 +43,10 @@ public class PluginDataEntryDao extends BaseDao<PluginDataEntry> {
}
}
public
List
<
PluginDataEntry
>
getByPlugin
(
Plugin
plugin
)
{
List
<
Pair
<
String
,
Object
>>
params
=
new
ArrayList
<>();
params
.
add
(
new
Pair
<>(
"plugin_id"
,
plugin
.
getId
()));
return
getElementsByParameters
(
params
);
}
}
rest-api/src/main/java/lcsb/mapviewer/api/plugins/PluginController.java
View file @
e9d017ac
...
...
@@ -58,8 +58,8 @@ public class PluginController extends BaseController {
// FIXME: check if this takes priority over filter chain
@PreAuthorize
(
"hasAuthority('IS_ADMIN')"
)
@DeleteMapping
(
value
=
"/{hash}"
)
public
Map
<
String
,
Object
>
removePlugin
(
@PathVariable
(
value
=
"hash"
)
String
hash
)
throws
ObjectNotFoundException
{
return
pluginRest
.
removePlugin
(
hash
);
public
void
removePlugin
(
@PathVariable
(
value
=
"hash"
)
String
hash
)
throws
ObjectNotFoundException
{
pluginRest
.
removePlugin
(
hash
);
}
@PostMapping
(
value
=
"/{hash}/data/users/{key}"
)
...
...
rest-api/src/main/java/lcsb/mapviewer/api/plugins/PluginRestImpl.java
View file @
e9d017ac
...
...
@@ -145,14 +145,16 @@ public class PluginRestImpl extends BaseRestImpl {
return
result
;
}
public
Map
<
String
,
Object
>
removePlugin
(
String
hash
)
throws
ObjectNotFoundException
{
public
void
removePlugin
(
String
hash
)
throws
ObjectNotFoundException
{
Plugin
plugin
=
pluginDao
.
getByHash
(
hash
);
if
(
plugin
!=
null
)
{
plugin
.
setPublic
(
false
);
pluginDao
.
update
(
plugin
);
List
<
PluginDataEntry
>
entries
=
pluginDataEntryDao
.
getByPlugin
(
plugin
);
for
(
PluginDataEntry
pluginDataEntry
:
entries
)
{
pluginDataEntryDao
.
delete
(
pluginDataEntry
);
}
pluginDao
.
delete
(
plugin
);
}
else
{
throw
new
ObjectNotFoundException
(
"Plugin doesn't exist"
);
}
return
getPlugin
(
hash
);
}
}
web/src/test/java/lcsb/mapviewer/web/PluginControllerIntegrationTest.java
View file @
e9d017ac
package
lcsb.mapviewer.web
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.*;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
java.util.Arrays
;
...
...
@@ -263,6 +262,18 @@ public class PluginControllerIntegrationTest extends ControllerIntegrationTest {
}
@Test
public
void
testRemovePlugin
()
throws
Exception
{
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
Plugin
plugin
=
createPlugin
();
RequestBuilder
request
=
delete
(
"/plugins/"
+
plugin
.
getHash
()
+
"/"
).
session
(
session
);
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
is2xxSuccessful
());
}
private
Plugin
createPlugin
()
{
Plugin
plugin
=
new
Plugin
();
plugin
.
setHash
(
"XYZ"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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