Pārlūkot izejas kodu

Merge branch 'fix/内容管理编辑着无法编辑文档的问题' into 'master'

hotfix-修复内容管理编辑着无法编辑文档的问题

See merge request o2oa/o2oa!2955

(cherry picked from commit 2aa226ce33be8ad769757d5125a709e2ad855cec)

9181cc17 内容管理编辑着无法编辑文档的问题
胡起 5 gadi atpakaļ
vecāks
revīzija
ff2e451a91

+ 25 - 25
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetControl.java

@@ -58,13 +58,13 @@ public class ActionQueryGetControl extends BaseAction {
 		List<String> unitNames = null;
 		List<String> groupNames = null;
 		String personName = effectivePerson.getDistinguishedName();
-		
+
 		if ( StringUtils.isEmpty(id)) {
 			check = false;
 			Exception exception = new ExceptionDocumentIdEmpty();
 			result.error(exception);
 		}
-		
+
 		if (check) {
 			try {
 				if (effectivePerson.isManager()) {
@@ -77,7 +77,7 @@ public class ActionQueryGetControl extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if (check) {
 			try {
 				document = documentQueryService.get(id);
@@ -93,16 +93,16 @@ public class ActionQueryGetControl extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), effectivePerson.getDistinguishedName(), id, isManager );
 		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
 
 		if (optional.isPresent()) {
 			result.setData((Wo) optional.get());
 			woControl = wo.getControl();
-		} else {			
+		} else {
 			if (check) {
-				try {					
+				try {
 					reviewCount = documentQueryService.getViewableReview(id, personName);
 					if (reviewCount > 0 ) {
 						woControl.setAllowVisit(true);
@@ -114,7 +114,7 @@ public class ActionQueryGetControl extends BaseAction {
 					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			
+
 			//判断用户是否是文档的创建者,创建者是有权限编辑文档的
 			if (check) {
 				if (wo != null && StringUtils.equals( personName, document.getCreatorPerson())) {
@@ -122,13 +122,13 @@ public class ActionQueryGetControl extends BaseAction {
 					woControl.setAllowVisit(true);
 				}
 			}
-			
+
 			if (check) {
 				wo.setControl(woControl);
 				CacheManager.put(cacheCategory, cacheKey, wo );
 			}
 		}
-		
+
 		/////////////////////////////////////////////////////////////
 		//不管是从缓存还是数据库查出来,都要重新进行处理权限判断
 		/////////////////////////////////////////////////////////////
@@ -143,10 +143,10 @@ public class ActionQueryGetControl extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		AppInfo appInfo = null;
 		CategoryInfo categoryInfo = null;
-		
+
 		if (check) {
 			try {
 				appInfo = appInfoServiceAdv.get( document.getAppId() );
@@ -162,7 +162,7 @@ public class ActionQueryGetControl extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if ( check ) {
 			try {
 				categoryInfo = categoryInfoServiceAdv.get(document.getCategoryId());
@@ -178,7 +178,7 @@ public class ActionQueryGetControl extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		//判断用户是否是分类的管理者,分类管理者是有权限编辑文档的
 		if (check) {
 			try {
@@ -219,19 +219,19 @@ public class ActionQueryGetControl extends BaseAction {
 				// 判断当前登录者是不是该文档的可编辑者
 				try {
 					if( ListTools.isNotEmpty( document.getAuthorPersonList() )) {
-						if ( document.getAuthorPersonList().contains( personName )) {
+						if ( document.getAuthorPersonList().contains( getShortTargetFlag(personName) )) {
 							woControl.setAllowVisit(true);
 							woControl.setAllowEdit(true);
 						}
 					}
 					if( ListTools.isNotEmpty( document.getAuthorUnitList() )) {
-						if( ListTools.containsAny( unitNames , document.getAuthorUnitList() )) {
+						if( ListTools.containsAny( getShortTargetFlag(unitNames) , document.getAuthorUnitList() )) {
 							woControl.setAllowVisit(true);
 							woControl.setAllowEdit(true);
 						}
 					}
 					if( ListTools.isNotEmpty( document.getAuthorGroupList() )) {
-						if( ListTools.containsAny( groupNames , document.getAuthorGroupList() )) {
+						if( ListTools.containsAny( getShortTargetFlag(groupNames) , document.getAuthorGroupList() )) {
 							woControl.setAllowVisit(true);
 							woControl.setAllowEdit(true);
 						}
@@ -248,7 +248,7 @@ public class ActionQueryGetControl extends BaseAction {
 		result.setData(wo);
 		return result;
 	}
-	
+
 
 	public static class Wo extends GsonPropertyObject {
 
@@ -262,9 +262,9 @@ public class ActionQueryGetControl extends BaseAction {
 
 		public void setControl(WoControl control) {
 			this.control = control;
-		}		
+		}
 	}
-	
+
 	public static class WoControl extends GsonPropertyObject {
 
 		@FieldDescribe("是否允许查看.")
@@ -298,9 +298,9 @@ public class ActionQueryGetControl extends BaseAction {
 
 		public void setAllowDelete(Boolean allowDelete) {
 			this.allowDelete = allowDelete;
-		}		
+		}
 	}
-	
+
 //	public static class WoFileInfo extends FileInfo {
 //
 //		private static final long serialVersionUID = -5076990764713538973L;
@@ -316,7 +316,7 @@ public class ActionQueryGetControl extends BaseAction {
 //		public void setControl(WoControl control) {
 //			this.control = control;
 //		}
-//		
+//
 //		public static WrapCopier<FileInfo, WoFileInfo> copier = WrapCopierFactory.wo(FileInfo.class, WoFileInfo.class,
 //				null, JpaObject.FieldsInvisible);
 //
@@ -344,7 +344,7 @@ public class ActionQueryGetControl extends BaseAction {
 //
 //		public static List<String> Excludes = new ArrayList<String>();
 //	}
-	
+
 //	public static class WoControl extends GsonPropertyObject {
 //
 //		private Boolean allowRead = false;
@@ -375,7 +375,7 @@ public class ActionQueryGetControl extends BaseAction {
 //			this.allowControl = allowControl;
 //		}
 //	}
-	
+
 //	private boolean read( WoFileInfo woFileInfo, EffectivePerson effectivePerson, List<String> identities, List<String> units) throws Exception {
 //		boolean value = false;
 //		if (effectivePerson.isPerson(woFileInfo.getCreatorUid())) {
@@ -422,4 +422,4 @@ public class ActionQueryGetControl extends BaseAction {
 //		}
 //		return value;
 //	}
-}
+}

+ 17 - 125
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryGetDocument.java

@@ -51,13 +51,13 @@ public class ActionQueryGetDocument extends BaseAction {
 		List<String> unitNames = null;
 		List<String> groupNames = null;
 		String personName = effectivePerson.getDistinguishedName();
-		
+
 		if ( StringUtils.isEmpty(id)) {
 			check = false;
 			Exception exception = new ExceptionDocumentIdEmpty();
 			result.error(exception);
 		}
-		
+
 		if (check) {
 			try {
 				if (effectivePerson.isManager()) {
@@ -104,7 +104,7 @@ public class ActionQueryGetDocument extends BaseAction {
 					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			
+
 			if (check) {
 				if (wrapOutDocument != null) {
 					try {
@@ -148,7 +148,7 @@ public class ActionQueryGetDocument extends BaseAction {
 					}
 				}
 			}
-			
+
 			//判断用户是否是文档的创建者,创建者是有权限编辑文档的
 			if (check) {
 				if (wo.getDocument() != null && wo.getDocument().getCreatorPerson() != null && wo.getDocument().getCreatorPerson().equals(personName)) {
@@ -156,17 +156,17 @@ public class ActionQueryGetDocument extends BaseAction {
 					wo.setIsCreator(isCreator);
 				}
 			}
-			
+
 			if (check) {
 				wo.setDocumentLogList(new ArrayList<WoLog>());
 				CacheManager.put(cacheCategory, cacheKey, wo );
 			}
 		}
-		
+
 		if (check) {
 			try {
 				unitNames = userManagerService.listUnitNamesWithPerson( personName );
-				groupNames = userManagerService.listGroupNamesByPerson( personName );									
+				groupNames = userManagerService.listGroupNamesByPerson( personName );
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionDocumentInfoProcess(e, "查询用户所有的组织和群组信息时发生异常!user:" + personName);
@@ -174,11 +174,11 @@ public class ActionQueryGetDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		/////////////////////////////////////////////////////////////
 		//不管是从缓存还是数据库查出来,都要重新进行处理权限判断
 		/////////////////////////////////////////////////////////////
-		
+
 		if (check) {
 			try {
 				appInfo = appInfoServiceAdv.get( document.getAppId() );
@@ -209,7 +209,7 @@ public class ActionQueryGetDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		//判断用户是否是分类的管理者,分类管理者是有权限编辑文档的
 		if (check) {
 			try {
@@ -245,27 +245,18 @@ public class ActionQueryGetDocument extends BaseAction {
 			} else {
 				// 判断当前登录者是不是该文档的可编辑者
 				try {
-//					if( ListTools.isEmpty(wrapOutDocument.getAuthorPersonList()) ) {
-//						wrapOutDocument.setAuthorPersonList( composeAuthorPersonsWithAppAndCagetory( appInfo, categoryInfo ) );
-//					}
-//					if( ListTools.isEmpty(wrapOutDocument.getAuthorUnitList()) ) {
-//						wrapOutDocument.setAuthorUnitList(composeAuthorUnitsWithAppAndCagetory( appInfo, categoryInfo ));
-//					}
-//					if( ListTools.isEmpty(wrapOutDocument.getAuthorGroupList()) ) {
-//						wrapOutDocument.setAuthorGroupList(composeAuthorGroupsWithAppAndCagetory( appInfo, categoryInfo ));
-//					}
 					if( ListTools.isNotEmpty( document.getAuthorPersonList() )) {
-						if ( wrapOutDocument.getAuthorPersonList().contains( personName )) {
+						if ( wrapOutDocument.getAuthorPersonList().contains( getShortTargetFlag(personName) )) {
 							isEditor = true;
 						}
 					}
 					if( ListTools.isNotEmpty( document.getAuthorUnitList() )) {
-						if( ListTools.containsAny( unitNames , wrapOutDocument.getAuthorUnitList() )) {
+						if( ListTools.containsAny( getShortTargetFlag(unitNames) , wrapOutDocument.getAuthorUnitList() )) {
 							isEditor = true;
 						}
 					}
 					if( ListTools.isNotEmpty( document.getAuthorGroupList() )) {
-						if( ListTools.containsAny( groupNames , wrapOutDocument.getAuthorGroupList() )) {
+						if( ListTools.containsAny( getShortTargetFlag(groupNames) , wrapOutDocument.getAuthorGroupList() )) {
 							isEditor = true;
 						}
 					}
@@ -287,105 +278,6 @@ public class ActionQueryGetDocument extends BaseAction {
 		return result;
 	}
 
-//	private List<String> composeAuthorUnitsWithAppAndCagetory(AppInfo appInfo, CategoryInfo category) {
-//		List<String> authorUnits = new ArrayList<>();
-//		if( ListTools.isNotEmpty( appInfo.getManageableUnitList() )) {
-//			for( String name : appInfo.getManageableUnitList() ) {
-//				if( !authorUnits.contains( name )) {
-//					authorUnits.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( appInfo.getPublishableUnitList() )) {
-//			for( String name : appInfo.getPublishableUnitList() ) {
-//				if( !authorUnits.contains( name )) {
-//					authorUnits.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( category.getManageableUnitList() )) {
-//			for( String name : category.getManageableUnitList() ) {
-//				if( !authorUnits.contains( name )) {
-//					authorUnits.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( category.getPublishableUnitList() )) {
-//			for( String name : category.getPublishableUnitList() ) {
-//				if( !authorUnits.contains( name )) {
-//					authorUnits.add( name );
-//				}
-//			}
-//		}
-//		return authorUnits;
-//	}
-//
-//	private List<String> composeAuthorGroupsWithAppAndCagetory(AppInfo appInfo, CategoryInfo category) {
-//		List<String> authorGroups = new ArrayList<>();
-//		if( ListTools.isNotEmpty( appInfo.getManageableGroupList() )) {
-//			for( String name : appInfo.getManageableGroupList() ) {
-//				if( !authorGroups.contains( name )) {
-//					authorGroups.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( appInfo.getPublishableGroupList() )) {
-//			for( String name : appInfo.getPublishableGroupList() ) {
-//				if( !authorGroups.contains( name )) {
-//					authorGroups.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( category.getManageableGroupList() )) {
-//			for( String name : category.getManageableGroupList() ) {
-//				if( !authorGroups.contains( name )) {
-//					authorGroups.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( category.getPublishableGroupList() )) {
-//			for( String name : category.getPublishableGroupList() ) {
-//				if( !authorGroups.contains( name )) {
-//					authorGroups.add( name );
-//				}
-//			}
-//		}
-//		return authorGroups;
-//	}
-//
-//	private List<String> composeAuthorPersonsWithAppAndCagetory(AppInfo appInfo, CategoryInfo category) {
-//		List<String> authorPersons = new ArrayList<>();
-//		if( ListTools.isNotEmpty( appInfo.getManageablePersonList() )) {
-//			for( String name : appInfo.getManageablePersonList() ) {
-//				if( !authorPersons.contains( name )) {
-//					authorPersons.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( appInfo.getPublishablePersonList() )) {
-//			for( String name : appInfo.getPublishablePersonList() ) {
-//				if( !authorPersons.contains( name )) {
-//					authorPersons.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( category.getManageablePersonList() )) {
-//			for( String name : category.getManageablePersonList() ) {
-//				if( !authorPersons.contains( name )) {
-//					authorPersons.add( name );
-//				}
-//			}
-//		}
-//		if( ListTools.isNotEmpty( category.getPublishablePersonList() )) {
-//			for( String name : category.getPublishablePersonList() ) {
-//				if( !authorPersons.contains( name )) {
-//					authorPersons.add( name );
-//				}
-//			}
-//		}
-//		return authorPersons;
-//	}
-
 	public static class Wo extends GsonPropertyObject {
 
 		@FieldDescribe("作为输出的CMS文档数据对象.")
@@ -548,7 +440,7 @@ public class ActionQueryGetDocument extends BaseAction {
 //		public void setControl(WoControl control) {
 //			this.control = control;
 //		}
-//		
+//
 //		public static WrapCopier<FileInfo, WoFileInfo> copier = WrapCopierFactory.wo(FileInfo.class, WoFileInfo.class,
 //				null, JpaObject.FieldsInvisible);
 //
@@ -576,7 +468,7 @@ public class ActionQueryGetDocument extends BaseAction {
 
 		public static List<String> Excludes = new ArrayList<String>();
 	}
-	
+
 //	public static class WoControl extends GsonPropertyObject {
 //
 //		private Boolean allowRead = false;
@@ -607,7 +499,7 @@ public class ActionQueryGetDocument extends BaseAction {
 //			this.allowControl = allowControl;
 //		}
 //	}
-	
+
 //	private boolean read( WoFileInfo woFileInfo, EffectivePerson effectivePerson, List<String> identities, List<String> units) throws Exception {
 //		boolean value = false;
 //		if (effectivePerson.isPerson(woFileInfo.getCreatorUid())) {
@@ -654,4 +546,4 @@ public class ActionQueryGetDocument extends BaseAction {
 //		}
 //		return value;
 //	}
-}
+}

+ 55 - 55
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionQueryViewDocument.java

@@ -48,8 +48,8 @@ public class ActionQueryViewDocument extends BaseAction {
 			check = false;
 			Exception exception = new ExceptionDocumentIdEmpty();
 			result.error(exception);
-		}		
-		
+		}
+
 		if (check) {
 			try {
 				if ( effectivePerson.isManager() ) {
@@ -62,7 +62,7 @@ public class ActionQueryViewDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id, isAnonymous, isManager, effectivePerson.getDistinguishedName() );
 		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
 
@@ -74,7 +74,7 @@ public class ActionQueryViewDocument extends BaseAction {
 			result = getDocumentQueryResult( id, request, effectivePerson, isManager );
 			CacheManager.put(cacheCategory, cacheKey, result );
 		}
-		
+
 		if (check ) {
 			//只要不是管理员访问,则记录该文档的访问记录
 			if ( !"xadmin".equalsIgnoreCase( personName) ) {
@@ -85,16 +85,16 @@ public class ActionQueryViewDocument extends BaseAction {
 					logger.error(e, effectivePerson, request, null);
 				}
 			}
-			
+
 			//异步更新item里的访问量,便于视图统计
 			try {
 				ThisApplication.queueDocumentViewCountUpdate.send( result.getData().getDocument() );
 			} catch ( Exception e1 ) {
 				e1.printStackTrace();
 			}
-			
+
 		}
-		return result;			
+		return result;
 	}
 
 	/**
@@ -121,11 +121,11 @@ public class ActionQueryViewDocument extends BaseAction {
 		List<String> groupNames = null;
 		Boolean isAnonymous = effectivePerson.isAnonymous();
 		String personName = effectivePerson.getDistinguishedName();
-		
+
 		if( !isAnonymous ) {
 			try {
 				unitNames = userManagerService.listUnitNamesWithPerson( personName );
-				groupNames = userManagerService.listGroupNamesByPerson( personName );									
+				groupNames = userManagerService.listGroupNamesByPerson( personName );
 			} catch (Exception e) {
 				check = false;
 				Exception exception = new ExceptionDocumentInfoProcess(e, "查询用户所有的组织和群组信息时发生异常!user:" + personName);
@@ -133,7 +133,7 @@ public class ActionQueryViewDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if (check) {
 			try {
 				document = documentQueryService.view( id, effectivePerson );
@@ -149,7 +149,7 @@ public class ActionQueryViewDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null );
 			}
 		}
-		
+
 		if (check) {
 			try {
 				appInfo = appInfoServiceAdv.get( document.getAppId() );
@@ -180,7 +180,7 @@ public class ActionQueryViewDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if (check) {
 			if( isAnonymous ) {
 				//检查这个文档所在的栏目和分类是否都是全员可见
@@ -206,12 +206,12 @@ public class ActionQueryViewDocument extends BaseAction {
 				}
 			}
 		}
-		
-		
+
+
 		if (check) {
 			try {
 				woOutDocument = WoDocument.copier.copy( document );
-				
+
 				if ( woOutDocument != null && categoryInfo != null ) {
 					try {
 						woOutDocument.setForm(categoryInfo.getFormId());
@@ -220,7 +220,7 @@ public class ActionQueryViewDocument extends BaseAction {
 						woOutDocument.setReadFormName(categoryInfo.getReadFormName());
 						woOutDocument.setCategoryName(categoryInfo.getCategoryName());
 						woOutDocument.setCategoryAlias(categoryInfo.getCategoryAlias());
-						
+
 						if( woOutDocument.getCreatorPerson() != null && !woOutDocument.getCreatorPerson().isEmpty() ) {
 							woOutDocument.setCreatorPersonShort( woOutDocument.getCreatorPerson().split( "@" )[0]);
 						}
@@ -238,9 +238,9 @@ public class ActionQueryViewDocument extends BaseAction {
 						logger.error(e, effectivePerson, request, null);
 					}
 				}
-				
+
 				if ( woOutDocument != null ) {
-					try {						
+					try {
 						wo.setData( documentQueryService.getDocumentData( document ) );
 					} catch (Exception e) {
 						check = false;
@@ -256,7 +256,7 @@ public class ActionQueryViewDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		//判断用户是否是文档的创建者,创建者是有权限编辑文档的
 		if (check) {
 			if( wo.getDocument() != null && wo.getDocument().getCreatorPerson() != null && wo.getDocument().getCreatorPerson().equals( personName )) {
@@ -264,7 +264,7 @@ public class ActionQueryViewDocument extends BaseAction {
 					wo.setIsCreator( isCreator );
 			}
 		}
-	
+
 		//判断用户是否是分类的管理者,分类管理者是有权限编辑文档的
 		if (check) {
 			try {
@@ -278,7 +278,7 @@ public class ActionQueryViewDocument extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		//判断用户是否是栏目的管理者,栏目管理者是有权限编辑文档的
 		if (check) {
 			try {
@@ -301,21 +301,21 @@ public class ActionQueryViewDocument extends BaseAction {
 				try {
 					if( !isAnonymous ) {
 						if( ListTools.isNotEmpty( document.getAuthorPersonList() )) {
-							if( document.getAuthorPersonList().contains( personName ) ) {
+							if( document.getAuthorPersonList().contains( getShortTargetFlag(personName) ) ) {
 								isEditor = true;
 							}
 						}
 						if( ListTools.isNotEmpty( document.getAuthorUnitList() )) {
-							if( ListTools.containsAny( unitNames, document.getAuthorUnitList())) {
+							if( ListTools.containsAny( getShortTargetFlag(unitNames), document.getAuthorUnitList())) {
 								isEditor = true;
 							}
 						}
 						if( ListTools.isNotEmpty( document.getAuthorGroupList() )) {
-							if( ListTools.containsAny( groupNames, document.getAuthorGroupList())) {
+							if( ListTools.containsAny( getShortTargetFlag(groupNames), document.getAuthorGroupList())) {
 								isEditor = true;
 							}
 						}
-					}					
+					}
 				} catch (Exception e) {
 					check = false;
 					Exception exception = new ExceptionDocumentInfoProcess(e, "判断用户是否可编辑文档时发生异常!user:" + personName);
@@ -324,12 +324,12 @@ public class ActionQueryViewDocument extends BaseAction {
 				}
 			}
 		}
-		
+
 		wo.setIsManager( isManager );
 		wo.setIsAppAdmin( isAppAdmin );
 		wo.setIsCategoryAdmin( isCategoryAdmin );
 		wo.setIsEditor( isEditor );
-		
+
 		result.setData(wo);
 		return result;
 	}
@@ -347,13 +347,13 @@ public class ActionQueryViewDocument extends BaseAction {
 
 		@FieldDescribe( "文档所有数据信息." )
 		private Data data;
-		
+
 		@FieldDescribe( "作为编辑的CMS文档表单." )
 		private WoForm form;
-		
+
 		@FieldDescribe( "作为查看的CMS文档表单." )
 		private WoForm readForm;
-		
+
 		private Boolean isAppAdmin = false;
 		private Boolean isCategoryAdmin = false;
 		private Boolean isManager = false;
@@ -447,24 +447,24 @@ public class ActionQueryViewDocument extends BaseAction {
 		public void setIsCreator(Boolean isCreator) {
 			this.isCreator = isCreator;
 		}
-		
+
 	}
-	
+
 	public static class WoDocument extends Document {
-		
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
+
 		public static List<String> Excludes = new ArrayList<String>();
-		
+
 		public static WrapCopier<Document, WoDocument> copier = WrapCopierFactory.wo( Document.class, WoDocument.class, null,JpaObject.FieldsInvisible);
-		
+
 		/**
 		 * 只作显示用
 		 */
 		private String creatorPersonShort = "";
-		
+
 		private String creatorUnitNameShort = "";
-		
+
 		private String creatorTopUnitNameShort = "";
 
 		public String getCreatorPersonShort() {
@@ -491,13 +491,13 @@ public class ActionQueryViewDocument extends BaseAction {
 			this.creatorTopUnitNameShort = creatorTopUnitNameShort;
 		}
 	}
-//	
+//
 //	public static class WoFileInfo extends FileInfo {
-//		
+//
 //		private static final long serialVersionUID = -5076990764713538973L;
-//		
+//
 //		public static List<String> Excludes = new ArrayList<String>();
-//		
+//
 //		private WoControl control = new WoControl();
 //
 //		public WoControl getControl() {
@@ -507,34 +507,34 @@ public class ActionQueryViewDocument extends BaseAction {
 //		public void setControl(WoControl control) {
 //			this.control = control;
 //		}
-//		
+//
 //		public static WrapCopier<FileInfo, WoFileInfo> copier = WrapCopierFactory.wo( FileInfo.class, WoFileInfo.class, null, JpaObject.FieldsInvisible);
-//		
+//
 //		private Long referencedCount;
-//		
+//
 //		public Long getReferencedCount() {
 //			return referencedCount;
 //		}
-//		
+//
 //		public void setReferencedCount(Long referencedCount) {
 //			this.referencedCount = referencedCount;
 //		}
 //	}
-	
+
 	public static class WoLog extends Log {
-		
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
+
 		public static List<String> Excludes = new ArrayList<String>();
 	}
-	
+
 	public static class WoForm extends Form {
-		
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
+
 		public static List<String> Excludes = new ArrayList<String>();
 	}
-	
+
 //	public static class WoControl extends GsonPropertyObject {
 //
 //		private Boolean allowRead = false;
@@ -565,7 +565,7 @@ public class ActionQueryViewDocument extends BaseAction {
 //			this.allowControl = allowControl;
 //		}
 //	}
-//	
+//
 //	private boolean read( WoFileInfo woFileInfo, EffectivePerson effectivePerson, List<String> identities, List<String> units) throws Exception {
 //		boolean value = false;
 //		if (effectivePerson.isPerson(woFileInfo.getCreatorUid())) {
@@ -611,4 +611,4 @@ public class ActionQueryViewDocument extends BaseAction {
 //		}
 //		return value;
 //	}
-}
+}

+ 34 - 28
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/BaseAction.java

@@ -1,5 +1,6 @@
 package com.x.cms.assemble.control.jaxrs.document;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import com.x.base.core.container.EntityManagerContainer;
@@ -37,7 +38,7 @@ public class BaseAction extends StandardJaxrsAction {
 	protected DocumentViewRecordServiceAdv documentViewRecordServiceAdv = new DocumentViewRecordServiceAdv();
 	protected DocumentPersistService documentPersistService = new DocumentPersistService();
 	protected DocumentQueryService documentQueryService = new DocumentQueryService();
-	
+
 	protected DocCommendPersistService docCommendPersistService = new DocCommendPersistService();
 
 	protected FormServiceAdv formServiceAdv = new FormServiceAdv();
@@ -50,10 +51,10 @@ public class BaseAction extends StandardJaxrsAction {
 	protected boolean modifyDocStatus( String id, String stauts, String personName ) throws Exception{
 		Business business = null;
 		Document document = null;
-		
+
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			business = new Business(emc);
-		
+
 			//进行数据库持久化操作
 			emc.beginTransaction( Document.class );
 			document = business.getDocumentFactory().get(id);
@@ -63,7 +64,7 @@ public class BaseAction extends StandardJaxrsAction {
 				document.setPublishTime( new Date() );
 				//保存文档信息
 				emc.check( document, CheckPersistType.all);
-			}			
+			}
 			emc.commit();
 			return true;
 		} catch (Exception th) {
@@ -171,10 +172,10 @@ public class BaseAction extends StandardJaxrsAction {
 	 * @param groupNames
 	 * @param appInfo
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	private boolean appInfoViewable(String personName, Boolean isAnonymous, List<String> unitNames, List<String> groupNames, AppInfo appInfo, Boolean manager) throws Exception {
-		
+
 		if( appInfo.getAllPeopleView() || appInfo.getAllPeoplePublish() ) {
 			return true;
 		}
@@ -182,33 +183,33 @@ public class BaseAction extends StandardJaxrsAction {
 			if( manager ) {
 				return true;
 			}
-			
+
 			if( ListTools.isNotEmpty( appInfo.getManageablePersonList() )) {
 				if( appInfo.getManageablePersonList().contains( personName )) {
 					return true;
 				}
-			}			
+			}
 			if( ListTools.isNotEmpty( appInfo.getViewableUnitList() )) {
 				if( ListTools.containsAny( unitNames, appInfo.getViewableUnitList())) {
 					return true;
 				}
-			}			
+			}
 			if( ListTools.isNotEmpty( appInfo.getViewableGroupList() )) {
 				if( ListTools.containsAny( groupNames, appInfo.getViewableGroupList())) {
 					return true;
 				}
-			}			
+			}
 			if( ListTools.isNotEmpty( appInfo.getPublishableUnitList() )) {
 				if( ListTools.containsAny( unitNames, appInfo.getPublishableUnitList())) {
 					return true;
 				}
-			}			
+			}
 			if( ListTools.isNotEmpty( appInfo.getPublishableGroupList() )) {
 				if( ListTools.containsAny( groupNames, appInfo.getPublishableGroupList())) {
 					return true;
 				}
 			}
-		}		
+		}
 		return false;
 	}
 
@@ -247,22 +248,6 @@ public class BaseAction extends StandardJaxrsAction {
 				return true;
 			}
 		}
-		//是否是作者
-		if( ListTools.isNotEmpty( document.getAuthorPersonList() )) {
-			if( document.getAuthorPersonList().contains( personName ) ) {
-				return true;
-			}
-		}
-		if( ListTools.isNotEmpty( document.getAuthorUnitList() )) {
-			if( ListTools.containsAny( unitNames, document.getAuthorUnitList())) {
-				return true;
-			}
-		}
-		if( ListTools.isNotEmpty( document.getAuthorGroupList() )) {
-			if( ListTools.containsAny( groupNames, document.getAuthorGroupList())) {
-				return true;
-			}
-		}
 
 		if(business.isHasPlatformRole(personName, ThisApplication.ROLE_CMSManager)){
 			return true;
@@ -288,6 +273,27 @@ public class BaseAction extends StandardJaxrsAction {
 		return target;
 	}
 
+	protected List<String> getShortTargetFlag(List<String> nameList) {
+		List<String> targetList = new ArrayList<>();
+		if( ListTools.isNotEmpty( nameList ) ){
+			for(String distinguishedName : nameList) {
+				String target = distinguishedName;
+				String[] array = distinguishedName.split("@");
+				StringBuffer sb = new StringBuffer();
+				if (array.length == 3) {
+					target = sb.append(array[1]).append("@").append(array[2]).toString();
+				} else if (array.length == 2) {
+					//2段
+					target = sb.append(array[0]).append("@").append(array[1]).toString();
+				} else {
+					target = array[0];
+				}
+				targetList.add(target);
+			}
+		}
+		return targetList;
+	}
+
 
 
 //	/**