Skip to content

Commit

Permalink
add app approvers check before create ticket (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
QSummerY authored Feb 7, 2023
1 parent cd677b1 commit 8e2729f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion helpdesk/models/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from helpdesk.libs.rest import DictSerializableClassMixin
from helpdesk.models.db.ticket import Ticket, TicketPhase
from helpdesk.config import AUTO_APPROVAL_TARGET_OBJECTS, PARAM_FILLUP, TICKET_CALLBACK_PARAMS
from helpdesk.views.api.schemas import ApproverType

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -102,7 +103,10 @@ async def run(self, provider, form, user):
ticket.annotate(policy=policy.name)
ticket.annotate(current_node=policy.init_node.get("name"))
ticket.annotate(approval_log=list())
ticket.annotate(approvers=await ticket.get_node_approvers(policy.init_node.get("name")))
approvers = await ticket.get_node_approvers(policy.init_node.get("name"))
if not approvers and policy.init_node.get("approver_type") == ApproverType.APP_OWNER:
return None, "Failed to get app approvers, please confirm that the app name is entered correctly"
ticket.annotate(approvers=approvers)

ret, msg = await ticket.pre_approve()
if not ret:
Expand Down

0 comments on commit 8e2729f

Please sign in to comment.