Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
openSource
apollo
Commits
fea7ffe8
Commit
fea7ffe8
authored
Oct 12, 2016
by
zhangle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default assign modify、release namespace role to namespace creator
parent
f5dd22eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
NamespaceController.java
...amework/apollo/portal/controller/NamespaceController.java
+17
-1
common-style.css
...-portal/src/main/resources/static/styles/common-style.css
+0
-4
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
View file @
fea7ffe8
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
controller
;
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
controller
;
import
com.google.common.collect.Sets
;
import
com.ctrip.framework.apollo.common.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.common.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
...
@@ -10,6 +12,7 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
...
@@ -10,6 +12,7 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.constant.RoleType
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceCreationModel
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceCreationModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceVO
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceVO
;
import
com.ctrip.framework.apollo.portal.listener.AppNamespaceCreationEvent
;
import
com.ctrip.framework.apollo.portal.listener.AppNamespaceCreationEvent
;
...
@@ -17,6 +20,8 @@ import com.ctrip.framework.apollo.portal.service.AppNamespaceService;
...
@@ -17,6 +20,8 @@ import com.ctrip.framework.apollo.portal.service.AppNamespaceService;
import
com.ctrip.framework.apollo.portal.service.AppService
;
import
com.ctrip.framework.apollo.portal.service.AppService
;
import
com.ctrip.framework.apollo.portal.service.NamespaceService
;
import
com.ctrip.framework.apollo.portal.service.NamespaceService
;
import
com.ctrip.framework.apollo.portal.service.RoleInitializationService
;
import
com.ctrip.framework.apollo.portal.service.RoleInitializationService
;
import
com.ctrip.framework.apollo.portal.service.RolePermissionService
;
import
com.ctrip.framework.apollo.portal.util.RoleUtils
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Cat
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -53,6 +58,8 @@ public class NamespaceController {
...
@@ -53,6 +58,8 @@ public class NamespaceController {
private
AppNamespaceService
appNamespaceService
;
private
AppNamespaceService
appNamespaceService
;
@Autowired
@Autowired
private
RoleInitializationService
roleInitializationService
;
private
RoleInitializationService
roleInitializationService
;
@Autowired
private
RolePermissionService
rolePermissionService
;
@RequestMapping
(
"/appnamespaces/public"
)
@RequestMapping
(
"/appnamespaces/public"
)
public
List
<
AppNamespace
>
findPublicAppNamespaces
()
{
public
List
<
AppNamespace
>
findPublicAppNamespaces
()
{
...
@@ -67,9 +74,10 @@ public class NamespaceController {
...
@@ -67,9 +74,10 @@ public class NamespaceController {
checkModel
(!
CollectionUtils
.
isEmpty
(
models
));
checkModel
(!
CollectionUtils
.
isEmpty
(
models
));
roleInitializationService
.
initNamespaceRoles
(
appId
,
models
.
get
(
0
).
getNamespace
().
getNamespaceName
());
roleInitializationService
.
initNamespaceRoles
(
appId
,
models
.
get
(
0
).
getNamespace
().
getNamespaceName
());
String
namespaceName
=
null
;
for
(
NamespaceCreationModel
model
:
models
)
{
for
(
NamespaceCreationModel
model
:
models
)
{
NamespaceDTO
namespace
=
model
.
getNamespace
();
NamespaceDTO
namespace
=
model
.
getNamespace
();
namespaceName
=
namespace
.
getNamespaceName
();
RequestPrecondition
RequestPrecondition
.
checkArgumentsNotEmpty
(
model
.
getEnv
(),
namespace
.
getAppId
(),
namespace
.
getClusterName
(),
namespace
.
getNamespaceName
());
.
checkArgumentsNotEmpty
(
model
.
getEnv
(),
namespace
.
getAppId
(),
namespace
.
getClusterName
(),
namespace
.
getNamespaceName
());
...
@@ -82,6 +90,14 @@ public class NamespaceController {
...
@@ -82,6 +90,14 @@ public class NamespaceController {
String
.
format
(
"create namespace fail. (env=%s namespace=%s)"
,
model
.
getEnv
(),
namespace
.
getNamespaceName
()),
e
);
String
.
format
(
"create namespace fail. (env=%s namespace=%s)"
,
model
.
getEnv
(),
namespace
.
getNamespaceName
()),
e
);
}
}
}
}
//default assign modify、release namespace role to namespace creator
String
loginUser
=
userInfoHolder
.
getUser
().
getUserId
();
rolePermissionService
.
assignRoleToUsers
(
RoleUtils
.
buildNamespaceRoleName
(
appId
,
namespaceName
,
RoleType
.
MODIFY_NAMESPACE
),
Sets
.
newHashSet
(
loginUser
),
loginUser
);
rolePermissionService
.
assignRoleToUsers
(
RoleUtils
.
buildNamespaceRoleName
(
appId
,
namespaceName
,
RoleType
.
RELEASE_NAMESPACE
),
Sets
.
newHashSet
(
loginUser
),
loginUser
);
return
ResponseEntity
.
ok
().
build
();
return
ResponseEntity
.
ok
().
build
();
}
}
...
...
apollo-portal/src/main/resources/static/styles/common-style.css
View file @
fea7ffe8
...
@@ -262,10 +262,6 @@ table th {
...
@@ -262,10 +262,6 @@ table th {
font-size
:
13px
;
font-size
:
13px
;
}
}
.config-item-container
{
padding-top
:
19px
;
}
.config-item-container
.panel
{
.config-item-container
.panel
{
border-radius
:
0
;
border-radius
:
0
;
}
}
...
...
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