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

Receivers of inquiries get a 404 exception when trying to answer #230

Open
asattler opened this issue Jan 21, 2025 · 0 comments
Open

Receivers of inquiries get a 404 exception when trying to answer #230

asattler opened this issue Jan 21, 2025 · 0 comments
Assignees

Comments

@asattler
Copy link

asattler commented Jan 21, 2025

Hi guys,

people on which receive an inquiry for a request get an exception when they try to open the ApprovalSidesheetComponent.

Reason is that the user has no permission to get the PortalItshopApprovalRequestsInteractive-Entity.

In more detail: The WorkflowSingleActionComponent is calling getExtendedEntity which is loading the interactive object of the PortalItshopApprovalRequests.
The user receives a 404 from the ApiServer as the WhereClause doesn't enable him to get the interactive entity.
workflow-single-action.component.ts line 124:
const entityWrapper = await this.approvalService.getExtendedEntity(this.request.key);

=>

approvals.service.ts line 192:
await this.apiService.typedClient.PortalItshopApproveRequestsInteractive.Get_byid(entityReference)

If you check how the inquiries are shown, you will notice that the InquiriesComponent is loading the data with setting the parameter forinquiry to true which modifies the whereclause on the apiserver:
inquiries.component.ts line 130:
this.navigationState.forinquiry = true;

As the PortalItshopApprovalRequestsInteractiveWrapper.Get_byid doesn't allow to provide the parameter forinquiry (which is equal to all Get_bid-methods), it seems there is no easy fix.

I'm talking about v92-branch, but didn't check if the same applies to v93.
Would appreciate a reliable workaround until you fix it :)

BR

Andreas

UPDATE:
My Workaround is to modify the API-Endpoint like this:

builder.ModifyQueryMethod("itshop/approve/requests", method =>
{
    method.WhereClauseProviders.Add(new WhereClauseProvider((qr, originalWhereClause) =>
    {
// based on debugging the parameter UID_PersonWantsOrg is filled when the GetById is called
        string UID_PersonWantsOrg = qr.Parameters.Get<string>("UID_PersonWantsOrg");
        if (string.IsNullOrEmpty(UID_PersonWantsOrg))
        {
            return originalWhereClause;
        }
        string inquiryWhereClause = f.AndRelation(
            f.Comparison("RulerLevel", 2, ValType.Int, CompareOperator.NotEqual),
            f.UidComparison("UID_PersonWantsOrg", UID_PersonWantsOrg),
            string.Format("UID_PersonWantsOrg in(select uid_personwantsorg from QER_VITshopDecisionPerson where {0})", 
                f.AndRelation(
                    f.Comparison("DecisionOrComment", "C", ValType.String, CompareOperator.Equal), 
                    f.UidComparison("UID_Person", qr.Session.User().Uid)
                    )
            )
        );
        string newWhereClause = string.Format("UID_PersonWantsOrg in (select UID_PersonWantsOrg from PWOHelperPWO where {0}" +
            " union all " +
            "select UID_PersonWantsOrg from PWOHelperPWO where {1})", originalWhereClause, inquiryWhereClause);
        return newWhereClause;
 
    }));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants