Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Laurel Lee
O2OA
Commits
2c56fcef
Commit
2c56fcef
authored
3 years ago
by
o2sword
Browse files
Options
Download
Email Patches
Plain Diff
内容管理员设计权限修改
parent
e39c39ff
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java
+2
-17
...ol/src/main/java/com/x/cms/assemble/control/Business.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java
+1
-3
...m/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionListAll.java
+0
-4
.../x/cms/assemble/control/jaxrs/fileinfo/ActionListAll.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/ActionDelete.java
+10
-6
...a/com/x/cms/assemble/control/jaxrs/form/ActionDelete.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/ActionSave.java
+1
-1
...ava/com/x/cms/assemble/control/jaxrs/form/ActionSave.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/view/ActionDelete.java
+10
-9
...a/com/x/cms/assemble/control/jaxrs/view/ActionDelete.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/view/ActionSave.java
+10
-0
...ava/com/x/cms/assemble/control/jaxrs/view/ActionSave.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionDelete.java
+7
-11
...cms/assemble/control/jaxrs/viewcategory/ActionDelete.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java
+1
-4
...x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionDelete.java
+2
-6
.../assemble/control/jaxrs/viewfieldconfig/ActionDelete.java
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java
+1
-18
...ms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java
with
45 additions
and
79 deletions
+45
-79
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/Business.java
+
2
-
17
View file @
2c56fcef
...
@@ -310,21 +310,6 @@ public class Business {
...
@@ -310,21 +310,6 @@ public class Business {
return
false
;
return
false
;
}
}
/**
* TODO (uncomplete)判断用户是否有权限进行:[文件或者附件管理]的操作
*
* @param person
* @return
* @throws Exception
*/
public
boolean
fileInfoEditAvailable
(
EffectivePerson
person
)
throws
Exception
{
if
(
isManager
(
person
))
{
return
true
;
}
// 其他情况暂时全部不允许操作
return
false
;
}
/**
/**
* TODO (uncomplete)判断用户是否有权限进行:[表单模板管理]操作
* TODO (uncomplete)判断用户是否有权限进行:[表单模板管理]操作
*
*
...
@@ -337,7 +322,7 @@ public class Business {
...
@@ -337,7 +322,7 @@ public class Business {
return
true
;
return
true
;
}
}
// 其他情况暂时全部不允许操作
// 其他情况暂时全部不允许操作
return
fals
e
;
return
tru
e
;
}
}
/**
/**
...
@@ -352,7 +337,7 @@ public class Business {
...
@@ -352,7 +337,7 @@ public class Business {
return
true
;
return
true
;
}
}
// 其他情况暂时全部不允许操作
// 其他情况暂时全部不允许操作
return
fals
e
;
return
tru
e
;
}
}
public
boolean
editable
(
EffectivePerson
effectivePerson
,
AppInfo
appInfo
)
throws
Exception
{
public
boolean
editable
(
EffectivePerson
effectivePerson
,
AppInfo
appInfo
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionDelete.java
+
1
-
3
View file @
2c56fcef
...
@@ -38,9 +38,7 @@ public class ActionDelete extends BaseAction {
...
@@ -38,9 +38,7 @@ public class ActionDelete extends BaseAction {
throw
new
Exception
(
"document{id:"
+
fileInfo
.
getDocumentId
()
+
"} 文档信息不存在,无法继续删除."
);
throw
new
Exception
(
"document{id:"
+
fileInfo
.
getDocumentId
()
+
"} 文档信息不存在,无法继续删除."
);
}
}
// 如果信息存在,再判断用户是否有操作的权限,如果没权限不允许继续操作
// 如果信息存在,再判断用户是否有操作的权限,如果没权限不允许继续操作
if
(!
business
.
fileInfoEditAvailable
(
effectivePerson
))
{
throw
new
Exception
(
"fileInfo{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} ,用户没有内容管理应用信息操作的权限!"
);
}
// 删除文件,并且删除记录及文档的关联信息
// 删除文件,并且删除记录及文档的关联信息
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
FileInfo
.
class
,
fileInfo
.
getStorage
());
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
FileInfo
.
class
,
fileInfo
.
getStorage
());
...
...
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ActionListAll.java
+
0
-
4
View file @
2c56fcef
...
@@ -39,10 +39,6 @@ public class ActionListAll extends BaseAction {
...
@@ -39,10 +39,6 @@ public class ActionListAll extends BaseAction {
}
else
{
}
else
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
//如判断用户是否有查看所有文件或者附件的权限,如果没权限不允许继续操作
if
(!
business
.
fileInfoEditAvailable
(
effectivePerson
))
{
throw
new
Exception
(
"person{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} 用户没有查询全部文件或者附件的权限!"
);
}
//如果有权限,继续操作
//如果有权限,继续操作
FileInfoFactory
fileInfoFactory
=
business
.
getFileInfoFactory
();
FileInfoFactory
fileInfoFactory
=
business
.
getFileInfoFactory
();
List
<
String
>
ids
=
fileInfoFactory
.
listAll
();
//获取所有文件或者附件列表
List
<
String
>
ids
=
fileInfoFactory
.
listAll
();
//获取所有文件或者附件列表
...
...
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/ActionDelete.java
+
10
-
6
View file @
2c56fcef
...
@@ -5,6 +5,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
...
@@ -5,6 +5,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.annotation.AuditLog
;
import
com.x.base.core.project.annotation.AuditLog
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.WrapOutId
;
import
com.x.base.core.project.http.WrapOutId
;
...
@@ -26,6 +27,9 @@ public class ActionDelete extends BaseAction {
...
@@ -26,6 +27,9 @@ public class ActionDelete extends BaseAction {
WrapOutId
wrap
=
null
;
WrapOutId
wrap
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
if
(!
business
.
isManager
(
effectivePerson
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
// 先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
// 先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
Form
form
=
business
.
getFormFactory
().
get
(
id
);
Form
form
=
business
.
getFormFactory
().
get
(
id
);
List
<
String
>
viewIds
=
business
.
getViewFactory
().
listByFormId
(
id
);
List
<
String
>
viewIds
=
business
.
getViewFactory
().
listByFormId
(
id
);
...
@@ -34,12 +38,12 @@ public class ActionDelete extends BaseAction {
...
@@ -34,12 +38,12 @@ public class ActionDelete extends BaseAction {
List
<
String
>
viewCategoryIds
=
null
;
List
<
String
>
viewCategoryIds
=
null
;
List
<
ViewCategory
>
viewCategorys
=
null
;
List
<
ViewCategory
>
viewCategorys
=
null
;
View
view
=
null
;
View
view
=
null
;
emc
.
beginTransaction
(
Form
.
class
);
emc
.
beginTransaction
(
Form
.
class
);
emc
.
beginTransaction
(
View
.
class
);
emc
.
beginTransaction
(
View
.
class
);
emc
.
beginTransaction
(
ViewFieldConfig
.
class
);
emc
.
beginTransaction
(
ViewFieldConfig
.
class
);
emc
.
beginTransaction
(
ViewCategory
.
class
);
emc
.
beginTransaction
(
ViewCategory
.
class
);
if
(
viewIds
!=
null
&&
!
viewIds
.
isEmpty
()
){
if
(
viewIds
!=
null
&&
!
viewIds
.
isEmpty
()
){
for
(
String
viewId
:
viewIds
){
for
(
String
viewId
:
viewIds
){
view
=
business
.
getViewFactory
().
get
(
viewId
);
view
=
business
.
getViewFactory
().
get
(
viewId
);
...
@@ -70,14 +74,14 @@ public class ActionDelete extends BaseAction {
...
@@ -70,14 +74,14 @@ public class ActionDelete extends BaseAction {
emc
.
remove
(
form
,
CheckRemoveType
.
all
);
emc
.
remove
(
form
,
CheckRemoveType
.
all
);
emc
.
commit
();
emc
.
commit
();
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
form
.
getName
(),
form
.
getAppId
(),
""
,
""
,
form
.
getId
(),
"FORM"
,
"删除"
);
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
form
.
getName
(),
form
.
getAppId
(),
""
,
""
,
form
.
getId
(),
"FORM"
,
"删除"
);
}
}
wrap
=
new
WrapOutId
(
form
.
getId
()
);
wrap
=
new
WrapOutId
(
form
.
getId
()
);
CacheManager
.
notify
(
Form
.
class
);
CacheManager
.
notify
(
Form
.
class
);
CacheManager
.
notify
(
View
.
class
);
CacheManager
.
notify
(
View
.
class
);
CacheManager
.
notify
(
ViewFieldConfig
.
class
);
CacheManager
.
notify
(
ViewFieldConfig
.
class
);
CacheManager
.
notify
(
ViewCategory
.
class
);
CacheManager
.
notify
(
ViewCategory
.
class
);
result
.
setData
(
wrap
);
result
.
setData
(
wrap
);
}
catch
(
Throwable
th
)
{
}
catch
(
Throwable
th
)
{
th
.
printStackTrace
();
th
.
printStackTrace
();
...
@@ -85,8 +89,8 @@ public class ActionDelete extends BaseAction {
...
@@ -85,8 +89,8 @@ public class ActionDelete extends BaseAction {
}
}
return
result
;
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
public
static
class
Wo
extends
WoId
{
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/form/ActionSave.java
+
1
-
1
View file @
2c56fcef
...
@@ -47,7 +47,7 @@ public class ActionSave extends BaseAction {
...
@@ -47,7 +47,7 @@ public class ActionSave extends BaseAction {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
if
(!
business
.
formEditAvailable
(
effectivePerson
))
{
if
(!
business
.
isManager
(
effectivePerson
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
}
Form
form
=
emc
.
find
(
wi
.
getId
(),
Form
.
class
);
Form
form
=
emc
.
find
(
wi
.
getId
(),
Form
.
class
);
...
...
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/view/ActionDelete.java
+
10
-
9
View file @
2c56fcef
...
@@ -8,6 +8,7 @@ import com.x.base.core.container.EntityManagerContainer;
...
@@ -8,6 +8,7 @@ import com.x.base.core.container.EntityManagerContainer;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WoId
;
...
@@ -17,7 +18,7 @@ import com.x.cms.core.entity.element.ViewCategory;
...
@@ -17,7 +18,7 @@ import com.x.cms.core.entity.element.ViewCategory;
import
com.x.cms.core.entity.element.ViewFieldConfig
;
import
com.x.cms.core.entity.element.ViewFieldConfig
;
public
class
ActionDelete
extends
BaseAction
{
public
class
ActionDelete
extends
BaseAction
{
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
...
@@ -30,16 +31,16 @@ public class ActionDelete extends BaseAction {
...
@@ -30,16 +31,16 @@ public class ActionDelete extends BaseAction {
//查询视图关联的所有分类关联配置
//查询视图关联的所有分类关联配置
List
<
String
>
viewCategoryIds
=
business
.
getViewCategoryFactory
().
listByViewId
(
id
);
List
<
String
>
viewCategoryIds
=
business
.
getViewCategoryFactory
().
listByViewId
(
id
);
List
<
ViewCategory
>
viewCategorys
=
emc
.
list
(
ViewCategory
.
class
,
viewCategoryIds
);
List
<
ViewCategory
>
viewCategorys
=
emc
.
list
(
ViewCategory
.
class
,
viewCategoryIds
);
//如果信息存在,再判断用户是否有操作的权限,如果没权限不允许继续操作
//如果信息存在,再判断用户是否有操作的权限,如果没权限不允许继续操作
if
(!
business
.
viewEditAvailable
(
effectivePerson
))
{
if
(!
business
.
isManager
(
effectivePerson
))
{
throw
new
Exception
(
"view{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} 用户没有内容管理应用信息操作的权限!"
);
throw
new
Exception
AccessDenied
(
effectivePerson
);
}
}
//进行数据库持久化操作
//进行数据库持久化操作
emc
.
beginTransaction
(
View
.
class
);
emc
.
beginTransaction
(
View
.
class
);
emc
.
beginTransaction
(
ViewFieldConfig
.
class
);
emc
.
beginTransaction
(
ViewFieldConfig
.
class
);
emc
.
beginTransaction
(
ViewCategory
.
class
);
emc
.
beginTransaction
(
ViewCategory
.
class
);
//删除所有的viewFieldConfig
//删除所有的viewFieldConfig
if
(
fieldConfigs
!=
null
&&
fieldConfigs
.
size
()
>
0
){
if
(
fieldConfigs
!=
null
&&
fieldConfigs
.
size
()
>
0
){
for
(
ViewFieldConfig
viewFieldConfig
:
fieldConfigs
){
for
(
ViewFieldConfig
viewFieldConfig
:
fieldConfigs
){
...
@@ -55,11 +56,11 @@ public class ActionDelete extends BaseAction {
...
@@ -55,11 +56,11 @@ public class ActionDelete extends BaseAction {
emc
.
remove
(
view
,
CheckRemoveType
.
all
);
emc
.
remove
(
view
,
CheckRemoveType
.
all
);
}
}
emc
.
commit
();
emc
.
commit
();
if
(
view
!=
null
){
if
(
view
!=
null
){
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
view
.
getName
(),
view
.
getAppId
(),
""
,
""
,
view
.
getId
(),
"VIEW"
,
"删除"
);
logService
.
log
(
emc
,
effectivePerson
.
getDistinguishedName
(),
view
.
getName
(),
view
.
getAppId
(),
""
,
""
,
view
.
getId
(),
"VIEW"
,
"删除"
);
}
}
Wo
wo
=
new
Wo
();
Wo
wo
=
new
Wo
();
wo
.
setId
(
view
.
getId
()
);
wo
.
setId
(
view
.
getId
()
);
result
.
setData
(
wo
);
result
.
setData
(
wo
);
...
@@ -73,8 +74,8 @@ public class ActionDelete extends BaseAction {
...
@@ -73,8 +74,8 @@ public class ActionDelete extends BaseAction {
}
}
return
result
;
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
public
static
class
Wo
extends
WoId
{
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/view/ActionSave.java
+
10
-
0
View file @
2c56fcef
...
@@ -5,7 +5,11 @@ import java.util.List;
...
@@ -5,7 +5,11 @@ import java.util.List;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.cms.assemble.control.Business
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
...
@@ -30,6 +34,12 @@ public class ActionSave extends BaseAction {
...
@@ -30,6 +34,12 @@ public class ActionSave extends BaseAction {
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(!
business
.
isManager
(
effectivePerson
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
}
Wi
wi
=
null
;
Wi
wi
=
null
;
View
view
=
null
;
View
view
=
null
;
Boolean
check
=
true
;
Boolean
check
=
true
;
...
...
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionDelete.java
+
7
-
11
View file @
2c56fcef
...
@@ -6,6 +6,7 @@ import com.x.base.core.container.EntityManagerContainer;
...
@@ -6,6 +6,7 @@ import com.x.base.core.container.EntityManagerContainer;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WoId
;
...
@@ -14,28 +15,23 @@ import com.x.cms.core.entity.element.View;
...
@@ -14,28 +15,23 @@ import com.x.cms.core.entity.element.View;
import
com.x.cms.core.entity.element.ViewCategory
;
import
com.x.cms.core.entity.element.ViewCategory
;
public
class
ActionDelete
extends
BaseAction
{
public
class
ActionDelete
extends
BaseAction
{
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
//先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
//先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
ViewCategory
viewCategory
=
business
.
getViewCategoryFactory
().
get
(
id
);
ViewCategory
viewCategory
=
business
.
getViewCategoryFactory
().
get
(
id
);
if
(
null
==
viewCategory
)
{
if
(
null
==
viewCategory
)
{
throw
new
Exception
(
"view{id:"
+
id
+
"} 应用信息不存在."
);
throw
new
Exception
(
"view{id:"
+
id
+
"} 应用信息不存在."
);
}
}
//如果信息存在,再判断用户是否有操作的权限,如果没权限不允许继续操作
if
(!
business
.
viewEditAvailable
(
effectivePerson
))
{
throw
new
Exception
(
"view{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} 用户没有内容管理应用信息操作的权限!"
);
}
//进行数据库持久化操作
//进行数据库持久化操作
emc
.
beginTransaction
(
ViewCategory
.
class
);
emc
.
beginTransaction
(
ViewCategory
.
class
);
emc
.
remove
(
viewCategory
,
CheckRemoveType
.
all
);
emc
.
remove
(
viewCategory
,
CheckRemoveType
.
all
);
emc
.
commit
();
emc
.
commit
();
Wo
wo
=
new
Wo
();
Wo
wo
=
new
Wo
();
wo
.
setId
(
viewCategory
.
getId
()
);
wo
.
setId
(
viewCategory
.
getId
()
);
result
.
setData
(
wo
);
result
.
setData
(
wo
);
...
@@ -48,8 +44,8 @@ public class ActionDelete extends BaseAction {
...
@@ -48,8 +44,8 @@ public class ActionDelete extends BaseAction {
}
}
return
result
;
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
public
static
class
Wo
extends
WoId
{
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewcategory/ActionSave.java
+
1
-
4
View file @
2c56fcef
...
@@ -6,6 +6,7 @@ import java.util.List;
...
@@ -6,6 +6,7 @@ import java.util.List;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
...
@@ -55,10 +56,6 @@ public class ActionSave extends BaseAction {
...
@@ -55,10 +56,6 @@ public class ActionSave extends BaseAction {
if
(
check
){
if
(
check
){
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Business
business
=
new
Business
(
emc
);
//看看用户是否有权限进行应用信息新增操作
if
(!
business
.
viewEditAvailable
(
effectivePerson
))
{
throw
new
Exception
(
"person{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} 用户没有内容管理视图分类关联信息信息操作的权限!"
);
}
viewCategory
=
business
.
getViewCategoryFactory
().
getByViewAndCategory
(
wrapIn
.
getViewId
(),
wrapIn
.
getCategoryId
()
);
viewCategory
=
business
.
getViewCategoryFactory
().
getByViewAndCategory
(
wrapIn
.
getViewId
(),
wrapIn
.
getCategoryId
()
);
if
(
viewCategory
==
null
){
if
(
viewCategory
==
null
){
viewCategory
=
Wi
.
copier
.
copy
(
wrapIn
);
viewCategory
=
Wi
.
copier
.
copy
(
wrapIn
);
...
...
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionDelete.java
+
2
-
6
View file @
2c56fcef
...
@@ -8,6 +8,7 @@ import com.x.base.core.container.EntityManagerContainer;
...
@@ -8,6 +8,7 @@ import com.x.base.core.container.EntityManagerContainer;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.jaxrs.WoId
;
...
@@ -34,11 +35,6 @@ public class ActionDelete extends BaseAction {
...
@@ -34,11 +35,6 @@ public class ActionDelete extends BaseAction {
if
(
null
==
viewFieldConfig
)
{
if
(
null
==
viewFieldConfig
)
{
logger
.
warn
(
"viewFieldConfig{id:"
+
id
+
"} 应用信息不存在."
);
logger
.
warn
(
"viewFieldConfig{id:"
+
id
+
"} 应用信息不存在."
);
}
}
// 如果信息存在,再判断用户是否有操作的权限,如果没权限不允许继续操作
if
(!
business
.
viewEditAvailable
(
effectivePerson
))
{
throw
new
Exception
(
"viewFieldConfig{name:"
+
effectivePerson
.
getDistinguishedName
()
+
"} 用户没有内容管理应用信息操作的权限!"
);
}
// 查询视图信息
// 查询视图信息
View
view
=
business
.
getViewFactory
().
get
(
viewFieldConfig
.
getViewId
());
View
view
=
business
.
getViewFactory
().
get
(
viewFieldConfig
.
getViewId
());
if
(
view
==
null
)
{
if
(
view
==
null
)
{
...
@@ -86,4 +82,4 @@ public class ActionDelete extends BaseAction {
...
@@ -86,4 +82,4 @@ public class ActionDelete extends BaseAction {
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/viewfieldconfig/ActionSave.java
+
1
-
18
View file @
2c56fcef
...
@@ -6,6 +6,7 @@ import java.util.List;
...
@@ -6,6 +6,7 @@ import java.util.List;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
...
@@ -57,24 +58,6 @@ public class ActionSave extends BaseAction {
...
@@ -57,24 +58,6 @@ public class ActionSave extends BaseAction {
}
}
}
}
if
(
check
){
//先看看视图信息是否存在,如果不存在
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
//看看用户是否有权限进行应用信息新增操作
if
(!
business
.
viewEditAvailable
(
effectivePerson
))
{
check
=
false
;
Exception
exception
=
new
ExceptionNoPermission
(
effectivePerson
.
getDistinguishedName
()
);
result
.
error
(
exception
);
}
}
catch
(
Exception
e
)
{
check
=
false
;
Exception
exception
=
new
ExceptionViewQueryByIdEmpty
(
e
,
wi
.
getViewId
()
);
result
.
error
(
exception
);
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
}
}
if
(
check
){
if
(
check
){
//先看看视图信息是否存在,如果不存在
//先看看视图信息是否存在,如果不存在
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
()
)
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
()
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment