Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 【日志平台】po环境外部授权增加批量授权能力 --story=120050745 #3357

9 changes: 9 additions & 0 deletions bklog/apps/log_commons/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ def create_or_update(cls, validated_request_data: Dict[str, Any]):
2.1 编辑:删除存量权限,如有新增则创建审批单据
"""
authorized_users = validated_request_data.pop("authorized_users")
if "__all__" in authorized_users:
authorized_users = list(
cls.objects.filter(
space_uid=validated_request_data["space_uid"],
)
.values_list("authorized_user", flat=True)
.distinct()
)

view_type = validated_request_data.pop("view_type", ViewTypeEnum.USER.value)
operate_type = validated_request_data.pop("operate_type", OperateEnum.CREATE.value)
resources = validated_request_data["resources"]
Expand Down
2 changes: 1 addition & 1 deletion bklog/apps/log_commons/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CreateORUpdateExternalPermissionSLZ(serializers.Serializer):
operate_type = serializers.CharField(required=False, label="操作类型", default=OperateEnum.CREATE.value)
space_uid = serializers.CharField(required=True, label="空间ID")
action_id = serializers.CharField(required=True, label="操作类型")
resources = serializers.ListField(required=True, label="资源列表")
resources = serializers.ListField(required=True, label="资源列表", allow_empty=False)
expire_time = serializers.DateTimeField(required=False, default=None, label="过期时间", allow_null=True)


Expand Down
2 changes: 2 additions & 0 deletions bklog/web/src/language/lang/en/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,6 @@ export default {
查询语法: 'Query Syntax',
接入日志聚类: 'Access Log Cluster',
按annotation选择: 'According To Annotation',
单独授权: 'Separate authorization',
批量授权: 'Batch authorization',
};
2 changes: 2 additions & 0 deletions bklog/web/src/language/lang/en/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,4 +927,6 @@ export default {
副本: 'copy',
新建检索: 'New search',
'收起查询/弹出选项': 'Collapse query/Popup options',
'导入{0}的权限配置': 'Import the permission configuration of {0}',
至少选择一个操作权限: 'Select at least one operation permission',
};
24 changes: 24 additions & 0 deletions bklog/web/src/views/authorization/authorization-dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
width: 100%;
}

.import-user-content {
display: block;
margin-bottom: 10px;
font-size: 12px;

.bk-select {
margin-top: -14px;
transform: translateY(8px);
}
}

.bk-form-checkbox {
margin-right: 10px;
}

.bk-form {
.bk-label {
font-size: 12px;
Expand All @@ -26,3 +41,12 @@
color: #ff9c01;
}
}

.select-group {
width: 100%;
margin: 16px 0 12px 0;

.bk-button {
width: 50%;
}
}
Loading
Loading