Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
superrain51
apollo
提交
b536c2d8
apollo
项目概览
superrain51
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b536c2d8
编写于
7月 18, 2016
作者:
J
Jason Song
提交者:
GitHub
7月 18, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #330 from lepdou/bugfix_0718
初始化private app namespace的权限放在transaction里面
上级
4c64de67
10d17f87
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
17 addition
and
15 deletion
+17
-15
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
...om/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java
...ip/framework/apollo/portal/listener/CreationListener.java
+4
-10
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
.../framework/apollo/portal/service/AppNamespaceService.java
+10
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
...ctrip/framework/apollo/portal/service/ClusterService.java
+1
-1
未找到文件。
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
浏览文件 @
b536c2d8
...
...
@@ -82,7 +82,7 @@ public class AdminServiceAPI {
getAdminServiceHost
(
env
),
namespace
.
getAppId
(),
namespace
.
getClusterName
()).
getBody
();
}
public
AppNamespaceDTO
create
OrUpdate
AppNamespace
(
Env
env
,
AppNamespaceDTO
appNamespace
)
{
public
AppNamespaceDTO
createAppNamespace
(
Env
env
,
AppNamespaceDTO
appNamespace
)
{
return
restTemplate
.
postForEntity
(
"{host}/apps/{appId}/appnamespaces"
,
appNamespace
,
AppNamespaceDTO
.
class
,
getAdminServiceHost
(
env
),
appNamespace
.
getAppId
()).
getBody
();
}
...
...
@@ -146,7 +146,7 @@ public class AdminServiceAPI {
}
public
ClusterDTO
create
OrUpdate
(
Env
env
,
ClusterDTO
cluster
)
{
public
ClusterDTO
create
(
Env
env
,
ClusterDTO
cluster
)
{
return
restTemplate
.
postForObject
(
"{host}/apps/{appId}/clusters"
,
cluster
,
ClusterDTO
.
class
,
getAdminServiceHost
(
env
),
cluster
.
getAppId
());
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java
浏览文件 @
b536c2d8
...
...
@@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.HttpStatusCodeException
;
import
java.util.List
;
...
...
@@ -38,7 +37,7 @@ public class CreationListener {
for
(
Env
env
:
envs
)
{
try
{
appAPI
.
createApp
(
env
,
appDTO
);
}
catch
(
HttpStatusCodeException
e
)
{
}
catch
(
Throwable
e
)
{
logger
.
error
(
"call appAPI.createApp error.[{app}, {env}]"
,
appDTO
.
getAppId
(),
env
,
e
);
}
}
...
...
@@ -50,16 +49,11 @@ public class CreationListener {
List
<
Env
>
envs
=
portalSettings
.
getActiveEnvs
();
for
(
Env
env
:
envs
)
{
try
{
namespaceAPI
.
create
OrUpdate
AppNamespace
(
env
,
dto
);
}
catch
(
HttpStatusCodeException
e
)
{
logger
.
error
(
"call namespaceAPI.create
OrUpdate
AppNamespace error. [{app}, {env}]"
,
dto
.
getAppId
(),
env
,
e
);
namespaceAPI
.
createAppNamespace
(
env
,
dto
);
}
catch
(
Throwable
e
)
{
logger
.
error
(
"call namespaceAPI.createAppNamespace error. [{app}, {env}]"
,
dto
.
getAppId
(),
env
,
e
);
}
}
//如果是私有的app namespace 要默认初始化权限
if
(!
dto
.
isPublic
())
{
roleInitializationService
.
initNamespaceRoles
(
dto
.
getAppId
(),
dto
.
getName
());
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
浏览文件 @
b536c2d8
...
...
@@ -22,7 +22,8 @@ public class AppNamespaceService {
private
UserInfoHolder
userInfoHolder
;
@Autowired
private
AppNamespaceRepository
appNamespaceRepository
;
@Autowired
private
RoleInitializationService
roleInitializationService
;
/**
* 公共的app ns,能被其它项目关联到的app ns
...
...
@@ -74,7 +75,14 @@ public class AppNamespaceService {
throw
new
BadRequestException
(
appNamespace
.
getName
()
+
"已存在"
);
}
return
appNamespaceRepository
.
save
(
appNamespace
);
AppNamespace
createdAppNamespace
=
appNamespaceRepository
.
save
(
appNamespace
);
//如果是私有的app namespace 要默认初始化权限,如果是公共的,则在关联此namespace的时候初始化权限
if
(!
createdAppNamespace
.
isPublic
())
{
roleInitializationService
.
initNamespaceRoles
(
appNamespace
.
getAppId
(),
appNamespace
.
getName
());
}
return
createdAppNamespace
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
浏览文件 @
b536c2d8
...
...
@@ -24,7 +24,7 @@ public class ClusterService {
if
(!
clusterAPI
.
isClusterUnique
(
cluster
.
getAppId
(),
env
,
cluster
.
getName
())){
throw
new
BadRequestException
(
String
.
format
(
"cluster %s already exists."
,
cluster
.
getName
()));
}
return
clusterAPI
.
create
OrUpdate
(
env
,
cluster
);
return
clusterAPI
.
create
(
env
,
cluster
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录