mirror of https://github.com/jumpserver/jumpserver
perf: update intergration
parent
a121bf41fe
commit
10267863bb
|
@ -1,3 +1,2 @@
|
|||
[MESSAGES CONTROL]
|
||||
disable=C0115
|
||||
disable=C0116
|
||||
disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,too-many-ancestors
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import requests
|
||||
import uuid
|
||||
|
||||
from datetime import datetime
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import requests
|
||||
from httpsig.requests_auth import HTTPSignatureAuth
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
|
||||
DEFAULT_ORG_ID = '00000000-0000-0000-0000-000000000002'
|
||||
|
||||
|
||||
|
@ -36,6 +35,7 @@ class SecretRequest(object):
|
|||
Raises:
|
||||
ValueError: If the parameters do not meet the requirements, a detailed error message will be raised.
|
||||
"""
|
||||
|
||||
def __init__(self, asset='', asset_id='', account='', account_id=''):
|
||||
self.account_id = account_id
|
||||
self.asset_id = asset_id
|
||||
|
@ -143,3 +143,6 @@ class JumpServerPAM(object):
|
|||
except RequestException as e:
|
||||
return Secret.from_exception(e)
|
||||
return Secret.from_response(response)
|
||||
|
||||
def get_accounts(self):
|
||||
pass
|
||||
|
|
|
@ -27,11 +27,14 @@ class IntegrationApplication(JMSOrgBaseModel):
|
|||
unique_together = [('name', 'org_id')]
|
||||
verbose_name = _('Integration App')
|
||||
|
||||
@property
|
||||
def accounts_amount(self):
|
||||
def get_accounts(self):
|
||||
qs = Account.objects.all()
|
||||
query = RelatedManager.get_to_filter_qs(self.accounts.value, Account)
|
||||
return qs.filter(*query).count()
|
||||
return qs.filter(*query)
|
||||
|
||||
@property
|
||||
def accounts_amount(self):
|
||||
return self.get_accounts().count()
|
||||
|
||||
@property
|
||||
def is_valid(self):
|
||||
|
|
|
@ -1014,6 +1014,8 @@
|
|||
"RoleInfo": "Role information",
|
||||
"RoleList": "Roles",
|
||||
"RoleUpdate": "Update the role",
|
||||
"UpgradeEnterpriseEditionHelpText": "Upgrade to enterprise edition to enjoy this feature",
|
||||
"UpgradeEnterpriseEdition": "Upgrade to Enterprise Edition",
|
||||
"RoleUsers": "Authorized users",
|
||||
"Rows": "Row",
|
||||
"Rule": "Condition",
|
||||
|
|
|
@ -992,6 +992,8 @@
|
|||
"ResetSSHKey": "重置SSH密钥",
|
||||
"ResetSSHKeySuccessMsg": "发送邮件任务已提交, 用户稍后会收到重置密钥邮件",
|
||||
"ResetSSHKeyWarningMsg": "你确定要发送重置用户的SSH Key的邮件吗?",
|
||||
"UpgradeEnterpriseEditionHelpText": "升级到企业版,解锁当前功能",
|
||||
"UpgradeEnterpriseEdition": "升级企业版",
|
||||
"Resource": "资源",
|
||||
"ResourceType": "资源类型",
|
||||
"ResolveSelected": "解决所选",
|
||||
|
|
|
@ -25,7 +25,7 @@ class UserGroupViewSet(OrgBulkModelViewSet):
|
|||
)
|
||||
|
||||
@action(methods=['post'], detail=True, url_path='add-all-users')
|
||||
def add_all_users(self, request, *args, **kwargs):
|
||||
def add_all_users(self, _):
|
||||
instance = self.get_object()
|
||||
users = User.get_org_users().exclude(groups__id=instance.id)
|
||||
instance.users.add(*users)
|
||||
|
|
Loading…
Reference in New Issue