Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add app approvers check before create ticket #143

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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