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
362e603a
Commit
362e603a
authored
Aug 19, 2020
by
Piotr Gawron
Browse files
documentation for get user list API call
parent
97b021ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
web/src/main/asciidoc/user.adoc
0 → 100644
View file @
362e603a
= Rest API Documentation - Users
Piotr Gawron
v{project-version} {build-time}
:toc: left
:sectnums:
== List available formats
=== CURL sample
include::{snippets}/user/list_users/curl-request.adoc[]
=== Response Fields
include::{snippets}/user/list_users/response-fields.adoc[]
=== Sample Response
include::{snippets}/user/list_users/response-body.adoc[]
web/src/test/java/lcsb/mapviewer/web/UserControllerIntegrationTest.java
View file @
362e603a
package
lcsb.mapviewer.web
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
MockMvcRestDocumentation
.
document
;
import
static
org
.
springframework
.
restdocs
.
payload
.
PayloadDocumentation
.
fieldWithPath
;
import
static
org
.
springframework
.
restdocs
.
payload
.
PayloadDocumentation
.
responseFields
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.*;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
...
...
@@ -17,6 +20,7 @@ import org.mockito.Mockito;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.mock.web.MockHttpSession
;
import
org.springframework.restdocs.payload.FieldDescriptor
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
...
@@ -45,7 +49,6 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
private
static
final
String
TEST_USER_LOGIN
=
"test_user"
;
Logger
logger
=
LogManager
.
getLogger
();
private
User
user
;
private
User
admin
;
@Autowired
private
IUserService
userService
;
...
...
@@ -68,10 +71,12 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
@Autowired
private
IModelService
modelService
;
@Autowired
private
ProjectSnippets
projectSnippets
;
@Before
public
void
setup
()
{
user
=
createUser
(
TEST_USER_LOGIN
,
TEST_USER_PASSWORD
);
admin
=
userService
.
getUserByLogin
(
BUILT_IN_TEST_ADMIN_LOGIN
);
}
@After
...
...
@@ -666,4 +671,74 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
configurationService
.
setConfigurationValue
(
ConfigurationElementType
.
MINERVA_ROOT
,
"http://localhost:8080/minerva/"
);
}
@Test
public
void
testGetUsers
()
throws
Exception
{
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
RequestBuilder
grantRequest
=
get
(
"/users/"
)
.
session
(
session
);
mockMvc
.
perform
(
grantRequest
)
.
andDo
(
document
(
"user/list_users"
,
responseFields
(
fieldWithPath
(
"[]"
)
.
description
(
"list of available input formats"
)
.
type
(
"Array"
)).
andWithPrefix
(
"[]."
,
getUserResponseFields
())))
.
andExpect
(
status
().
is2xxSuccessful
());
}
private
List
<
FieldDescriptor
>
getUserResponseFields
()
{
return
Arrays
.
asList
(
fieldWithPath
(
"login"
)
.
description
(
"user name"
)
.
type
(
"String"
),
fieldWithPath
(
"connectedToLdap"
)
.
description
(
"is user account connected to ldap"
)
.
type
(
"Boolean"
),
fieldWithPath
(
"ldapAccountAvailable"
)
.
description
(
"does is account exist in ldap"
)
.
type
(
"Boolean"
),
fieldWithPath
(
"email"
)
.
description
(
"email address"
)
.
type
(
"String"
),
fieldWithPath
(
"id"
)
.
description
(
"user unique id"
)
.
type
(
"Number"
),
fieldWithPath
(
"maxColor"
)
.
description
(
"color used for drawing data overlays with max value"
)
.
type
(
"Color"
),
fieldWithPath
(
"minColor"
)
.
description
(
"color used for drawing data overlays with min value"
)
.
type
(
"Color"
),
fieldWithPath
(
"neutralColor"
)
.
description
(
"color used for drawing data overlays with 0 value"
)
.
type
(
"Color"
),
fieldWithPath
(
"simpleColor"
)
.
description
(
"color used for drawing data overlays without value"
)
.
type
(
"Color"
),
fieldWithPath
(
"name"
)
.
description
(
"first name"
)
.
type
(
"String"
),
fieldWithPath
(
"surname"
)
.
description
(
"last name"
)
.
type
(
"String"
),
fieldWithPath
(
"removed"
)
.
description
(
"is the account removed"
)
.
type
(
"Boolean"
),
fieldWithPath
(
"termsOfUseConsent"
)
.
description
(
"did user agree to terms of use"
)
.
type
(
"Boolean"
),
fieldWithPath
(
"privileges"
)
.
description
(
"list of user privileges"
)
.
type
(
"Array"
),
fieldWithPath
(
"privileges[].objectId"
)
.
description
(
"object id to which project has privilege"
)
.
optional
()
.
type
(
"String"
),
fieldWithPath
(
"privileges[].privilegeType"
)
.
description
(
"type of privilege, available values: "
+
projectSnippets
.
getOptionsAsString
(
PrivilegeType
.
class
))
.
type
(
"String"
));
}
}
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