mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-25 06:42:49 +00:00
pref: 修改使用的消息内容 (#7061)
* perf: 再次优化通知 * pref: 修改使用的消息内容 * perf: 修复url地址 Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
@@ -6,7 +8,7 @@ from common.utils import reverse as js_reverse
|
||||
from notifications.notifications import UserMessage
|
||||
|
||||
|
||||
class PermedWillExpireUserMsg(UserMessage):
|
||||
class PermedAssetsWillExpireUserMsg(UserMessage):
|
||||
def __init__(self, user, assets):
|
||||
super().__init__(user)
|
||||
self.assets = assets
|
||||
@@ -114,12 +116,9 @@ class AppPermsWillExpireForOrgAdminMsg(UserMessage):
|
||||
|
||||
def get_items_with_url(self):
|
||||
items_with_url = []
|
||||
perm_detail_url = urljoin(settings.SITE_URL, '/ui/#/perms/app-permissions/{}')
|
||||
for perm in self.perms:
|
||||
url = js_reverse(
|
||||
'perms:application-permission-detail',
|
||||
kwargs={'pk': perm.id}, external=True,
|
||||
api_to_ui=True
|
||||
) + f'?oid={perm.org_id}'
|
||||
url = perm_detail_url.format(perm.id) + f'?oid={perm.org_id}'
|
||||
items_with_url.append([perm.name, url])
|
||||
return items_with_url
|
||||
|
||||
|
@@ -12,7 +12,7 @@ from common.utils import get_logger
|
||||
from common.utils.timezone import local_now, dt_formatter, dt_parser
|
||||
from ops.celery.decorator import register_as_period_task
|
||||
from perms.notifications import (
|
||||
PermedWillExpireUserMsg, AssetPermsWillExpireForOrgAdminMsg,
|
||||
PermedAssetsWillExpireUserMsg, AssetPermsWillExpireForOrgAdminMsg,
|
||||
PermedAppsWillExpireUserMsg, AppPermsWillExpireForOrgAdminMsg
|
||||
)
|
||||
from perms.models import AssetPermission, ApplicationPermission
|
||||
@@ -83,7 +83,7 @@ def check_asset_permission_will_expired():
|
||||
user_asset_mapper[u].update(assets)
|
||||
|
||||
for user, assets in user_asset_mapper.items():
|
||||
PermedWillExpireUserMsg(user, assets).publish_async()
|
||||
PermedAssetsWillExpireUserMsg(user, assets).publish_async()
|
||||
|
||||
for org, perms in org_perm_mapper.items():
|
||||
org_admins = org.admins.all()
|
||||
|
@@ -17,8 +17,5 @@
|
||||
|
||||
<br />
|
||||
<p>
|
||||
---<br />
|
||||
<small>
|
||||
{% trans 'If you have any question, please contact the administrator' %}
|
||||
</small>
|
||||
{% trans 'If you have any question, please contact the administrator' %}
|
||||
</p>
|
||||
|
Reference in New Issue
Block a user