Skip to content

Commit

Permalink
auto release
Browse files Browse the repository at this point in the history
  • Loading branch information
mouday committed Jul 10, 2023
1 parent a529702 commit ff46b39
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
## 更新日志
- v1.5.0(开发中)
- 新增网站监控 [issues17](https://github.com/mouday/domain-admin/issues/17)
- 新增网站监控 [issues#17](https://github.com/mouday/domain-admin/issues/17)

- v1.4.x(开发中)
- ssl证书申请
- admin拥有所有权限

- v1.4.29(2023-07-08)
- 支持Python版本:Python >= 2.7 或者 Python >= 3.4
- v1.4.30(2023-07-09)
- 修复 域名列表查看详情后列表显示无权限编辑的bug

- v1.4.29(2023-07-09)
- 新增 支持Python版本:Python >= 2.7 或者 Python >= 3.4

- v1.4.28(2023-07-08)
- 新增域名后缀的信息查询: ws, cm, by [issues#39](https://github.com/mouday/domain-admin/issues/39)
- 新增 域名后缀的信息查询: ws, cm, by [issues#39](https://github.com/mouday/domain-admin/issues/39)

- v1.4.27(2023-07-08)
- 新增 移动端H5页面
Expand Down
13 changes: 12 additions & 1 deletion domain_admin/api/domain_info_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from domain_admin.model.domain_model import DomainModel
from domain_admin.model.group_model import GroupModel
from domain_admin.model.group_user_model import GroupUserModel
from domain_admin.service import domain_info_service, async_task_service, file_service, group_service, operation_service
from domain_admin.service import domain_info_service, async_task_service, file_service, group_service, \
operation_service, group_user_service
from domain_admin.utils import domain_util, time_util, icp_util
from domain_admin.utils.flask_ext.app_exception import AppException

Expand Down Expand Up @@ -192,6 +193,16 @@ def get_domain_info_by_id():
domain_row['ssl_count'] = ssl_count
domain_row['group_name'] = group_service.get_group_name_by_id(domain_row['group_id'])

# 编辑权限
group_user_permission_map = group_user_service.get_group_user_permission_map(current_user_id)

if domain_row['user_id'] == current_user_id:
has_edit_permission = True
else:
has_edit_permission = group_user_permission_map.get(domain_row['group_id'], False)

domain_row['has_edit_permission'] = has_edit_permission

return domain_row


Expand Down
15 changes: 15 additions & 0 deletions domain_admin/service/group_user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,18 @@ def get_user_group_ids(user_id):
st.update(group_ids)
st.update(user_group_ids)
return list(st)


def get_group_user_permission_map(user_id):
"""
获取用户所在分组的权限关系
:param user_id: int
:return: dict
"""
# 所在分组
group_user_rows = GroupUserModel.select().where(
GroupUserModel.user_id == user_id
)

# 组员权限
return {row.group_id: row.has_edit_permission for row in group_user_rows}
2 changes: 1 addition & 1 deletion domain_admin/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"""
from __future__ import print_function, unicode_literals, absolute_import, division

VERSION = '1.4.29'
VERSION = '1.4.30'

0 comments on commit ff46b39

Please sign in to comment.