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
eb21142d
Commit
eb21142d
authored
Oct 12, 2016
by
zhangle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assign application namespace role when create app
parent
fea7ffe8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
RoleInitializationService.java
...work/apollo/portal/service/RoleInitializationService.java
+9
-2
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/RoleInitializationService.java
View file @
eb21142d
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.common.entity.App;
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.common.entity.App;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.constant.PermissionType
;
import
com.ctrip.framework.apollo.portal.constant.PermissionType
;
import
com.ctrip.framework.apollo.portal.constant.RoleType
;
import
com.ctrip.framework.apollo.portal.entity.po.Permission
;
import
com.ctrip.framework.apollo.portal.entity.po.Permission
;
import
com.ctrip.framework.apollo.portal.entity.po.Role
;
import
com.ctrip.framework.apollo.portal.entity.po.Role
;
import
com.ctrip.framework.apollo.portal.util.RoleUtils
;
import
com.ctrip.framework.apollo.portal.util.RoleUtils
;
...
@@ -36,17 +37,23 @@ public class RoleInitializationService {
...
@@ -36,17 +37,23 @@ public class RoleInitializationService {
if
(
rolePermissionService
.
findRoleByRoleName
(
appMasterRoleName
)
!=
null
)
{
if
(
rolePermissionService
.
findRoleByRoleName
(
appMasterRoleName
)
!=
null
)
{
return
;
return
;
}
}
String
operat
erUserId
=
userInfoHolder
.
getUser
().
getUserId
();
String
operat
or
=
userInfoHolder
.
getUser
().
getUserId
();
//create app permissions
//create app permissions
createAppMasterRole
(
appId
);
createAppMasterRole
(
appId
);
//assign master role to user
//assign master role to user
rolePermissionService
rolePermissionService
.
assignRoleToUsers
(
RoleUtils
.
buildAppMasterRoleName
(
appId
),
Sets
.
newHashSet
(
app
.
getOwnerName
()),
.
assignRoleToUsers
(
RoleUtils
.
buildAppMasterRoleName
(
appId
),
Sets
.
newHashSet
(
app
.
getOwnerName
()),
operat
erUserId
);
operat
or
);
initNamespaceRoles
(
appId
,
ConfigConsts
.
NAMESPACE_APPLICATION
);
initNamespaceRoles
(
appId
,
ConfigConsts
.
NAMESPACE_APPLICATION
);
//assign modify、release namespace role to user
rolePermissionService
.
assignRoleToUsers
(
RoleUtils
.
buildNamespaceRoleName
(
appId
,
ConfigConsts
.
NAMESPACE_APPLICATION
,
RoleType
.
MODIFY_NAMESPACE
),
Sets
.
newHashSet
(
operator
),
operator
);
rolePermissionService
.
assignRoleToUsers
(
RoleUtils
.
buildNamespaceRoleName
(
appId
,
ConfigConsts
.
NAMESPACE_APPLICATION
,
RoleType
.
RELEASE_NAMESPACE
),
Sets
.
newHashSet
(
operator
),
operator
);
}
}
@Transactional
@Transactional
...
...
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