@Test public void validatePermisionTest() throws SQLException { LoginUser user = LoginUser.builder().id(1L).build(); DatabaseSet dbset = DatabaseSet.builder().name("name").build(); Errors errors = new BeanPropertyBindingResult(dbset, "dbset", true, 256); Assert.assertTrue(databaseSetService.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); }
DatabaseSetService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); } }
DatabaseSetService { public ValidatorChain validatePermision(LoginUser user, Errors errors) { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> permissionService.isManagerById(user.getId()), message.permisson_user_crud); }  }
DatabaseSetService { 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 insertDatabaseSet(DatabaseSet dbset); int updateDatabaseSet(DatabaseSet dbset); ServiceResult deleteCheck(Long dbsetId); boolean deleteDatabaseSet(Long dbsetId); ListResult<DatabaseSetView> findDbSetPageList(Paging<DatabaseSet> paging); List<DatabaseSet> getAllDatabaseSetByProjectId(Long projectId); List<DatabaseSet> getAllDatabaseSetByAppId(String appId); ListResult<DatabaseSetView> findDbSetPageListByAppid(Paging<DatabaseSet> paging); ServiceResult<String> addDataCenter(LoginUser user, DatabaseSet dbset); ServiceResult<String> updateDataCenter(LoginUser user, DatabaseSet newDbset); ServiceResult<String> deleteDataCenter(LoginUser user, DatabaseSet dbset); ServiceResult<String> syncDbSet(LoginUser user, DatabaseSet dbset); ConfigCkeckResult<List<ConfigDataResponse>> getCheckData(LoginUser user, DatabaseSet dbset); ServiceResult<String> getDbSetButton(LoginUser user); List<ConfigDataResponse> getAllCheckData(LoginUser user, Long gourpId, DatabaseSet dbset); }
DatabaseSetService { 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 insertDatabaseSet(DatabaseSet dbset); int updateDatabaseSet(DatabaseSet dbset); ServiceResult deleteCheck(Long dbsetId); boolean deleteDatabaseSet(Long dbsetId); ListResult<DatabaseSetView> findDbSetPageList(Paging<DatabaseSet> paging); List<DatabaseSet> getAllDatabaseSetByProjectId(Long projectId); List<DatabaseSet> getAllDatabaseSetByAppId(String appId); ListResult<DatabaseSetView> findDbSetPageListByAppid(Paging<DatabaseSet> paging); ServiceResult<String> addDataCenter(LoginUser user, DatabaseSet dbset); ServiceResult<String> updateDataCenter(LoginUser user, DatabaseSet newDbset); ServiceResult<String> deleteDataCenter(LoginUser user, DatabaseSet dbset); ServiceResult<String> syncDbSet(LoginUser user, DatabaseSet dbset); ConfigCkeckResult<List<ConfigDataResponse>> getCheckData(LoginUser user, DatabaseSet dbset); ServiceResult<String> getDbSetButton(LoginUser user); List<ConfigDataResponse> getAllCheckData(LoginUser user, Long gourpId, DatabaseSet dbset);  }