Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/jumpserver/jumpserver into p…
Browse files Browse the repository at this point in the history
…r@dev@perf_ticket_batch_approval
  • Loading branch information
O-Jiangweidong committed Jul 19, 2023
2 parents 27b79e4 + b8397e7 commit 278548c
Show file tree
Hide file tree
Showing 13 changed files with 339 additions and 394 deletions.
13 changes: 8 additions & 5 deletions apps/accounts/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ def get_manual_account(cls):
def get_anonymous_account(cls):
return cls(name=AliasAccount.ANON.label, username=AliasAccount.ANON.value, secret=None)

@lazyproperty
def versions(self):
return self.history.count()

@classmethod
def get_user_account(cls):
""" @USER 动态用户的账号(self) """
return cls(name=AliasAccount.USER.label, username=AliasAccount.USER.value, secret=None)

@lazyproperty
def versions(self):
return self.history.count()

def get_su_from_accounts(self):
""" 排除自己和以自己为 su-from 的账号 """
return self.asset.accounts.exclude(id=self.id).exclude(su_from=self)
Expand All @@ -140,7 +140,10 @@ class Meta:
def get_su_from_account_templates(cls, pk=None):
if pk is None:
return cls.objects.all()
return cls.objects.exclude(Q(id=pk) | Q(_id=pk))
return cls.objects.exclude(Q(id=pk) | Q(su_from_id=pk))

def __str__(self):
return f'{self.name}({self.username})'

def get_su_from_account(self, asset):
su_from = self.su_from
Expand Down
8 changes: 5 additions & 3 deletions apps/common/management/commands/services/command.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import multiprocessing
from django.core.management.base import BaseCommand, CommandError

from django.core.management.base import BaseCommand
from django.db.models import TextChoices
from .utils import ServicesUtil

from .hands import *
from .utils import ServicesUtil


class Services(TextChoices):
Expand Down Expand Up @@ -97,7 +99,7 @@ def add_arguments(self, parser):
cores = multiprocessing.cpu_count() * 2 + 1

parser.add_argument(
'services', nargs='+', choices=Services.export_services_values(), help='Service',
'services', nargs='+', choices=Services.export_services_values(), help='Service',
)
parser.add_argument('-d', '--daemon', nargs="?", const=True)
parser.add_argument('-w', '--worker', type=int, nargs="?", default=cores)
Expand Down
6 changes: 3 additions & 3 deletions apps/jumpserver/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('api/v1/', include(api_v1)),
re_path('api/(?P<app>\w+)/(?P<version>v\d)/.*', views.redirect_format_api),
path('api/health/', api.HealthCheckView.as_view(), name="health"),
path('api/v1/health/', api.HealthCheckView.as_view(), name="health_v1"),
# External apps url
path('core/auth/captcha/', include('captcha.urls')),
path('core/', include(app_view_patterns)),
path('ui/', views.UIView.as_view()),
]

# 静态文件处理路由
Expand All @@ -66,7 +64,9 @@
]
if settings.DEBUG:
urlpatterns += static('/luna/', document_root=(settings.DATA_DIR + '/luna'))
urlpatterns += static('/lina/', document_root=(settings.DATA_DIR + '/lina'))
urlpatterns += static('/ui/', document_root=(settings.DATA_DIR + '/lina'))
else:
urlpatterns += path('ui/', views.UIView.as_view()),

# js i18n 路由文件
urlpatterns += [
Expand Down
Loading

0 comments on commit 278548c

Please sign in to comment.