Skip to content

Default approval system plug -in#

Features#

After the default approval system plug -in installation,Will be atApproval managementAdd below the menuDefault request processingpage,Used to handle approval requests assigned to the current approval system

Create approval action#

X7nDTH.png

X45oyq.png

Generate approval request#

X7nulV.png

Since the previous step has been configured for approval action for creating a life cycle configuration,So the request should return 403 X59seS.png

Check the approval request#

X5Pr5Q.png

X5PDUg.png

Process approval request#

X5nksH.png

X5nFQe.png

X5nPzD.png

Implementation#

  • existapprove_requests_pageAddDefault request processingpage
  • Default request processing Call on the page /approve_requests/{{request_id}}/pass/ Agree with approval request
  • Default request processing Call on the page /approve_requests/{{request_id}}/deny/ Reject approval request
  • accomplish pass_approve_request Abstract method Agree with approval request
  • accomplish deny_approve_request Abstract method Reject approval request
  • Since this plug -in does not need to send the approval request to a third party, there is no abstract method of covering Create_approve_request
  • See ARKID.core.extension.approve_system.ApproveSystemExtension

Abstract method implementation:#

Code#

extension_root.com_longgui_approve_system_arkid.ApproveSystemArkIDExtension (ApproveSystemExtension) #

Source code in extension_root/com_longgui_approve_system_arkid/__init__.py
class ApproveSystemArkIDExtension(ApproveSystemExtension):
    def load(self):
        super().load()
        self.register_api(
            f'/approve_requests/',
            'GET',
            self.list_tenant_approve_requests,
            response=List[ApproveRequestListItemOut],
            tenant_path=True,
        )
        self.register_approve_system_schema(
            ApproveSystemArkIDConfigSchema, 'approve_system_arkid'
        )
        self.register_front_pages([router_page, waiting_page, approved_page])
        self.register_front_routers(router, approve_manage_router)

    @operation(List[ApproveRequestListItemOut], roles=[TENANT_ADMIN, PLATFORM_ADMIN])
    @paginate(CustomPagination)
    def list_tenant_approve_requests(
        self, request, tenant_id: str, is_approved: str = ''
    ):
        package = 'com.longgui.approve.system.arkid'
        requests = ApproveRequest.valid_objects.filter(
            tenant=request.tenant, action__extension__package=package
        )
        if is_approved == 'true':
            requests = requests.exclude(status="wait")
        elif is_approved == 'false':
            requests = requests.filter(status="wait")
        return requests

    def create_approve_request(self, event, **kwargs):
        pass

    def pass_approve_request(self, request, approve_request):
        response = restore_approve_request(approve_request)
        logger.info(f'Restore approve request with result: {response}')

    def deny_approve_request(self, request, approve_request):
        pass

create_approve_request(self, event, **kwargs) #

抽象方法

Parameters:

Name Type Description Default
event arkid.core.event.Event

创建审批请求事件

required
Source code in extension_root/com_longgui_approve_system_arkid/__init__.py
def create_approve_request(self, event, **kwargs):
    pass

deny_approve_request(self, request, approve_request) #

抽象方法

Parameters:

Name Type Description Default
request django.http.HttpRequest

HTTP 请求

required
approve_request arkid.core.models.ApproveRequest

需要拒绝的审批请求

required
Source code in extension_root/com_longgui_approve_system_arkid/__init__.py
def deny_approve_request(self, request, approve_request):
    pass

load(self) #

抽象方法,插件加载的入口方法

Source code in extension_root/com_longgui_approve_system_arkid/__init__.py
def load(self):
    super().load()
    self.register_api(
        f'/approve_requests/',
        'GET',
        self.list_tenant_approve_requests,
        response=List[ApproveRequestListItemOut],
        tenant_path=True,
    )
    self.register_approve_system_schema(
        ApproveSystemArkIDConfigSchema, 'approve_system_arkid'
    )
    self.register_front_pages([router_page, waiting_page, approved_page])
    self.register_front_routers(router, approve_manage_router)

pass_approve_request(self, request, approve_request) #

抽象方法

Parameters:

Name Type Description Default
request django.http.HttpRequest

HTTP 请求

required
approve_request arkid.core.models.ApproveRequest

需要同意的审批请求

required
Source code in extension_root/com_longgui_approve_system_arkid/__init__.py
def pass_approve_request(self, request, approve_request):
    response = restore_approve_request(approve_request)
    logger.info(f'Restore approve request with result: {response}')

评论