Skip to content

Commit

Permalink
Merge branch 'TencentBlueKing:development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Canway-shiisa authored Oct 15, 2021
2 parents 6ea9188 + 114fd07 commit da57d13
Show file tree
Hide file tree
Showing 72 changed files with 1,599 additions and 550 deletions.
2 changes: 1 addition & 1 deletion deploy/helm/api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: v2.3.0-a2
appVersion: v2.3.0-beta.1
description: A Helm chart for bk user api
name: bkuserapi
type: application
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/bk-user-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: bk-user-stack
description: A Helm chart for bk-user
type: application
version: 0.5.3
appVersion: v2.3.0-a2
appVersion: v2.3.0-beta.1

dependencies:
- name: bkuserapi
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/saas/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: v2.3.0-a2
appVersion: v2.3.0-beta.1
description: A Helm chart for bk user saas
name: bkusersaas
type: application
Expand Down
23 changes: 23 additions & 0 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
# Changelog


## [Version: 2.3.0] - 2021-09-27


### API


- [NEW] 支持传递参数,可以拉取已软删除数据 [#1](https://github.com/TencentBlueKing/bk-user/issues/1)
- [NEW] 支持恢复已删除的数据 [#15](https://github.com/TencentBlueKing/bk-user/issues/15)
- [NEW] 支持记录 LDAP/AD 同步组织架构/人员信息的结构化日志 [#27](https://github.com/TencentBlueKing/bk-user/issues/27)
- [OPTIMIZATION] 优化数据源同步任务为后台执行 [#32](https://github.com/TencentBlueKing/bk-user/issues/32)
- [FIX] 修正 SettingMeta 默认路径参数为 id [#45](https://github.com/TencentBlueKing/bk-user/issues/45)
- [FIX] 修正 API /api/v2/batch/profiles/ 中 swagger 参数 query_ids 缺失问题 [#26](https://github.com/TencentBlueKing/bk-user/issues/26)


### SaaS


- [NEW] 支持数据源同步任务页面查看 [#32](https://github.com/TencentBlueKing/bk-user/issues/32)
- [NEW] 支持登录日志导出 [#32](https://github.com/TencentBlueKing/bk-user/issues/32)
- [OPTIMIZATION] 修改页面拉取上级组件,从全量拉取改为类似【人员选择器】的分页拉取组件 [#55](https://github.com/TencentBlueKing/bk-user/issues/55)



## [Version: 2.2.6] - 2021-05-20


Expand Down
1 change: 1 addition & 0 deletions src/api/bkuser_core/audit/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class LoginLogSerializer(CustomFieldsMixin, serializers.Serializer):
reason = serializers.CharField(help_text=_("失败原因"))
create_time = serializers.DateTimeField(help_text=_("创建时间"))
username = serializers.CharField(help_text=_("登录用户"), source="profile.username")
profile_id = serializers.CharField(help_text=_("登录用户ID"), source="profile.id")
category_id = serializers.CharField(help_text=_("登录用户"), source="profile.category_id")


Expand Down
2 changes: 2 additions & 0 deletions src/api/bkuser_core/common/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ class AdvancedListSerializer(serializers.Serializer):
input_formats=["iso-8601", "%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%S"],
help_text=_("筛选某个时间点前的记录"),
)
include_disabled = serializers.BooleanField(required=False, default=False, help_text=_("是否包含已软删除的数据"))


class AdvancedRetrieveSerialzier(serializers.Serializer):
fields = serializers.CharField(required=False, help_text=_("指定对象返回字段,支持多选,以逗号分隔,例如: username,status,id"))
lookup_field = serializers.CharField(required=False, help_text=_("指定查询字段,内容为 lookup_value 所属字段, 例如: username"))
include_disabled = serializers.BooleanField(required=False, default=False, help_text=_("是否包含已软删除的数据"))


class EmptySerializer(serializers.Serializer):
Expand Down
4 changes: 4 additions & 0 deletions src/api/bkuser_core/profiles/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def validate_extras_value_unique(value: dict, category_id: int, profile_id: int
for s in queryset.only("pk", "extras").extra(
where=["JSON_SEARCH(extras, 'one', %s) is not null"], params=[target_value]
):
# 防御: 可能存在部分旧数据并未添加所有 extra key
if f.name not in s.extras:
continue

if s.extras[f.name] == target_value:
raise ValidationError(
_("自定义字段 {} 需要保证唯一,而目录<id:{}>中已经存在值为 {} 的记录").format(f.display_name, category_id, target_value)
Expand Down
3 changes: 3 additions & 0 deletions src/api/bkuser_core/profiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ def create(self, request, *args, **kwargs):
raise error_codes.CANNOT_MANUAL_WRITE_INTO

serializer.validated_data["domain"] = ProfileCategory.objects.get(pk=validated_data["category_id"]).domain
# `ConfigProvider._refresh_config` 过滤 enabled=True
if not ProfileCategory.objects.get(pk=validated_data["category_id"]).enabled:
raise error_codes.CATEGORY_NOT_ENABLED

try:
existed = Profile.objects.get(
Expand Down
19 changes: 19 additions & 0 deletions src/api/bkuser_core/tests/profiles/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,22 @@ def test_black_extra_name(self, black_names, target):
order=100,
type=DynamicFieldTypeEnum.STRING.value,
)

@pytest.mark.parametrize(
"field_names,force_extras",
[
(["xxxx", "yyyy"], [{"yyyy": "abcd"}, {"xxxx": "abcd"}]),
],
)
def test_duplicate_other_missing_key(self, field_names, force_extras):
for field_name in field_names:
DynamicFieldInfo.objects.create(
name=field_name,
display_name=f"Dis_{field_name}",
unique=True,
order=100,
type=DynamicFieldTypeEnum.STRING.value,
)

for i, e in enumerate(force_extras):
make_simple_profile(username=f"fake{i}", force_create_params={"extras": e})
2 changes: 1 addition & 1 deletion src/pages/src/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
:class="$route.name === 'setting' && 'router-link-active'" @click="goTo('setting')">{{ $t('设置') }}</a>
</p>
</div>
<div class="header-right">
<div class="header-right" data-test-id="list_menuInfo">
<bk-dropdown-menu ref="dropdownHelp"
align="center"
@show="showHelpDropdown = true"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/src/components/authority/NoAuthority.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
:ok-text="$t('去申请')"
@confirm="confirmSourceApply"
@cancel="closeAuth">
<div class="apply-authority-dialog-container">
<div class="apply-authority-dialog-container" data-test-id="list_authorityManagement">
<img src="../../images/svg/lock-radius.svg" alt="lock" class="lock-icon">
<div class="title">{{$t('该操作需要以下权限')}}</div>
<bk-table class="king-table" :data="authInfos" :outer-border="false">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/src/components/catalog/home/ExportUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{{$t('已选择列表')}}({{selectedDepartments.length}})
<span class="clear" @click="clearSelected">{{$t('清空')}}</span>
</h4>
<div class="selected-content">
<div class="selected-content" data-test-id="list_selDepartmentsData">
<ul v-if="selectedDepartments.length" class="selected-list-wrapper">
<li class="selected-list" v-for="(item, index) in selectedDepartments" :key="index">
<span class="title" v-bk-overflow-tips>{{item.name}}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/src/components/catalog/operation/SetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
{{$t('编辑邮件模板')}}
</span>
</div>
<div class="template-config-container" v-show="showEmailTemplate">
<div class="template-config-container" v-show="showEmailTemplate" data-test-id="list_emailInfo">
<i class="arrow"></i>
<ul class="template-config clearfix">
<li class="email-block">
Expand Down
63 changes: 33 additions & 30 deletions src/pages/src/components/organization/ExportTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,39 @@
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
-->
<template>
<ul class="child-node">
<li class="vue-tree-item" v-for="item in treeDataList" :key="item.id">
<div :style="{ 'padding-left': 15 * (treeIndex + 1) + 'px' }"
:class="['tree-node', { 'down': item.showChildren, 'first-tree-node': treeIndex === 0 }]">
<!-- 开关 icon == -->
<p class="unfold-icon" @click.stop="handleClickToggle(item)">
<i class="icon icon-user-triangle" :class="{ 'hidden': !item.has_children }"></i>
<i class="tree-file icon-user-file-close-01"></i>
</p>
<!-- 组织名称 -->
<span class="name-text" v-bk-overflow-tips @click.stop="handleClickToggle(item)">{{item.name}}</span>
<!-- checkbox -->
<template v-if="item.disabled">
<i :class="['check-icon', 'disabled']" @click.stop></i>
</template>
<template v-else>
<i :class="['check-icon', { 'icon-user-sure': item.isChecked }]" @click.stop="checkItem(item)"></i>
</template>
</div>
<div class="tree-node-loading" v-if="item.showLoading">
<img src="../../images/svg/loading.svg" alt="">
</div>
<ExportTree
v-if="item.showChildren && item.children"
:tree-data-list="item.children"
:tree-index="treeIndex + 1"
@selectItem="selectItem"
@handleClickToggle="handleClickToggle" />
</li>
</ul>
<div data-test-id="list_treeData">
<ul class="child-node">
<li class="vue-tree-item" v-for="item in treeDataList" :key="item.id">
<div :style="{ 'padding-left': 15 * (treeIndex + 1) + 'px' }"
:class="['tree-node', { 'down': item.showChildren, 'first-tree-node': treeIndex === 0 }]">
<!-- 开关 icon == -->
<p class="unfold-icon" @click.stop="handleClickToggle(item)">
<i class="icon icon-user-triangle" :class="{ 'hidden': !item.has_children }"></i>
<i class="tree-file icon-user-file-close-01"></i>
</p>
<!-- 组织名称 -->
<span class="name-text" v-bk-overflow-tips @click.stop="handleClickToggle(item)">{{item.name}}</span>
<!-- checkbox -->
<template v-if="item.disabled">
<i :class="['check-icon', 'disabled']" @click.stop></i>
</template>
<template v-else>
<i :class="['check-icon', { 'icon-user-sure': item.isChecked }]" @click.stop="checkItem(item)"></i>
</template>
</div>
<div class="tree-node-loading" v-if="item.showLoading">
<img src="../../images/svg/loading.svg" alt="">
</div>
<ExportTree
v-if="item.showChildren && item.children"
:tree-data-list="item.children"
:tree-index="treeIndex + 1"
@selectItem="selectItem"
@handleClickToggle="handleClickToggle" />
</li>
</ul>
</div>

</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/src/components/organization/SetDepartment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{{$t('已选择列表')}}({{selectedDepartments.length}})
<span class="clear" @click="clearSelected">{{$t('清空')}}</span>
</h4>
<div class="selected-content">
<div class="selected-content" data-test-id="list_selDepartmentsData">
<ul v-if="selectedDepartments.length">
<li class="selected-list" v-for="(item, index) in selectedDepartments" :key="item.id">
<span class="title" v-bk-overflow-tips>{{item.name}}</span>
Expand Down
22 changes: 22 additions & 0 deletions src/pages/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,26 @@ export default {
日志详细: 'Detail log',
正在发起同步任务: 'A synchronization task is being initiated. Procedure',
请在数据更新记录中查看具体详细: 'Please refer to the data update record for details',
审计导出: 'Audit the export',
创建时间: 'creation time',
最近一次登录时间: 'last login time ',
请输入关键字进行搜索: 'Please enter keywords to search',
用户名: 'user name ',
全名: 'full name',
手机号: 'Tel',
邮箱: 'email',
账户状态: 'account status',
在职状态: 'working state',
最近登录: 'recently the login',
最近未登录: 'not logged in recently',
正常: 'normal',
被禁用: 'disabled',
已删除: 'deleted',
已冻结: 'forzen',
在职: 'onJob',
离职: 'dimission',
一个月: 'one month',
两个月: 'two months',
三个月: 'three months',
'审计日志为空, 无法导出': 'the audit log is empty and cannot be exported',
};
22 changes: 22 additions & 0 deletions src/pages/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,26 @@ export default {
小时: '小时',
正在发起同步任务: '正在发起同步任务',
请在数据更新记录中查看具体详细: '请在数据更新记录中查看具体详细',
审计导出: '审计导出',
创建时间: '创建时间',
最近一次登录时间: '最近一次登录时间',
请输入关键字进行搜索: '请输入关键字进行搜索',
用户名: '用户名',
全名: '全名',
手机号: '手机号',
邮箱: '邮箱',
账户状态: '账户状态',
在职状态: '在职状态',
最近登录: '最近登录',
最近未登录: '最近未登录',
正常: '正常',
被禁用: '被禁用',
已删除: '已删除',
已冻结: '已冻结',
在职: '在职',
离职: '离职',
一个月: '一个月',
两个月: '两个月',
三个月: '三个月',
'审计日志为空, 无法导出': '审计日志为空, 无法导出',
};
28 changes: 20 additions & 8 deletions src/pages/src/scss/bk_icon_font/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ <h2 class="page-title">
<div class="tab-panel" data-type="multipleColor">彩色图标</div>
</div>
<section class="tab-content single-color active" data-type="singleColor">
<div data-test-id="iconData">
<ul class="icon-list">
<li class="icon-item" title="user-logo-i">
<span class="icon user-icon icon-user-logo-i"></span>
Expand All @@ -130,21 +131,27 @@ <h2 class="page-title">
<p class="icon-text">duihao-i</p>
</li>
</ul>
</div>
<h3 class="describe-title">为什么使用</h3>
<div data-test-id="meritInfo">
<ul class="use-describe">
<li>弹性,在网页或者 app 上,展示字体是很便捷的。用字体图标可以很方便的改变 icon 的颜色,或者加入一些其他的效果</li>
<li>可缩放,可以很方便的改变图标的大小</li>
<li>矢量,字体图标是矢量的并且具有独立的分辨率,不管在高分辨率还是低分辨率,不管是在网页还是手机端,都具有很好的展示效果,不会出现锯齿或者马赛克模糊</li>
<li>节省加载时间,字体图标很小,每个小图标只有几 kb,大大节省了加载时间</li>
</ul>
</div>
<h3 class="describe-title">如何使用</h3>
<ul class="use-describe">
<li>将整个目录复制到您的项目里</li>
<li>引入 style.css</li>
<li>挑选相应图标并获取类名,如 .bk-icon .icon-demo</li>
</ul>
<div data-test-id="teachingInfo">
<ul class="use-describe">
<li>将整个目录复制到您的项目里</li>
<li>引入 style.css</li>
<li>挑选相应图标并获取类名,如 .bk-icon .icon-demo</li>
</ul>
</div>
</section>
<section class="tab-content multiple-color" data-type="multipleColor">
<div data-test-id="otherIconData">
<ul class="icon-list">
<li class="colorful-icon">
<svg class="icon svg-icon">
Expand All @@ -165,12 +172,16 @@ <h3 class="describe-title">如何使用</h3>
<p class="icon-text">duihao-i</p>
</li>
</ul>
</div>
<h3 class="describe-title">为什么使用</h3>
<div data-test-id="supportSVGInfo">
<ul class="use-describe">
<li>支持彩色图标</li>
<li>跨 SVG 使用,使用 use 可调用文档中加载的所有 SVG 图标 </li>
</ul>
<li>支持彩色图标</li>
<li>跨 SVG 使用,使用 use 可调用文档中加载的所有 SVG 图标 </li>
</ul>
</div>
<h3 class="describe-title">如何使用</h3>
<div data-test-id="hintInfo">
<ul class="use-describe">
<li>将下载的资源文件中 iconcool.js 文件外部资源通过 script 标签引入</li>
<li>在 html 模板文件中挑选对应的对应图标的名称使用,例如:
Expand All @@ -181,6 +192,7 @@ <h3 class="describe-title">如何使用</h3>
</pre>
</li>
</ul>
</div>
</section>
</section>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/pages/src/store/modules/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ export default {
return http.get(`api/v2/audit/operation_logs/?start_time=${startTime}&end_time=${endTime}&page=${page}&page_size=${pageSize}${keyword && (`&keyword=${keyword}`)}`);
// &keyword=${keyword}&page=${page}&page_size=${page_size}
},
// 审计导出
getAuditderive(context, params, config = {}) {
const { url, startTime, endTime } = params;
return http.get(`${url}/api/v2/audit/login_log/export/?start_time=${startTime}&end_time=${endTime}`);
},
},
};
Loading

0 comments on commit da57d13

Please sign in to comment.