Multiple bug fixes #23

Merged
william merged 7 commits from develop into master 2021-12-23 21:13:29 -05:00
2 changed files with 12 additions and 17 deletions
Showing only changes of commit 546d1f5330 - Show all commits

View File

@ -33,6 +33,9 @@ steps:
- echo -n "latest" > .tags
when:
branch: develop
event:
exclude:
- pull_request
- name: set-docker-tags-release
image: *alpine-image
@ -55,6 +58,9 @@ steps:
repo: *docker-registry-repo
when:
branch: develop
event:
exclude:
- pull_request
- name: containerize-release
image: plugins/docker

View File

@ -10,7 +10,6 @@ import org.springframework.context.annotation.Profile
import org.springframework.http.MediaType
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import java.security.Principal
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import javax.validation.Valid
@ -32,22 +31,6 @@ class UserController(private val userService: UserService) {
fun getById(@PathVariable id: Long) =
ok(userService.getByIdForOutput(id))
@GetMapping("current")
@PreAuthorize("isFullyAuthenticated()")
fun getCurrent(loggedInUser: Principal?) =
if (loggedInUser != null)
ok(
with(userService) {
getById(
loggedInUser.name.toLong(),
ignoreDefaultGroupUsers = false,
ignoreSystemUsers = false
).toOutput()
}
)
else
forbidden()
@PostMapping
@PreAuthorizeEditUsers
fun save(@Valid @RequestBody user: UserSaveDto) =
@ -134,6 +117,12 @@ class GroupsController(
getRequestDefaultGroup(request).toOutput()
})
@GetMapping("currentuser")
fun getCurrentGroupUser(request: HttpServletRequest) =
ok(with(groupService.getRequestDefaultGroup(request)) {
userService.getDefaultGroupUser(this).toOutputDto()
})
@PostMapping
@PreAuthorizeEditUsers
fun save(@Valid @RequestBody group: GroupSaveDto) =