@Test public void validatePermisionTest() throws SQLException { LoginUser user = LoginUser.builder().id(1L).build(); DataBaseInfo dalGroupDB = DataBaseInfo.builder().dbname("name").build(); Errors errors = new BeanPropertyBindingResult(dalGroupDB, "dalGroupDB", true, 256); Assert.assertTrue(groupDatabaseService.validatePermision(user, errors).validate().isValid()); }
public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }
GroupDatabaseService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); } }
GroupDatabaseService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  }
GroupDatabaseService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  ValidatorChain validatePermision(LoginUser user, Errors errors); boolean isGroupHadDB(Long dbId, Long groupId); boolean isGroupHadDB(DataBaseInfo dataBaseModel); boolean validateTransferPermision(Long userId, Long dbId); }
GroupDatabaseService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  ValidatorChain validatePermision(LoginUser user, Errors errors); boolean isGroupHadDB(Long dbId, Long groupId); boolean isGroupHadDB(DataBaseInfo dataBaseModel); boolean validateTransferPermision(Long userId, Long dbId);  }