Skip to content

Commit

Permalink
Merge pull request #108 from hs-web/3.0.x
Browse files Browse the repository at this point in the history
3.0.x
  • Loading branch information
zhou-hao committed Jan 16, 2019
2 parents a82c50a + 51167ac commit 6aedf5f
Show file tree
Hide file tree
Showing 622 changed files with 1,537 additions and 4,083 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2016 http://hsweb.me
Copyright 2019 http://hsweb.me

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@

| 模块 | 说明 | 进度 |
| ------------- |:-------------:| ----|
|[hsweb-authorization](hsweb-authorization)|权限控制| 90%|
|[hsweb-commons](hsweb-commons) |基础通用功能| 90%|
|[hsweb-authorization](hsweb-authorization)|权限控制| 100%|
|[hsweb-commons](hsweb-commons) |基础通用功能| 100%|
|[hsweb-concurrent](hsweb-concurrent)|并发包,缓存,锁,计数器等| 80%|
|[hsweb-core](hsweb-core)|框架核心,基础工具类| 90%|
|[hsweb-datasource](hsweb-datasource)|数据源| 90%|
|[hsweb-core](hsweb-core)|框架核心,基础工具类| 100%|
|[hsweb-datasource](hsweb-datasource)|数据源| 100%|
|[hsweb-logging](hsweb-logging)| 日志| 100%|
|[hsweb-message](hsweb-message)|mq,websocket...| 80%|
|[hsweb-starter](hsweb-starter)|模块启动器| 90%|
|[hsweb-starter](hsweb-starter)|模块启动器| 100%|
|[hsweb-system](hsweb-system)|**系统常用功能**| 80%|
|[hsweb-thirdparty](hsweb-thirdparty)| 第三方插件 | 100% |
2 changes: 1 addition & 1 deletion hsweb-authorization/hsweb-authorization-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>hsweb-authorization</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.4</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* * Copyright 2016 http://www.hswebframework.org
* * Copyright 2019 http://www.hswebframework.org
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* * Copyright 2016 http://www.hswebframework.org
* * Copyright 2019 http://www.hswebframework.org
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion hsweb-authorization/hsweb-authorization-basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>hsweb-authorization</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.4</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ public AuthorizeDefinition parse(Class target, Method method, MethodInterceptorC

authorizeDefinition.put(expression);

if (methodAuth != null) {
authorizeDefinition.put(methodAuth.dataAccess());
}
authorizeDefinition.put(classDataAccess);

authorizeDefinition.put(methodDataAccess);

if (authorizeDefinition.getPermissionDescription().length == 0) {
if (classAuth != null) {
authorizeDefinition.put(classAuth.dataAccess());
String[] desc = classAuth.description();
if (desc.length > 0) {
authorizeDefinition.setPermissionDescription(desc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void put(Authorize authorize) {
}
message = authorize.message();
phased = authorize.phased();
put(authorize.dataAccess());
}

public void put(RequiresExpression expression) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -87,7 +88,7 @@ protected boolean doUpdateAccess(FieldFilterDataAccessConfig accesses, Authorizi

@SuppressWarnings("all")
protected boolean doQueryAccess(FieldFilterDataAccessConfig access, AuthorizingContext context) {
if (context.getDefinition().getPhased() == Phased.before) {
if (context.getDefinition().getDataAccessDefinition().getPhased() == Phased.before) {
QueryParamEntity entity = context.getParamContext().getParams()
.values().stream()
.filter(QueryParamEntity.class::isInstance)
Expand All @@ -97,7 +98,8 @@ protected boolean doQueryAccess(FieldFilterDataAccessConfig access, AuthorizingC
logger.warn("try validate query access, but query entity is null or not instance of org.hswebframework.web.commons.entity.Entity");
return true;
}
entity.excludes(access.getFields().toArray(new String[access.getFields().size()]));
Set<String> denyFields = access.getFields();
entity.excludes(denyFields.toArray(new String[denyFields.size()]));
} else {
Object result = InvokeResultUtils.convertRealResult(context.getParamContext().getInvokeResult());
if (result instanceof Collection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected boolean doRWAccess(FieldScopeDataAccessConfig access, AuthorizingConte

@SuppressWarnings("all")
protected boolean doQueryAccess(FieldScopeDataAccessConfig access, AuthorizingContext context) {
if (context.getDefinition().getPhased() == Phased.before) {
if (context.getDefinition().getDataAccessDefinition().getPhased() == Phased.before) {
QueryParamEntity entity = context.getParamContext().getParams()
.values().stream()
.filter(QueryParamEntity.class::isInstance)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package org.hswebframework.web.authorization.basic.handler.access;

import org.hswebframework.web.commons.entity.PagerResult;
import org.hswebframework.web.controller.message.ResponseMessage;
import org.springframework.http.ResponseEntity;

public class InvokeResultUtils {
public static Object convertRealResult(Object result) {
if (result instanceof ResponseEntity) {
result = ((ResponseEntity) result).getBody();
}
if (result instanceof ResponseMessage) {
return ((ResponseMessage) result).getResult();
result = ((ResponseMessage) result).getResult();
}
if (result instanceof ResponseEntity) {
return ((ResponseEntity) result).getBody();
if (result instanceof PagerResult) {
result = ((PagerResult) result).getData();
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected boolean doRWAccess(OwnCreatedDataAccessConfig access, AuthorizingConte
protected boolean doQueryAccess(OwnCreatedDataAccessConfig access, AuthorizingContext context) {
String userId = context.getAuthentication().getUser().getId();

if (context.getDefinition().getPhased() == Phased.before) {
if (context.getDefinition().getDataAccessDefinition().getPhased() == Phased.before) {
Entity entity = context.getParamContext().getParams()
.values().stream()
.filter(Entity.class::isInstance)
Expand Down Expand Up @@ -144,8 +144,7 @@ protected boolean matchCreatorId(Object result, String userId) {
} else if (result instanceof Collection) {
Collection<?> collection = ((Collection) result);
//删掉不能访问的对象
collection.removeAll(collection.stream().filter((Object o) -> !matchCreatorId(o, userId))
.collect(Collectors.toList()));
collection.removeAll(collection.stream().filter((Object o) -> !matchCreatorId(o, userId)).collect(Collectors.toList()));
} else {
try {
return userId.equals(PropertyUtils.getProperty(result, "creatorId"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ public void dynamicQuery(QueryParamEntity paramEntity) {

public interface TestClassSuper {

@Authorize(action = Permission.ACTION_QUERY, phased = Phased.after, dataAccess = @RequiresDataAccess)
@Authorize(action = Permission.ACTION_QUERY,
phased = Phased.after,
dataAccess = @RequiresDataAccess(phased = Phased.after))
default ResponseMessage<User> queryById(String id) {
return ResponseMessage.ok();
}
Expand Down
2 changes: 1 addition & 1 deletion hsweb-authorization/hsweb-authorization-jwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>hsweb-authorization</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.4</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 http://www.hswebframework.org
~ Copyright 2019 http://www.hswebframework.org
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@
<parent>
<artifactId>hsweb-authorization-oauth2</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.4</version>
<version>3.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 http://www.hswebframework.org
* Copyright 2019 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 6aedf5f

Please sign in to comment.