-
Notifications
You must be signed in to change notification settings - Fork 41
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 #428 from TencentBlueKing/develop
v1.5.13
- Loading branch information
Showing
53 changed files
with
763 additions
and
176 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.5.12 | ||
1.5.13 |
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
51 changes: 51 additions & 0 deletions
51
saas/backend/api/authorization/migrations/0007_auto_20211117_1032.py
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,51 @@ | ||
# Generated by Django 2.2.24 on 2021-11-17 02:32 | ||
|
||
from django.db import migrations | ||
|
||
from backend.api.authorization.constants import ( | ||
AllowListMatchOperationEnum, | ||
AllowListObjectOperationSep, | ||
AuthorizationAPIEnum, | ||
) | ||
|
||
|
||
def add_allow_list(apps, schema_editor): | ||
"""初始化授权API白名单""" | ||
AuthAPIAllowListConfig = apps.get_model("authorization", "AuthAPIAllowListConfig") | ||
# 查询已存在白名单,避免重复 | ||
all_allow_list = AuthAPIAllowListConfig.objects.all() | ||
allow_set = set([(a.type, a.system_id, a.object_id) for a in all_allow_list]) | ||
# 实例授权API 白名单 | ||
system_actions = { | ||
"bk_cmdb": [ | ||
"".join([AllowListMatchOperationEnum.STARTS_WITH.value, AllowListObjectOperationSep, "create_comobj"]), | ||
"".join([AllowListMatchOperationEnum.STARTS_WITH.value, AllowListObjectOperationSep, "edit_comobj"]), | ||
"".join([AllowListMatchOperationEnum.STARTS_WITH.value, AllowListObjectOperationSep, "delete_comobj"]), | ||
], | ||
} | ||
auth_api_allow_list_config = [] | ||
for system_id, object_ids in system_actions.items(): | ||
for object_id in object_ids: | ||
# 已存在,则直接忽略 | ||
if (AuthorizationAPIEnum.AUTHORIZATION_INSTANCE.value, system_id, object_id) in allow_set: | ||
continue | ||
auth_api_allow_list_config.append( | ||
AuthAPIAllowListConfig( | ||
type=AuthorizationAPIEnum.AUTHORIZATION_INSTANCE.value, | ||
system_id=system_id, | ||
object_id=object_id | ||
) | ||
) | ||
if len(auth_api_allow_list_config) != 0: | ||
AuthAPIAllowListConfig.objects.bulk_create(auth_api_allow_list_config) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('authorization', '0006_auto_20210826_1642'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(add_allow_list) | ||
] |
Oops, something went wrong.