@Test public void validatePermisionAddTest() throws Exception { LoginUser user = LoginUser.builder().id(1L).build(); UserGroup userGroup = UserGroup.builder().update_user_no("name").build(); Errors errors = new BeanPropertyBindingResult(userGroup, "userGroup", true, 256); Assert.assertTrue(groupMemberService.validatePermisionAdd(user, userGroup, errors).validate().isValid()); }
public ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors) throws SQLException { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> this.validateUserOptUserPermisionInGroup(user, userGroup), "你没有当前DAS Team的组员操作权限."); }
GroupMemberService { public ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors) throws SQLException { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> this.validateUserOptUserPermisionInGroup(user, userGroup), "你没有当前DAS Team的组员操作权限."); } }
GroupMemberService { public ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors) throws SQLException { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> this.validateUserOptUserPermisionInGroup(user, userGroup), "你没有当前DAS Team的组员操作权限."); }  }
GroupMemberService { public ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors) throws SQLException { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> this.validateUserOptUserPermisionInGroup(user, userGroup), "你没有当前DAS Team的组员操作权限."); }  ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors); ValidatorChain validatePermisionUpdateAndDelete(LoginUser user, UserGroup userGroup, Errors errors); boolean canOpterateGroupMember(Long userId, Long currentGroupId); boolean isUserInGroup(Long userId, Long groupId); ListResult<MemberView> findGroupMemberPageList(Paging<UserGroup> paging); }
GroupMemberService { public ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors) throws SQLException { return ValidatorChain.newInstance().controllerValidate(errors) .addAssert(() -> this.validateUserOptUserPermisionInGroup(user, userGroup), "你没有当前DAS Team的组员操作权限."); }  ValidatorChain validatePermisionAdd(LoginUser user, UserGroup userGroup, Errors errors); ValidatorChain validatePermisionUpdateAndDelete(LoginUser user, UserGroup userGroup, Errors errors); boolean canOpterateGroupMember(Long userId, Long currentGroupId); boolean isUserInGroup(Long userId, Long groupId); ListResult<MemberView> findGroupMemberPageList(Paging<UserGroup> paging);  }