Corrections de certaines permissions

This commit is contained in:
FyloZ 2021-04-05 19:27:23 -04:00
parent 490d4a0027
commit b925cdd02a
3 changed files with 8 additions and 1 deletions

View File

@ -205,6 +205,8 @@ enum class EmployeePermission(
ADMIN(
listOf(
EDIT_CATALOG,
REMOVE_RECIPES,
REMOVE_USERS,
REMOVE_CATALOG,

View File

@ -90,27 +90,31 @@ class EmployeeController(private val employeeService: EmployeeService) {
@RestController
@RequestMapping(EMPLOYEE_GROUP_CONTROLLER_PATH)
@PreAuthorizeViewUsers
class GroupsController(private val groupService: EmployeeGroupServiceImpl) {
@GetMapping
@PreAuthorize("hasAnyAuthority('VIEW_RECIPES', 'VIEW_USERS')")
fun getAll() =
ok(groupService.getAll())
@GetMapping("{id}")
@PreAuthorizeViewUsers
fun getById(@PathVariable id: Long) =
ok(groupService.getById(id))
@GetMapping("{id}/employees")
@PreAuthorizeViewUsers
fun getEmployeesForGroup(@PathVariable id: Long) =
ok(groupService.getEmployeesForGroup(id))
@PostMapping("default/{groupId}")
@PreAuthorizeViewUsers
fun setDefaultGroup(@PathVariable groupId: Long, response: HttpServletResponse) =
noContent {
groupService.setResponseDefaultGroup(groupId, response)
}
@GetMapping("default")
@PreAuthorizeViewUsers
fun getRequestDefaultGroup(request: HttpServletRequest) =
ok(groupService.getRequestDefaultGroup(request))

View File

@ -102,6 +102,7 @@ class RecipeServiceImpl(
return updatedGroupsInformation
}
@Transactional
override fun updatePublicData(publicDataDto: RecipePublicDataDto) {
if (publicDataDto.notes != null) {
val recipe = getById(publicDataDto.recipeId)