Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apollo
Commits
922c8790
Unverified
Commit
922c8790
authored
Jul 26, 2018
by
Jason Song
Committed by
GitHub
Jul 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1292 from nobodyiam/bugfix
bug fix
parents
41a32fee
c4dc744b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java
...framework/apollo/portal/controller/ReleaseController.java
+14
-4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
.../framework/apollo/portal/service/AppNamespaceService.java
+6
-3
apollo-portal/src/main/resources/static/delete_app_cluster_namespace.html
...c/main/resources/static/delete_app_cluster_namespace.html
+1
-1
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java
View file @
922c8790
...
...
@@ -2,8 +2,10 @@ package com.ctrip.framework.apollo.portal.controller;
import
com.ctrip.framework.apollo.common.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.common.exception.NotFoundException
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component.PermissionValidator
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
...
...
@@ -13,6 +15,7 @@ import com.ctrip.framework.apollo.portal.service.ReleaseService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.security.access.AccessDeniedException
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -35,6 +38,8 @@ public class ReleaseController {
private
ApplicationEventPublisher
publisher
;
@Autowired
private
PortalConfig
portalConfig
;
@Autowired
private
PermissionValidator
permissionValidator
;
@PreAuthorize
(
value
=
"@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases"
,
method
=
RequestMethod
.
POST
)
...
...
@@ -138,16 +143,21 @@ public class ReleaseController {
}
@PreAuthorize
(
value
=
"@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)"
)
@RequestMapping
(
path
=
"/envs/{env}/releases/{releaseId}/rollback"
,
method
=
RequestMethod
.
PUT
)
public
void
rollback
(
@PathVariable
String
env
,
@PathVariable
long
releaseId
)
{
releaseService
.
rollback
(
Env
.
valueOf
(
env
),
releaseId
);
ReleaseDTO
release
=
releaseService
.
findReleaseById
(
Env
.
valueOf
(
env
),
releaseId
);
if
(
Objects
.
isNull
(
release
))
{
return
;
if
(
release
==
null
)
{
throw
new
NotFoundException
(
"release not found"
);
}
if
(!
permissionValidator
.
hasReleaseNamespacePermission
(
release
.
getAppId
(),
release
.
getNamespaceName
(),
env
))
{
throw
new
AccessDeniedException
(
"Access is denied"
);
}
releaseService
.
rollback
(
Env
.
valueOf
(
env
),
releaseId
);
ConfigPublishEvent
event
=
ConfigPublishEvent
.
instance
();
event
.
withAppId
(
release
.
getAppId
())
.
withCluster
(
release
.
getClusterName
())
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
View file @
922c8790
...
...
@@ -104,13 +104,16 @@ public class AppNamespaceService {
appNamespace
.
setDataChangeLastModifiedBy
(
operator
);
// unique check
if
(
appNamespace
.
isPublic
()
&&
findPublicAppNamespace
(
appNamespace
.
getName
())
!=
null
)
{
throw
new
BadRequestException
(
appNamespace
.
getName
()
+
"已存在"
);
if
(
appNamespace
.
isPublic
())
{
AppNamespace
publicAppNamespace
=
findPublicAppNamespace
(
appNamespace
.
getName
());
if
(
publicAppNamespace
!=
null
)
{
throw
new
BadRequestException
(
"Public AppNamespace "
+
appNamespace
.
getName
()
+
" already exists in appId: "
+
publicAppNamespace
.
getAppId
()
+
"!"
);
}
}
if
(!
appNamespace
.
isPublic
()
&&
appNamespaceRepository
.
findByAppIdAndName
(
appNamespace
.
getAppId
(),
appNamespace
.
getName
())
!=
null
)
{
throw
new
BadRequestException
(
appNamespace
.
getName
()
+
"已存在
"
);
throw
new
BadRequestException
(
"Private AppNamespace "
+
appNamespace
.
getName
()
+
" already exists!
"
);
}
AppNamespace
createdAppNamespace
=
appNamespaceRepository
.
save
(
appNamespace
);
...
...
apollo-portal/src/main/resources/static/delete_app_cluster_namespace.html
View file @
922c8790
...
...
@@ -151,7 +151,7 @@
</div>
<div
class=
"form-group"
viv
clform-group
>
<label
class=
"col-sm-2 control-label"
>
集群
信息
</label>
AppNamespace
信息
</label>
<div
class=
"col-sm-5"
>
<h5
ng-show=
"appNamespace.info"
ng-bind=
"appNamespace.info"
></h5>
</div>
...
...
Write
Preview
Markdown
is supported
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