Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
ff22e631
"eladmin-system/vscode:/vscode.git/clone" did not exist on "1373792155abbd9bfe71592fb8e0189a2b6f228f"
Commit
ff22e631
authored
Feb 13, 2020
by
铭飞
Committed by
Gitee
Feb 13, 2020
Browse files
!225 shiro启用
Merge pull request !225 from 小伍/master
parents
7fcab1aa
6e5bdba3
Changes
4
Show whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/ContentAction.java
View file @
ff22e631
...
@@ -102,6 +102,7 @@ public class ContentAction extends BaseAction{
...
@@ -102,6 +102,7 @@ public class ContentAction extends BaseAction{
BaseEntity
contentEntity
=
contentBiz
.
getEntity
(
Integer
.
parseInt
(
content
.
getId
()));
BaseEntity
contentEntity
=
contentBiz
.
getEntity
(
Integer
.
parseInt
(
content
.
getId
()));
model
.
addAttribute
(
"contentEntity"
,
contentEntity
);
model
.
addAttribute
(
"contentEntity"
,
contentEntity
);
}
}
model
.
addAttribute
(
"appId"
,
BasicUtil
.
getAppId
());
return
"/cms/content/form"
;
return
"/cms/content/form"
;
}
}
...
...
src/main/java/net/mingsoft/config/ShiroConfig.java
View file @
ff22e631
package
net.mingsoft.config
;
package
net.mingsoft.config
;
import
java.util.LinkedHashMap
;
import
net.mingsoft.basic.security.BaseAuthRealm
;
import
java.util.Map
;
import
org.apache.shiro.mgt.SecurityManager
;
import
org.apache.shiro.mgt.SecurityManager
;
import
org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor
;
import
org.apache.shiro.spring.web.ShiroFilterFactoryBean
;
import
org.apache.shiro.spring.web.ShiroFilterFactoryBean
;
import
org.apache.shiro.web.mgt.DefaultWebSecurityManager
;
import
org.apache.shiro.web.mgt.DefaultWebSecurityManager
;
import
org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
import
net.mingsoft.basic.security.BaseAuthRealm
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
@Configuration
@Configuration
public
class
ShiroConfig
{
public
class
ShiroConfig
{
...
@@ -19,6 +19,29 @@ public class ShiroConfig {
...
@@ -19,6 +19,29 @@ public class ShiroConfig {
@Value
(
"${ms.manager.path}"
)
@Value
(
"${ms.manager.path}"
)
private
String
managerPath
;
private
String
managerPath
;
/**
* 开启Shiro的注解(如@RequiresRoles , @RequiresPermissions),需借助SspringAOP扫描使用Sshiro注解的类,并在必要时进行安全逻辑验证
* 配置以下两个bean(Defaul tAdvisorAutoProxyCreator和uthorizat ionAttributeSourceAdvisor)即可实现此功能
*/
@Bean
public
DefaultAdvisorAutoProxyCreator
advisorAutoProxyCreator
(){
DefaultAdvisorAutoProxyCreator
advisorAutoProxyCreator
=
new
DefaultAdvisorAutoProxyCreator
();
advisorAutoProxyCreator
.
setProxyTargetClass
(
true
);
return
advisorAutoProxyCreator
;
}
/**
* 开启shiro aop注解支持
* 使用代理方式;所以需要开启代码支持
* @param securityManager
*/
@Bean
public
AuthorizationAttributeSourceAdvisor
authorizationAttributeSourceAdvisor
(
SecurityManager
securityManager
){
AuthorizationAttributeSourceAdvisor
authorizationAttributeSourceAdvisor
=
new
AuthorizationAttributeSourceAdvisor
();
authorizationAttributeSourceAdvisor
.
setSecurityManager
(
securityManager
);
return
authorizationAttributeSourceAdvisor
;
}
@Bean
@Bean
public
ShiroFilterFactoryBean
shirFilter
(
SecurityManager
securityManager
)
{
public
ShiroFilterFactoryBean
shirFilter
(
SecurityManager
securityManager
)
{
ShiroFilterFactoryBean
shiroFilterFactoryBean
=
new
ShiroFilterFactoryBean
();
ShiroFilterFactoryBean
shiroFilterFactoryBean
=
new
ShiroFilterFactoryBean
();
...
...
src/main/webapp/WEB-INF/manager/cms/content/form.ftl
View file @
ff22e631
...
@@ -184,7 +184,7 @@
...
@@ -184,7 +184,7 @@
:limit="1"
:limit="1"
:on-exceed="contentImghandleExceed"
:on-exceed="contentImghandleExceed"
:disabled="false"
:disabled="false"
:data="
{
uploadPath
:
'/
cms
/
content
'
,
'
isRename
'
:
true
,
'
appId
'
:
true
}
"
:data="
{
uploadPath
:
'/
$
{
appId
}
/
cms
/
content
'
,
'
isRename
'
:
true
}
"
:on-success="contentImgSuccess"
:on-success="contentImgSuccess"
accept="image/
*
"
accept="image/
*
"
list-type="picture-card">
list-type="picture-card">
...
@@ -267,7 +267,7 @@
...
@@ -267,7 +267,7 @@
maximumWords
:
2000
,
maximumWords
:
2000
,
initialFrameWidth
:
'
100
%'
,
initialFrameWidth
:
'
100
%'
,
initialFrameHeight
:
400
,
initialFrameHeight
:
400
,
serverUrl
:
ms
.base
+
"/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:
\'
"
+
ms
.base
+
"
\'
,fileUrlPrefix:
\'
"
+
ms
.base
+
"
\'
,imageUrlPrefix:
\'
"
+
ms
.base
+
"
\'
,imagePathFormat:
\'
/upload/cms/content/editor/%7Btime%7D
\'
,filePathFormat:
\'
/upload/cms/content/editor/%7Btime%7D
\'
,videoPathFormat:
\'
/upload/cms/content/editor/%7Btime%7D
\'
%7D"
,
serverUrl
:
ms
.base
+
"/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:
\'
"
+
ms
.base
+
"
\'
,fileUrlPrefix:
\'
"
+
ms
.base
+
"
\'
,imageUrlPrefix:
\'
"
+
ms
.base
+
"
\'
,imagePathFormat:
\'
/upload/
${appId}/
cms/content/editor/%7Btime%7D
\'
,filePathFormat:
\'
/upload/
${appId}/
cms/content/editor/%7Btime%7D
\'
,videoPathFormat:
\'
/upload/
${appId}/
cms/content/editor/%7Btime%7D
\'
%7D"
,
UEDITOR
_
HOME
_
URL
:
ms
.base
+
'/
static
/
plugins
/
ueditor
/
1.4
.
3.1
/'
UEDITOR
_
HOME
_
URL
:
ms
.base
+
'/
static
/
plugins
/
ueditor
/
1.4
.
3.1
/'
},
},
contentCategoryIdOptions
:
[]
,
contentCategoryIdOptions
:
[]
,
...
...
src/main/webapp/static/plugins/ms/1.0.0/ms.util.js
View file @
ff22e631
...
@@ -20,7 +20,18 @@
...
@@ -20,7 +20,18 @@
log
(
e
.
message
);
log
(
e
.
message
);
}
}
}
}
//树形数据组织
/**
* 列表数据转化为树形结构的列表
* @param source 数据源list
* @param id 编号
* @param parentId 父级编号
* @param children 树形子集变量
* @returns {*}
* 支持父级编号为 0或null
* 原始数据[{id:1,titile:"标题",pid:0},{id:2,titile:"标题",pid:1}]
* 转化树形数据:[{id:1,titile:"标题",pid:0,children:[{id:2,titile:"标题",pid:1}]}]
*/
function
treeData
(
source
,
id
,
parentId
,
children
)
{
function
treeData
(
source
,
id
,
parentId
,
children
)
{
var
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
source
));
var
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
source
));
return
cloneData
.
filter
(
function
(
father
)
{
return
cloneData
.
filter
(
function
(
father
)
{
...
@@ -28,7 +39,7 @@
...
@@ -28,7 +39,7 @@
return
father
[
id
]
==
child
[
parentId
];
return
father
[
id
]
==
child
[
parentId
];
});
});
branchArr
.
length
>
0
?
father
[
children
]
=
branchArr
:
''
;
branchArr
.
length
>
0
?
father
[
children
]
=
branchArr
:
''
;
return
!
father
[
parentId
]
||
father
[
parentId
]
==
'
0
'
;
// 如果第一层不是parentId=0,请自行修改
return
!
father
[
parentId
]
||
father
[
parentId
]
==
'
0
'
||
father
[
parentId
]
==
null
;
});
});
}
}
//验证是否为子集
//验证是否为子集
...
...
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