mirror of https://github.com/jumpserver/jumpserver
fix(orgs): 创建组织用户不必填 (#4515)
* fix(role): 更改role的顺序 * fix(tickets): 修复工单邮件跳转地址 * fix(tickets): 修复工单复制链接地址不对 * fix(orgs): 创建组织用户不必填 Co-authored-by: xinwen <coderWen@126.com>pull/4517/head
parent
0fd2f18240
commit
9cb5985947
|
@ -18,6 +18,7 @@ from django.views.generic.edit import FormView
|
|||
from django.conf import settings
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from common.const.front_urls import TICKET_DETAIL
|
||||
from common.utils import get_request_ip, get_object_or_none
|
||||
from users.utils import (
|
||||
redirect_user_first_login_or_index
|
||||
|
@ -185,7 +186,7 @@ class UserLoginWaitConfirmView(TemplateView):
|
|||
context = super().get_context_data(**kwargs)
|
||||
if ticket:
|
||||
timestamp_created = datetime.datetime.timestamp(ticket.date_created)
|
||||
ticket_detail_url = reverse('tickets:ticket-detail', kwargs={'pk': ticket_id})
|
||||
ticket_detail_url = TICKET_DETAIL.format(id=ticket_id)
|
||||
msg = _("""Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>
|
||||
Don't close this page""").format(ticket.assignees_display)
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
TICKET_DETAIL = '/ui/#/tickets/tickets/{id}'
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.13 on 2020-08-19 12:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('orgs', '0007_auto_20200728_1805'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='organizationmember',
|
||||
name='role',
|
||||
field=models.CharField(choices=[('Admin', 'Organization administrator'), ('Auditor', 'Organization auditor'), ('User', 'User')], default='User', max_length=16, verbose_name='Role'),
|
||||
),
|
||||
]
|
|
@ -13,8 +13,8 @@ from common.db.models import ChoiceSet
|
|||
|
||||
class ROLE(ChoiceSet):
|
||||
ADMIN = choices.ADMIN, _('Organization administrator')
|
||||
USER = choices.USER, _('User')
|
||||
AUDITOR = choices.AUDITOR, _("Organization auditor")
|
||||
USER = choices.USER, _('User')
|
||||
|
||||
|
||||
class Organization(models.Model):
|
||||
|
|
|
@ -10,9 +10,9 @@ from .models import Organization, OrganizationMember, ROLE as ORG_ROLE
|
|||
|
||||
|
||||
class OrgSerializer(ModelSerializer):
|
||||
users = serializers.PrimaryKeyRelatedField(many=True, queryset=User.objects.all(), write_only=True)
|
||||
admins = serializers.PrimaryKeyRelatedField(many=True, queryset=User.objects.all(), write_only=True)
|
||||
auditors = serializers.PrimaryKeyRelatedField(many=True, queryset=User.objects.all(), write_only=True)
|
||||
users = serializers.PrimaryKeyRelatedField(many=True, queryset=User.objects.all(), write_only=True, required=False)
|
||||
admins = serializers.PrimaryKeyRelatedField(many=True, queryset=User.objects.all(), write_only=True, required=False)
|
||||
auditors = serializers.PrimaryKeyRelatedField(many=True, queryset=User.objects.all(), write_only=True, required=False)
|
||||
|
||||
class Meta:
|
||||
model = Organization
|
||||
|
|
|
@ -4,6 +4,7 @@ from urllib.parse import urljoin
|
|||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from common.const.front_urls import TICKET_DETAIL
|
||||
from common.utils import get_logger
|
||||
from common.tasks import send_mail_async
|
||||
|
||||
|
@ -20,11 +21,7 @@ def send_new_ticket_mail_to_assignees(ticket: Ticket, assignees):
|
|||
subject = '{}: {}'.format(_("New ticket"), ticket.title)
|
||||
|
||||
# 这里要设置前端地址,因为要直接跳转到页面
|
||||
if ticket.type == ticket.TYPE.REQUEST_ASSET_PERM:
|
||||
detail_url = urljoin(settings.SITE_URL, f'/tickets/tickets/request-asset-perm/{ticket.id}')
|
||||
else:
|
||||
detail_url = urljoin(settings.SITE_URL, f'/tickets/tickets/{ticket.id}')
|
||||
|
||||
detail_url = urljoin(settings.SITE_URL, TICKET_DETAIL.format(id=ticket.id))
|
||||
message = _("""
|
||||
<div>
|
||||
<p>Your has a new ticket</p>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.13 on 2020-08-19 12:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0029_auto_20200814_1650'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='role',
|
||||
field=models.CharField(blank=True, choices=[('Admin', 'System administrator'), ('Auditor', 'System auditor'), ('User', 'User'), ('App', 'Application')], default='User', max_length=10, verbose_name='Role'),
|
||||
),
|
||||
]
|
|
@ -155,8 +155,8 @@ class AuthMixin:
|
|||
class RoleMixin:
|
||||
class ROLE(ChoiceSet):
|
||||
ADMIN = choices.ADMIN, _('System administrator')
|
||||
USER = choices.USER, _('User')
|
||||
AUDITOR = choices.AUDITOR, _('System auditor')
|
||||
USER = choices.USER, _('User')
|
||||
APP = 'App', _('Application')
|
||||
|
||||
role = ROLE.USER
|
||||
|
|
Loading…
Reference in New Issue