mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-10 11:49:10 +00:00
Asset meta (#3539)
- 更改了资产表单,影响 - 资产创建和更新 - 增加了资产平台数据库,影响 - 平台创建更新和删除 - 更改了资产的platform字段,又一个字符字段,改为一个外键,影响 - 资产创建和更新 - 资产连接 [windows,linux] - 测试连接等ansible任务 - 自动化云导入 - 更改了资产的序列化器,影响 - 资产创建更新列表 - 统一了树列表基础模板,影响 - 资产列表页,权限列表页,vault页,资产收集页 - 统一了导入导出组件,影响 - 资产导入导出 - 用户导入导出 - 用户组导入导出 - 系统用户导入导出 - 管理用户导入导出 - vault导出导出 - 收集用户列表导入导出 - 修改用户更新密码信号,影响 - 修改用户密码产生的改密日志 - 新增Model instance序列化工具函数,影响 - 操作日志生成 - 修改api mixin,新增 serializer_classes字段,serializer_classes = {"default": "", "display": "", "list": .., "other_action": ""}, 根据用户请求的方式返回不同的serializer_class,影响 - 用户的viewset - 资产权限的viewset - 统一系统配置中的tab切换 - 统一没有nav的页面,影响 - 重置密码 - 忘记密码 - 重置中设置密码 - 独立的message页面 - 修改用户组列表页,不再返还用户组下的用户,仅有数量 - 组织的一些方法变为layzproperty,避免重复计算 - 修改用户组详情页,影响 - 用户组增加删除用户
This commit is contained in:
@@ -19,6 +19,7 @@ from django.shortcuts import reverse
|
||||
from orgs.utils import current_org
|
||||
from common.utils import get_signer, date_expired_default, get_logger, lazyproperty
|
||||
from common import fields
|
||||
from ..signals import post_user_change_password
|
||||
|
||||
|
||||
__all__ = ['User']
|
||||
@@ -43,14 +44,10 @@ class AuthMixin:
|
||||
self.set_password(password_raw_)
|
||||
|
||||
def set_password(self, raw_password):
|
||||
self._set_password = True
|
||||
if self.can_update_password():
|
||||
self.date_password_last_updated = timezone.now()
|
||||
post_user_change_password.send(self.__class__, user=self)
|
||||
super().set_password(raw_password)
|
||||
else:
|
||||
error = _("User auth from {}, go there change password").format(
|
||||
self.source)
|
||||
raise PermissionError(error)
|
||||
|
||||
def can_update_password(self):
|
||||
return self.is_local
|
||||
@@ -196,22 +193,22 @@ class RoleMixin:
|
||||
def is_app(self):
|
||||
return self.role == 'App'
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def user_orgs(self):
|
||||
from orgs.models import Organization
|
||||
return Organization.get_user_user_orgs(self)
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def admin_orgs(self):
|
||||
from orgs.models import Organization
|
||||
return Organization.get_user_admin_orgs(self)
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def audit_orgs(self):
|
||||
from orgs.models import Organization
|
||||
return Organization.get_user_audit_orgs(self)
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def admin_or_audit_orgs(self):
|
||||
from orgs.models import Organization
|
||||
return Organization.get_user_admin_or_audit_orgs(self)
|
||||
@@ -223,26 +220,26 @@ class RoleMixin:
|
||||
else:
|
||||
return False
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def is_org_auditor(self):
|
||||
if self.is_super_auditor or self.related_audit_orgs.exists():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def can_admin_current_org(self):
|
||||
return current_org.can_admin_by(self)
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def can_audit_current_org(self):
|
||||
return current_org.can_audit_by(self)
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def can_user_current_org(self):
|
||||
return current_org.can_user_by(self)
|
||||
|
||||
@property
|
||||
@lazyproperty
|
||||
def can_admin_or_audit_current_org(self):
|
||||
return self.can_admin_current_org or self.can_audit_current_org
|
||||
|
||||
|
Reference in New Issue
Block a user