Skip to content

Commit

Permalink
fix:2.5.3 bug遗留 (#1526)
Browse files Browse the repository at this point in the history
Co-authored-by: Canway-shiisa <[email protected]>
  • Loading branch information
neronkl and Canway-shiisa authored Jan 24, 2024
1 parent 7cd572d commit 6276f4b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/bkuser_core/api/web/profile/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ProfileCreateInputSLZ(serializers.ModelSerializer):

# not required
logo = serializers.CharField(required=False)
position = serializers.IntegerField(required=False)
position = serializers.IntegerField(required=False, allow_null=True)
wx_userid = serializers.CharField(required=False, allow_blank=True, allow_null=True, default="")
qq = serializers.CharField(required=False, allow_blank=True, allow_null=True, default="")
account_expiration_date = serializers.CharField(required=False, allow_null=True, allow_blank=True)
Expand Down
4 changes: 3 additions & 1 deletion src/api/bkuser_core/common/db_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from threading import RLock
from typing import Any, ClassVar, List, Optional, Type

from django.conf import settings
from django.db import connections, models

from bkuser_core.common.enum import AutoLowerEnum
Expand All @@ -40,6 +41,7 @@ class SyncModelMeta:
table_name: ClassVar[str]
is_relation_table: bool = False
pk_field: str = "id"
table_schema: str = settings.DATABASES["default"]["NAME"]
update_exclude_fields: List = []
use_bulk: bool = True
# TODO: support unique_together
Expand Down Expand Up @@ -131,7 +133,7 @@ def get_latest_auto_id(self) -> int:
cursor.execute(
"SELECT `AUTO_INCREMENT` "
"FROM INFORMATION_SCHEMA.TABLES "
"WHERE TABLE_NAME = '%s';" % self.meta.table_name
"WHERE TABLE_NAME = '{}' and TABLE_SCHEMA = '{}';".format(self.meta.table_name, self.meta.table_schema)
)
all_value = cursor.fetchall()
all_value = [v[0] for v in all_value]
Expand Down
2 changes: 1 addition & 1 deletion src/login/bklogin/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{% endif %}
</div>
<div class="user group-control">
<input id="user" type="text" name="username" placeholder="{% trans '请输入用户名' %}">
<input id="user" type="text" name="username" placeholder="{% trans '请输入用户名' %}" autocomplete="off">
</div>
<div class="pwd group-control">
<i class="bk-icon icon-invisible-eye" id="invisible"></i>
Expand Down
9 changes: 8 additions & 1 deletion src/saas/bkuser_shell/proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
import json
import logging
from typing import Optional

Expand Down Expand Up @@ -126,7 +127,13 @@ def _do_call(self, request, rewrite_path=None):

# 无权限, 改状态码为403
if b"auth_infos" in content and b"callback_url" in content:
status_code = status.HTTP_403_FORBIDDEN
# 目录metas接口较为特殊:对个别类型目录创建操作进行授权,需每个项的authorized=False, 返回403
if path == "/api/v1/web/categories/metas/":
is_authorized_category_type_list = [item["authorized"] for item in json.loads(content)["data"]]
if not any(is_authorized_category_type_list):
status_code = status.HTTP_403_FORBIDDEN
else:
status_code = status.HTTP_403_FORBIDDEN

resp_headers = resp.headers
if "Content-Encoding" in resp_headers:
Expand Down

0 comments on commit 6276f4b

Please sign in to comment.