-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3496 from jamsman94/feature/globalRole
add gloabl role configs
- Loading branch information
Showing
25 changed files
with
954 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
pkg/microservice/user/core/init/dm_role_template_initialization.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INSERT INTO `role_template` (name, description, type) | ||
VALUES | ||
('project-admin', '拥有执行项目中任何操作的权限', 1), | ||
('read-only', '拥有指定项目中所有资源的读权限', 1), | ||
('read-project-only', '拥有指定项目本身的读权限,无权限查看和操作项目内资源', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
pkg/microservice/user/core/init/role_template_initialization.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INSERT INTO `role_template` (name, description, type) VALUES | ||
("project-admin", "拥有执行项目中任何操作的权限", 1), | ||
("read-only", "拥有指定项目中所有资源的读权限", 1), | ||
("read-project-only", "拥有指定项目本身的读权限,无权限查看和操作项目内资源", 1) | ||
on duplicate key update id=id; |
15 changes: 15 additions & 0 deletions
15
pkg/microservice/user/core/repository/models/role_template.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package models | ||
|
||
type RoleTemplate struct { | ||
ID uint `gorm:"primarykey" json:"id"` | ||
Name string `gorm:"column:name" json:"name"` | ||
Description string `gorm:"column:description" json:"description"` | ||
Type int `gorm:"column:type" json:"type"` | ||
|
||
RoleTemplateActionBindings []RoleTemplateActionBinding `gorm:"foreignKey:RoleTemplateID;constraint:OnDelete:CASCADE;" json:"-"` | ||
RoleTemplateBindings []RoleTemplateBinding `gorm:"foreignKey:RoleTemplateID;constraint:OnDelete:CASCADE;" json:"-"` | ||
} | ||
|
||
func (RoleTemplate) TableName() string { | ||
return "role_template" | ||
} |
Oops, something went wrong.