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
29851a1b
Commit
29851a1b
authored
Apr 04, 2019
by
Piotr Gawron
Browse files
Merge branch '780-login-with-problematic-characters' into 'devel_12.2.x'
Resolve "MINERVANET - Error Report 57" See merge request
!727
parents
c473dd84
cd43ae4e
Pipeline
#9640
passed with stage
in 8 minutes and 48 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
29851a1b
...
...
@@ -3,6 +3,10 @@ minerva (12.2.2) stable; urgency=medium
with different id than default map was accessed
* Bug fix: change of owner of the data overlay in admin panel incorrectly
ordered overlays (#777)
* Bug fix: chemical search didn'
t
use
updated
disease
identifier
,
original
disease
id
from
project
upload
was
used
instead
(#
779
)
*
Bug
fix
:
user
login
with
special
characters
(
like
'@'
)
could
cause
problems
in
admin
panel
(#
780
)
minerva
(
12.2.1
)
stable
;
urgency
=
medium
*
Bug
fix
:
export
of
reaction
colorsi
in
SBML
is
properly
encoded
(
COPASI
can
...
...
frontend-js/src/main/js/gui/admin/EditProjectDialog.js
View file @
29851a1b
...
...
@@ -1017,8 +1017,6 @@ EditProjectDialog.prototype.saveOverlay = function (overlayId) {
overlay
.
setCreator
(
creator
);
overlay
.
setOrder
(
order
);
}
console
.
log
(
"
output
"
);
console
.
log
(
overlay
);
return
self
.
getServerConnector
().
updateOverlay
(
overlay
);
};
...
...
frontend-js/src/main/js/gui/admin/UsersAdminPanel.js
View file @
29851a1b
...
...
@@ -299,7 +299,7 @@ UsersAdminPanel.prototype.addUpdateListener = function (user, dataTableRow) {
}
}
var
listener
=
function
()
{
var
login
=
user
.
getLogin
().
replace
(
"
.
"
,
"
\\
.
"
);
var
login
=
$
.
escapeSelector
(
user
.
getLogin
()
);
self
.
userToTableRow
(
user
,
dataTableRow
);
var
row
=
$
(
$
(
"
[name='usersTable']
"
,
self
.
getElement
())[
0
]).
DataTable
().
row
(
"
#
"
+
login
);
if
(
row
.
length
>
0
)
{
...
...
frontend-js/src/test/js/gui/admin/UserAdminPanel-test.js
View file @
29851a1b
...
...
@@ -102,6 +102,18 @@ describe('UsersAdminPanel', function () {
});
});
it
(
'
onUpdateUserListener
'
,
function
()
{
helper
.
loginAsAdmin
();
var
usersTab
=
createUserAdminPanel
();
return
usersTab
.
init
().
then
(
function
()
{
var
user
=
helper
.
createUser
();
user
.
setLogin
(
"
x@y.lu
"
);
var
data
=
[];
usersTab
.
addUpdateListener
(
user
,
data
);
user
.
callListeners
(
"
onreload
"
);
assert
.
ok
(
data
.
indexOf
(
"
x@y.lu
"
)
>=
0
);
return
usersTab
.
destroy
();
});
});
})
;
});
rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java
View file @
29851a1b
...
...
@@ -58,7 +58,7 @@ public class ChemicalRestImpl extends BaseRestImpl {
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Project
project
=
model
.
getProject
(
);
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
,
token
);
if
(
project
.
getDisease
()
==
null
)
{
throw
new
QueryException
(
"Project doesn't have disease associated to it"
);
}
...
...
@@ -175,7 +175,7 @@ public class ChemicalRestImpl extends BaseRestImpl {
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Project
project
=
model
.
getProject
(
);
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
,
token
);
if
(
project
.
getDisease
()
==
null
)
{
throw
new
QueryException
(
"Project doesn't have disease associated to it"
);
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/drugs/DrugRestImpl.java
View file @
29851a1b
...
...
@@ -54,7 +54,7 @@ public class DrugRestImpl extends BaseRestImpl {
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Project
project
=
model
.
getProject
(
);
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
,
token
);
Set
<
String
>
columnSet
=
createDrugColumnSet
(
columns
);
...
...
@@ -160,7 +160,7 @@ public class DrugRestImpl extends BaseRestImpl {
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Project
project
=
model
.
getProject
(
);
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
,
token
);
List
<
Model
>
models
=
getModels
(
projectId
,
"*"
,
token
);
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/mirnas/MiRnaRestImpl.java
View file @
29851a1b
...
...
@@ -53,7 +53,7 @@ public class MiRnaRestImpl extends BaseRestImpl {
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Project
project
=
model
.
getProject
(
);
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
,
token
);
Set
<
String
>
columnSet
=
createMiRnaColumnSet
(
columns
);
...
...
@@ -129,7 +129,7 @@ public class MiRnaRestImpl extends BaseRestImpl {
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Project
project
=
model
.
getProject
(
);
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
,
token
);
List
<
Model
>
models
=
getModels
(
projectId
,
"*"
,
token
);
...
...
rest-api/src/test/java/lcsb/mapviewer/api/RestTestFunctions.java
View file @
29851a1b
package
lcsb.mapviewer.api
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyString
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileInputStream
;
...
...
@@ -32,6 +35,7 @@ import org.apache.log4j.Logger;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mockito
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.test.annotation.Rollback
;
...
...
@@ -46,6 +50,7 @@ import org.xml.sax.InputSource;
import
org.xml.sax.SAXException
;
import
lcsb.mapviewer.common.Configuration
;
import
lcsb.mapviewer.common.exception.InvalidStateException
;
import
lcsb.mapviewer.common.exception.InvalidXmlSchemaException
;
import
lcsb.mapviewer.converter.ComplexZipConverter
;
import
lcsb.mapviewer.converter.ComplexZipConverterParams
;
...
...
@@ -59,6 +64,8 @@ import lcsb.mapviewer.model.map.model.Model;
import
lcsb.mapviewer.model.map.model.ModelSubmodelConnection
;
import
lcsb.mapviewer.model.map.model.SubmodelType
;
import
lcsb.mapviewer.persist.DbUtils
;
import
lcsb.mapviewer.services.interfaces.IModelService
;
import
lcsb.mapviewer.services.interfaces.IProjectService
;
import
lcsb.mapviewer.services.interfaces.IUserService
;
@Transactional
...
...
@@ -312,4 +319,21 @@ public abstract class RestTestFunctions {
return
tmp
.
toString
();
}
protected
IProjectService
createProjectMockServiceForModel
(
Model
model
)
{
try
{
IProjectService
mockModelService
=
Mockito
.
mock
(
IProjectService
.
class
);
Mockito
.
when
(
mockModelService
.
getProjectByProjectId
(
anyString
(),
anyString
())).
thenReturn
(
model
.
getProject
());
return
mockModelService
;
}
catch
(
lcsb
.
mapviewer
.
services
.
SecurityException
e
)
{
throw
new
InvalidStateException
(
e
);
}
}
protected
IModelService
createModelMockServiceForModel
(
Model
model
)
throws
lcsb
.
mapviewer
.
services
.
SecurityException
{
IModelService
mockModelService
=
Mockito
.
mock
(
IModelService
.
class
);
Mockito
.
when
(
mockModelService
.
getLastModelByProjectId
(
anyString
(),
any
())).
thenReturn
(
model
);
return
mockModelService
;
}
}
rest-api/src/test/java/lcsb/mapviewer/api/projects/drugs/DrugRestImplTest.java
View file @
29851a1b
package
lcsb.mapviewer.api.projects.drugs
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Matchers
.
anyString
;
import
static
org
.
mockito
.
Argument
Matchers
.
any
;
import
static
org
.
mockito
.
Argument
Matchers
.
anyString
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -16,8 +16,11 @@ import org.mockito.Mockito;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lcsb.mapviewer.api.RestTestFunctions
;
import
lcsb.mapviewer.common.exception.InvalidStateException
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.services.SecurityException
;
import
lcsb.mapviewer.services.interfaces.IModelService
;
import
lcsb.mapviewer.services.interfaces.IProjectService
;
public
class
DrugRestImplTest
extends
RestTestFunctions
{
Logger
logger
=
Logger
.
getLogger
(
DrugRestImplTest
.
class
);
...
...
@@ -53,7 +56,7 @@ public class DrugRestImplTest extends RestTestFunctions {
throw
e
;
}
}
@Test
public
void
testTargetWithEmptyMechanism
()
throws
Exception
{
try
{
...
...
@@ -69,9 +72,8 @@ public class DrugRestImplTest extends RestTestFunctions {
private
DrugRestImpl
createMockProjectRest
(
String
string
)
throws
Exception
{
Model
model
=
super
.
getModelForFile
(
string
,
true
);
IModelService
mockModelService
=
Mockito
.
mock
(
IModelService
.
class
);
Mockito
.
when
(
mockModelService
.
getLastModelByProjectId
(
anyString
(),
any
())).
thenReturn
(
model
);
_drugRestImpl
.
setModelService
(
mockModelService
);
_drugRestImpl
.
setModelService
(
createModelMockServiceForModel
(
model
));
_drugRestImpl
.
setProjectService
(
createProjectMockServiceForModel
(
model
));
return
_drugRestImpl
;
}
...
...
rest-api/src/test/java/lcsb/mapviewer/api/projects/mirnas/MiRnaRestImplTest.java
View file @
29851a1b
...
...
@@ -58,9 +58,8 @@ public class MiRnaRestImplTest extends RestTestFunctions {
private
MiRnaRestImpl
createMockProjectRest
(
String
string
)
throws
Exception
{
Model
model
=
super
.
getModelForFile
(
string
,
true
);
IModelService
mockModelService
=
Mockito
.
mock
(
IModelService
.
class
);
Mockito
.
when
(
mockModelService
.
getLastModelByProjectId
(
anyString
(),
any
())).
thenReturn
(
model
);
_miRnaRestImpl
.
setModelService
(
mockModelService
);
_miRnaRestImpl
.
setModelService
(
createModelMockServiceForModel
(
model
));
_miRnaRestImpl
.
setProjectService
(
createProjectMockServiceForModel
(
model
));
return
_miRnaRestImpl
;
}
...
...
rest-api/src/test/resources/log4j.properties
View file @
29851a1b
...
...
@@ -19,4 +19,7 @@ log4j.logger.org.springframework=warn
log4j.logger.org.hibernate
=
warn
log4j.logger.lcsb
=
debug
log4j.logger.lcsb.mapviewer.annotation.cache
=
info
log4j.logger.lcsb.mapviewer.persist
=
info
\ No newline at end of file
log4j.logger.lcsb.mapviewer.persist
=
info
#There are plenty of useless warnings in jsbml library
log4j.logger.org.sbml.jsbml
=
error
\ No newline at end of file
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