mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-12-17 01:22:47 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95412d739a | ||
|
|
93b5876469 | ||
|
|
da02d1e456 | ||
|
|
5928b265b7 |
@@ -147,7 +147,7 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div style="line-height: 17px;margin-bottom: 20px;color: #999999;">
|
<div style="line-height: 17px;margin-bottom: 20px;color: #999999;">
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
<p class="help-block">
|
<p class="help-block red-fonts">
|
||||||
{% if form.non_field_errors %}
|
{% if form.non_field_errors %}
|
||||||
{{ form.non_field_errors.as_text }}
|
{{ form.non_field_errors.as_text }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -206,10 +206,12 @@ class Ticket(CommonModelMixin, OrgModelMixin):
|
|||||||
self.save()
|
self.save()
|
||||||
post_change_ticket_action.send(sender=self.__class__, ticket=self, action=action)
|
post_change_ticket_action.send(sender=self.__class__, ticket=self, action=action)
|
||||||
|
|
||||||
# ticket
|
def has_current_assignee(self, assignee):
|
||||||
def has_assignee(self, assignee):
|
|
||||||
return self.ticket_steps.filter(ticket_assignees__assignee=assignee, level=self.approval_step).exists()
|
return self.ticket_steps.filter(ticket_assignees__assignee=assignee, level=self.approval_step).exists()
|
||||||
|
|
||||||
|
def has_all_assignee(self, assignee):
|
||||||
|
return self.ticket_steps.filter(ticket_assignees__assignee=assignee).exists()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_user_related_tickets(cls, user):
|
def get_user_related_tickets(cls, user):
|
||||||
queries = Q(applicant=user) | Q(ticket_steps__ticket_assignees__assignee=user)
|
queries = Q(applicant=user) | Q(ticket_steps__ticket_assignees__assignee=user)
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ class IsApplicant(permissions.BasePermission):
|
|||||||
|
|
||||||
class IsAssignee(permissions.BasePermission):
|
class IsAssignee(permissions.BasePermission):
|
||||||
def has_permission(self, request, view):
|
def has_permission(self, request, view):
|
||||||
return view.ticket.has_assignee(request.user)
|
return view.ticket.has_all_assignee(request.user)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from rest_framework import permissions
|
|||||||
|
|
||||||
class IsAssignee(permissions.BasePermission):
|
class IsAssignee(permissions.BasePermission):
|
||||||
def has_object_permission(self, request, view, obj):
|
def has_object_permission(self, request, view, obj):
|
||||||
return obj.has_assignee(request.user)
|
return obj.has_current_assignee(request.user)
|
||||||
|
|
||||||
|
|
||||||
class IsApplicant(permissions.BasePermission):
|
class IsApplicant(permissions.BasePermission):
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ class MFAMixin:
|
|||||||
methods = []
|
methods = []
|
||||||
if self.otp_secret_key:
|
if self.otp_secret_key:
|
||||||
methods.append(MFAType.OTP)
|
methods.append(MFAType.OTP)
|
||||||
if self.phone:
|
if settings.XPACK_ENABLED and settings.SMS_ENABLED and self.phone:
|
||||||
methods.append(MFAType.SMS_CODE)
|
methods.append(MFAType.SMS_CODE)
|
||||||
return methods
|
return methods
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user