Skip to content

Commit 26ad72b

Browse files
committed
对model类提供支持
1 parent 39a2e63 commit 26ad72b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

hsweb-authorization/hsweb-authorization-shiro/src/main/java/org/hswebframework/web/authorization/shiro/boost/DefaultFieldAccessController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.hswebframework.web.commons.entity.Entity;
99
import org.hswebframework.web.commons.entity.RecordCreationEntity;
1010
import org.hswebframework.web.commons.entity.param.QueryParamEntity;
11+
import org.hswebframework.web.commons.model.Model;
1112
import org.slf4j.Logger;
1213
import org.slf4j.LoggerFactory;
1314

@@ -51,22 +52,21 @@ public boolean doAccess(String action, Set<FieldAccess> accesses, ParamContext p
5152
* @see org.apache.commons.beanutils.PropertyUtilsBean
5253
*/
5354
protected boolean doUpdateAccess(Set<FieldAccess> accesses, ParamContext params) {
54-
Entity entity = params.getParams().values().stream()
55-
.filter(Entity.class::isInstance)
56-
.map(Entity.class::cast)
55+
Object supportParam = params.getParams().values().stream()
56+
.filter(param -> (param instanceof Entity) | (param instanceof Model))
5757
.findAny().orElse(null);
58-
if (null != entity) {
58+
if (null != supportParam) {
5959
for (FieldAccess access : accesses) {
6060
try {
6161
//设置值为null,跳过修改
6262
BeanUtilsBean.getInstance()
6363
.getPropertyUtils()
64-
.setProperty(entity, access.getField(), null);
64+
.setProperty(supportParam, access.getField(), null);
6565
} catch (Exception e) {
6666
}
6767
}
68-
if (entity instanceof RecordCreationEntity) {
69-
RecordCreationEntity creationEntity = ((RecordCreationEntity) entity);
68+
if (supportParam instanceof RecordCreationEntity) {
69+
RecordCreationEntity creationEntity = ((RecordCreationEntity) supportParam);
7070
creationEntity.setCreateTime(null);
7171
creationEntity.setCreatorId(null);
7272
}

0 commit comments

Comments
 (0)