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
c4dc744b
Commit
c4dc744b
authored
Jul 25, 2018
by
nobodyiam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
41a32fee
Changes
3
Show 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 @
c4dc744b
...
@@ -2,8 +2,10 @@ package com.ctrip.framework.apollo.portal.controller;
...
@@ -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.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
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.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.core.enums.Env
;
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.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
...
@@ -13,6 +15,7 @@ import com.ctrip.framework.apollo.portal.service.ReleaseService;
...
@@ -13,6 +15,7 @@ import com.ctrip.framework.apollo.portal.service.ReleaseService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.security.access.AccessDeniedException
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -35,6 +38,8 @@ public class ReleaseController {
...
@@ -35,6 +38,8 @@ public class ReleaseController {
private
ApplicationEventPublisher
publisher
;
private
ApplicationEventPublisher
publisher
;
@Autowired
@Autowired
private
PortalConfig
portalConfig
;
private
PortalConfig
portalConfig
;
@Autowired
private
PermissionValidator
permissionValidator
;
@PreAuthorize
(
value
=
"@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)"
)
@PreAuthorize
(
value
=
"@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases"
,
method
=
RequestMethod
.
POST
)
...
@@ -138,16 +143,21 @@ public class ReleaseController {
...
@@ -138,16 +143,21 @@ public class ReleaseController {
}
}
@PreAuthorize
(
value
=
"@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)"
)
@RequestMapping
(
path
=
"/envs/{env}/releases/{releaseId}/rollback"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
path
=
"/envs/{env}/releases/{releaseId}/rollback"
,
method
=
RequestMethod
.
PUT
)
public
void
rollback
(
@PathVariable
String
env
,
public
void
rollback
(
@PathVariable
String
env
,
@PathVariable
long
releaseId
)
{
@PathVariable
long
releaseId
)
{
releaseService
.
rollback
(
Env
.
valueOf
(
env
),
releaseId
);
ReleaseDTO
release
=
releaseService
.
findReleaseById
(
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
();
ConfigPublishEvent
event
=
ConfigPublishEvent
.
instance
();
event
.
withAppId
(
release
.
getAppId
())
event
.
withAppId
(
release
.
getAppId
())
.
withCluster
(
release
.
getClusterName
())
.
withCluster
(
release
.
getClusterName
())
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
View file @
c4dc744b
...
@@ -104,13 +104,16 @@ public class AppNamespaceService {
...
@@ -104,13 +104,16 @@ public class AppNamespaceService {
appNamespace
.
setDataChangeLastModifiedBy
(
operator
);
appNamespace
.
setDataChangeLastModifiedBy
(
operator
);
// unique check
// unique check
if
(
appNamespace
.
isPublic
()
&&
findPublicAppNamespace
(
appNamespace
.
getName
())
!=
null
)
{
if
(
appNamespace
.
isPublic
())
{
throw
new
BadRequestException
(
appNamespace
.
getName
()
+
"已存在"
);
AppNamespace
publicAppNamespace
=
findPublicAppNamespace
(
appNamespace
.
getName
());
if
(
publicAppNamespace
!=
null
)
{
throw
new
BadRequestException
(
"Public AppNamespace "
+
appNamespace
.
getName
()
+
" already exists in appId: "
+
publicAppNamespace
.
getAppId
()
+
"!"
);
}
}
}
if
(!
appNamespace
.
isPublic
()
&&
if
(!
appNamespace
.
isPublic
()
&&
appNamespaceRepository
.
findByAppIdAndName
(
appNamespace
.
getAppId
(),
appNamespace
.
getName
())
!=
null
)
{
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
);
AppNamespace
createdAppNamespace
=
appNamespaceRepository
.
save
(
appNamespace
);
...
...
apollo-portal/src/main/resources/static/delete_app_cluster_namespace.html
View file @
c4dc744b
...
@@ -151,7 +151,7 @@
...
@@ -151,7 +151,7 @@
</div>
</div>
<div
class=
"form-group"
viv
clform-group
>
<div
class=
"form-group"
viv
clform-group
>
<label
class=
"col-sm-2 control-label"
>
<label
class=
"col-sm-2 control-label"
>
集群
信息
</label>
AppNamespace
信息
</label>
<div
class=
"col-sm-5"
>
<div
class=
"col-sm-5"
>
<h5
ng-show=
"appNamespace.info"
ng-bind=
"appNamespace.info"
></h5>
<h5
ng-show=
"appNamespace.info"
ng-bind=
"appNamespace.info"
></h5>
</div>
</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