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

V2.6.3 #1354

Merged
merged 21 commits into from
Oct 14, 2022
Merged

V2.6.3 #1354

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d59f2e5
fix: 🐛 修复消息发送者列表接口为空时服务端报错BUG
guancyxx Oct 11, 2022
c7b97a4
feat: 🎸 暂存信息
jinji-hanbin Oct 12, 2022
aeb81bd
feat: 🎸 去掉关联文件
jinji-hanbin Oct 13, 2022
1497596
fix: 🐛 中心arkid禁用新建租户 (#1345)
luolu-lg Oct 13, 2022
8b5d62c
feat: 🎸 图形验证码更改远端地址获取机制
guancyxx Oct 13, 2022
01a41bb
feat: 🎸 合并V2.5-dev
guancyxx Oct 13, 2022
a816cda
feat: 🎸 添加默认登陆后跳转路径
guancyxx Oct 13, 2022
862b9dc
Merge pull request #1346 from longguikeji/feature-840
guancyxx Oct 13, 2022
a2c74b4
feat: 🎸 修改slug长度限制
guancyxx Oct 13, 2022
737f91e
Merge pull request #1347 from longguikeji/feature-840
guancyxx Oct 13, 2022
148084a
feat: 🎸 文档补充
jinji-hanbin Oct 13, 2022
115344b
Merge pull request #1348 from longguikeji/feature-402
hanbinloop Oct 13, 2022
837e4ce
feat: 🎸 尝试修复login_pages为NoneType BUG
guancyxx Oct 14, 2022
74ede04
feat: 🎸 加强版补丁:login_pages参数类型验证
guancyxx Oct 14, 2022
32c3c36
Merge pull request #1349 from longguikeji/feature-840
guancyxx Oct 14, 2022
1cf613e
feat: 🎸 文档更新来内容
jinji-hanbin Oct 14, 2022
dab4f80
Merge pull request #1351 from longguikeji/feature-402
hanbinloop Oct 14, 2022
f3a08e8
feat: 🎸 update document
jinji-hanbin Oct 14, 2022
5ffb3b3
Merge pull request #1352 from longguikeji/feature-402
hanbinloop Oct 14, 2022
dc011de
feat: 🎸 docs update
jinji-hanbin Oct 14, 2022
d496ea1
Merge pull request #1353 from longguikeji/feature-402
hanbinloop Oct 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,4 @@ arkid_celery_tasks
.devcontainer/
storage/
results.sqlite

tasks
~
tasks/
3 changes: 2 additions & 1 deletion api/v1/pages/mine/switch_tenant.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from arkid.core.translation import gettext_default as _
from arkid.core import actions, pages, routers
from django.conf import settings

tag = "mine_switch_tenant"
name = _("Switch Tenant", "切换租户")
Expand Down Expand Up @@ -28,7 +29,7 @@
name=_("新建租户"),
path='/api/v1/tenants/',
)
},
} if not settings.IS_CENTRAL_ARKID else {},
local_actions={
'switch_tenant': actions.DirectAction(
name=_('Switch', '切换'),
Expand Down
4 changes: 3 additions & 1 deletion api/v1/schema/mine.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ class MessageSenderItemOut(Schema):
)

class MessageSenderOut(ResponseSchema):
data:List[MessageSenderItemOut]
data:List[MessageSenderItemOut] =Field(
default=[]
)

class MineMessageListItemOut(ModelSchema):
class Config:
Expand Down
35 changes: 29 additions & 6 deletions arkid/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from django.utils.translation import gettext_lazy as _
from random import SystemRandom

CHARS_COMMON = ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
CHARS_COMMON = (
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')


def deep_merge(*dicts: List[Dict], update=False) -> Dict:
"""
Expand Down Expand Up @@ -90,7 +92,8 @@ def i18n_mobile_verify(mobile, state_code, state=None):
from inventory.models import I18NMobileConfig

# 验证区号是否匹配
config = I18NMobileConfig.valid_objects.filter(state_code=state_code).first()
config = I18NMobileConfig.valid_objects.filter(
state_code=state_code).first()
if not config: # 未匹配任何配置
return False
if not config.is_active: # 配置未启用
Expand Down Expand Up @@ -239,13 +242,14 @@ def verify_token(request):

return token.user


def data_to_simplenamespace(data):
if isinstance(data, Schema):
data = data.dict()
elif isinstance(data, Model):
data = model_to_dict(data)
elif isinstance(data,dict):
for k,v in data.items():
elif isinstance(data, dict):
for k, v in data.items():
data[k] = data_to_simplenamespace(v)
else:
return data
Expand All @@ -257,10 +261,29 @@ def generate_secret(chars=None, length=128):
生成指定位数的字符串
'''
if chars is None:
chars= CHARS_COMMON
chars = CHARS_COMMON
rand = SystemRandom()
return ''.join(rand.choice(chars) for x in range(length))


def generate_md5_secret(secret):
import hashlib
return hashlib.md5(secret.encode('utf-8')).hexdigest()
return hashlib.md5(secret.encode('utf-8')).hexdigest()

def get_remote_addr_from_xforward(request):
remote_addr = request.headers.get("X-Forwarded-For", None)
if isinstance(remote_addr,str):
remote_addr = remote_addr.split(",")[0]
return remote_addr

def get_remote_addr(request):

remote_addr = get_remote_addr_from_xforward(request) or request.headers.get(
"X-Real-IP", None) or request.headers.get(
"Proxy-Client-IP", None) or request.headers.get(
"Proxy-Client-IP", None) or request.headers.get(
"WL-Proxy-Client-IP", None) or request.headers.get(
"HTTP_CLIENT_IP", None) or request.headers.get(
"HTTP_X_FORWARDED_FOR", None) or request.META.get(
"REMOTE_ADDR")
return remote_addr
18 changes: 9 additions & 9 deletions arkid/core/expand.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ def save(self, *args, **kwargs):

extension_tables = {}
for table, field,extension_name,extension_model_cls,extension_table,extension_field in field_expands:
# if hasattr(self, field):
if extension_table not in extension_tables:
extension_model_obj = getattr(self, extension_table, None) # 判断是否已经关联OneToOne对象
if not extension_model_obj:
extension_model_obj = extension_model_cls()
extension_model_obj.target = self
extension_tables[extension_table] = extension_model_obj
else:
extension_model_obj = extension_tables[extension_table]
if hasattr(self, field):
if extension_table not in extension_tables:
extension_model_obj = getattr(self, extension_table, None) # 判断是否已经关联OneToOne对象
if not extension_model_obj:
extension_model_obj = extension_model_cls()
extension_model_obj.target = self
extension_tables[extension_table] = extension_model_obj
else:
extension_model_obj = extension_tables[extension_table]

setattr(extension_model_obj, extension_field, getattr(self, field))

for extension_model_obj in extension_tables.values():
Expand Down
18 changes: 18 additions & 0 deletions arkid/core/migrations/0031_alter_tenant_slug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.13 on 2022-10-13 11:02

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0030_userpersonalsettings'),
]

operations = [
migrations.AlterField(
model_name='tenant',
name='slug',
field=models.SlugField(blank=True, max_length=24, null=True, unique=True, verbose_name='Slug'),
),
]
2 changes: 1 addition & 1 deletion arkid/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Meta(object):
verbose_name_plural = _("tenant", "租户")

name = models.CharField(verbose_name=_('Name', '名字'), max_length=128)
slug = models.SlugField(verbose_name=_('Slug', '短链接标识'), unique=True, blank=True, null=True)
slug = models.SlugField(verbose_name=_('Slug', '短链接标识'), unique=True, blank=True, null=True, max_length=24)
icon = models.URLField(verbose_name=_('Icon', '图标'), blank=True, null=True)

token_duration_minutes = models.IntegerField(
Expand Down
53 changes: 0 additions & 53 deletions docs/ 用户指南/用户手册/ 普通用户/index.md

This file was deleted.

12 changes: 12 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/个人管理.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 个人管理

## 个人资料
* 查看 点击菜单 "点击用户头像>个人管理>个人资料"
[![BKxfNZ.jpg](https://v1.ax1x.com/2022/10/14/BKxfNZ.jpg)](https://x.imgtu.com/i/BKxfNZ)

* 编辑 点击菜单 "点击用户头像>个人管理>个人资料>编辑"
[![BKxiaU.jpg](https://v1.ax1x.com/2022/10/14/BKxiaU.jpg)](https://x.imgtu.com/i/BKxiaU)

## 应用订阅
* 查看 点击菜单 "点击用户头像>个人管理>应用订阅"
[![BK5mDB.jpg](https://v1.ax1x.com/2022/10/14/BK5mDB.jpg)](https://x.imgtu.com/i/BK5mDB)
12 changes: 12 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/切换租户.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 切换租户

当多租户功能打开时,平台用户可以在多个租户间切换

* 列表 点击菜单 "点击用户头像>切换租户"
[![BK5pMt.jpg](https://v1.ax1x.com/2022/10/14/BK5pMt.jpg)](https://x.imgtu.com/i/BK5pMt)

* 创建 点击菜单 "点击用户头像>切换租户>创建"
[![BK503b.jpg](https://v1.ax1x.com/2022/10/14/BK503b.jpg)](https://x.imgtu.com/i/BK503b)

* 切换 点击菜单 "点击用户头像>切换租户>选择记录>切换"
[![BK535e.jpg](https://v1.ax1x.com/2022/10/14/BK535e.jpg)](https://x.imgtu.com/i/BK535e)
4 changes: 4 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/审批请求.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 审批请求

* 审批请求 点击菜单 "点击用户头像>审批请求"
[![BK51T7.jpg](https://v1.ax1x.com/2022/10/14/BK51T7.jpg)](https://x.imgtu.com/i/BK51T7)
4 changes: 4 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/我的消息.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 我的消息

* 我到消息 点击菜单 "点击用户头像>我到消息"
[![BK54iB.jpg](https://v1.ax1x.com/2022/10/14/BK54iB.jpg)](https://x.imgtu.com/i/BK54iB)
9 changes: 9 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/授权管理.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 授权管理

申请权限:用户可以在此申请自己没有的权限

* 列表 点击菜单 "点击用户头像>授权管理"
[![BK5tuJ.jpg](https://v1.ax1x.com/2022/10/14/BK5tuJ.jpg)](https://x.imgtu.com/i/BK5tuJ)

* 申请 点击菜单 "点击用户头像>授权管理>选择记录>申请"
[![BK5zOG.jpg](https://v1.ax1x.com/2022/10/14/BK5zOG.jpg)](https://x.imgtu.com/i/BK5zOG)
7 changes: 7 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/桌面.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 桌面

桌面,实质上就是应用列表。这里展示了当前用户能打开的所有应用的快捷入口。这些应用一般来说,就是在租户管理中,由租户管理员添加并授权给当前用户的。

* 首页 点击菜单 "点击首页"

[![BK5Jlt.jpg](https://v1.ax1x.com/2022/10/14/BK5Jlt.jpg)](https://x.imgtu.com/i/BK5Jlt)
33 changes: 33 additions & 0 deletions docs/ 用户指南/用户手册/ 普通用户/认证管理.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 认证管理

## 三方账号的绑定

点击绑定按钮后,稍等片刻,页面会跳转到第三方网站完成授权,授权后会自动跳到当前绑定页面

* 绑定 点击菜单 "点击用户头像>认证管理>三方账号绑定"
[![BK5lCP.jpg](https://v1.ax1x.com/2022/10/14/BK5lCP.jpg)](https://x.imgtu.com/i/BK5lCP)

## 三方账号的解绑

点击解绑按钮后,会自动解除三方账户和用户的绑定关系

* 解绑 点击菜单 "点击用户头像>认证管理>三方账号解绑"
[![BK5EBw.jpg](https://v1.ax1x.com/2022/10/14/BK5EBw.jpg)](https://x.imgtu.com/i/BK5EBw)

## 更改密码

* 更改密码 点击菜单 "点击用户头像>认证管理>更改密码"
[![BK5Qb6.jpg](https://v1.ax1x.com/2022/10/14/BK5Qb6.jpg)](https://x.imgtu.com/i/BK5Qb6)
## 更改手机号

* 更改手机号 点击菜单 "点击用户头像>认证管理>更改手机号"
[![BK5NRO.jpg](https://v1.ax1x.com/2022/10/14/BK5NRO.jpg)](https://x.imgtu.com/i/BK5NRO)
## LDAP代理认证密码

* LDAP代理认证密码 点击菜单 "点击用户头像>认证管理>LDAP代理认证密码"
[![BK5Dlq.jpg](https://v1.ax1x.com/2022/10/14/BK5Dlq.jpg)](https://x.imgtu.com/i/BK5Dlq)

## 更改密码

* 更改密码 点击菜单 "点击用户头像>认证管理>更改密码"
[![BK5OAs.jpg](https://v1.ax1x.com/2022/10/14/BK5OAs.jpg)](https://x.imgtu.com/i/BK5OAs)

This file was deleted.

36 changes: 35 additions & 1 deletion docs/ 用户指南/用户手册/ 租户管理员/审批管理.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@

每个审批动作要求对接一个审批系统,审批系统就是用来处理由该审批动作所生成的审批请求。

* 列表 点击菜单 "审批管理>审批动作"
[![xUtN6S.jpg](https://s1.ax1x.com/2022/10/12/xUtN6S.jpg)](https://imgse.com/i/xUtN6S)

* 创建 点击菜单 "审批管理>审批动作>创建"
[![xUt0Ts.jpg](https://s1.ax1x.com/2022/10/12/xUt0Ts.jpg)](https://imgse.com/i/xUt0Ts)

* 编辑 点击菜单 "审批管理>审批动作>选择记录>点击编辑"
[![xUtg6U.jpg](https://s1.ax1x.com/2022/10/12/xUtg6U.jpg)](https://imgse.com/i/xUtg6U)

* 删除 点击菜单 "审批管理>审批动作>选择记录>点击删除"
[![xUtofx.jpg](https://s1.ax1x.com/2022/10/12/xUtofx.jpg)](https://imgse.com/i/xUtofx)

## 审批请求

查看所有审批请求及其状态。
* 查看 点击菜单 "审批管理>审批请求"
[![xUNQjU.jpg](https://s1.ax1x.com/2022/10/12/xUNQjU.jpg)](https://imgse.com/i/xUNQjU)

## 审批系统

Expand All @@ -22,6 +35,27 @@

默认审批系统处理逻辑很简单,就是由租户管理员在 [默认请求处理] 中去处理相关的审批请求。

* 列表 点击菜单 "审批管理>审批系统"
[![xUNxrF.jpg](https://s1.ax1x.com/2022/10/12/xUNxrF.jpg)](https://imgse.com/i/xUNxrF)

* 创建 点击菜单 "审批管理>审批系统>创建"
[![xUN4KS.jpg](https://s1.ax1x.com/2022/10/12/xUN4KS.jpg)](https://imgse.com/i/xUN4KS)

* 编辑 点击菜单 "审批管理>审批系统>选择记录>点击编辑"
[![xUUF8x.jpg](https://s1.ax1x.com/2022/10/12/xUUF8x.jpg)](https://imgse.com/i/xUUF8x)

* 删除 点击菜单 "审批管理>审批系统>选择记录>点击删除"
[![xUUlGt.jpg](https://s1.ax1x.com/2022/10/12/xUUlGt.jpg)](https://imgse.com/i/xUUlGt)

## 默认请求处理

默认审批系统,处理审批请求的页面。

* 列表 点击菜单 "审批管理>默认请求处理"
[![xU5m1f.jpg](https://s1.ax1x.com/2022/10/12/xU5m1f.jpg)](https://imgse.com/i/xU5m1f)

* 通过 点击菜单 "审批管理>默认请求处理>选择记录>通过"
[![xU5NcT.jpg](https://s1.ax1x.com/2022/10/12/xU5NcT.jpg)](https://imgse.com/i/xU5NcT)

* 拒绝 点击菜单 "审批管理>默认请求处理>选择记录>拒绝"
[![xU5rNR.jpg](https://s1.ax1x.com/2022/10/12/xU5rNR.jpg)](https://imgse.com/i/xU5rNR)
Loading