Skip to content

Clarify Expense Agent Entra app permission checks - #11997

Open
encimita wants to merge 2 commits into
mainfrom
private/encimita/allow-expense-agent-admin-activation
Open

encimita wants to merge 2 commits into
mainfrom
private/encimita/allow-expense-agent-admin-activation

Conversation

@encimita

@encimita encimita commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reorder the Expense Agent Entra application authorization checks to follow the setup flow.
  • Document why non-SUPER users currently require SECURITY, the Expense Agent runtime permission, and Agent - Admin in addition to Expense Mgmt. Admin.
  • Preserve the existing SUPER bypass and authorization behavior.

Authorization model

The effective rule remains:

SUPER or (Expense Mgmt. Admin and SECURITY and Expense Agent and Agent - Admin and Configure All Agents)

This branch does not implement the reduced permission model requested by AB#649970.

Validation

  • Expense Agent app builds successfully with code analysis enabled.
  • The changed file reports no AL diagnostics.
  • git diff --check passes.

Related to AB#649970

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@encimita
encimita requested a review from a team as a code owner September 28, 2026 13:51
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area labels Sep 28, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Sep 28, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

This change lets delegated Expense Agent administrators activate and deactivate the fixed Entra application without unrelated SECURITY or Expense Agent runtime permissions.

The remaining checks require effective Configure All Agents permission and Expense Mgmt. Admin. The internal privileged codeunit is limited to the fixed Expense Agent application, its runtime permission set, and the current company, so the change fixes the reported authorization failure without granting general application-management access.

Problem-solution fit

Fit: Strong

The removed checks are the direct cause of the reported failure. The remaining authorization checks match the administrative capability required by the scenario and also support equivalent custom permission sets.

Suggestions

None.

Risk assessment and necessity

Risk: This changes authorization on a privileged application lifecycle path. The risk is contained because callers still need two relevant administrative permissions, the codeunit is internal, and its inherent permissions operate only on the fixed Expense Agent application and current-company runtime grant. The standard Agent - Admin permission set and the existing setup flow use the same effective Configure All Agents permission model. No event publisher or external BaseApp dependency is involved.

Necessity: The change is needed because the removed SECURITY and runtime-role requirements grant unrelated capabilities and prevent the intended delegated administrator from completing setup. The scope is narrow and directly addresses that failure.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11997 round=1 by=alexei-dobriansky at=2026-09-28T19:10:06Z lastSha=92cbfeb2a53d6b17b1773df8482dfdb99996d8ab reviewKey=56e72b7b3930d91f3a3c7d7debf3ca3b30ae134b4cb0c5ed0ef9a0e3e0e4959a suggestions=

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@encimita encimita changed the title Allow admins to activate the Expense Agent Entra app Clarify Expense Agent Entra app permission checks Sep 29, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Request Changes

What this PR does

The latest change restores the SECURITY and Expense Agent checks that were removed in round 1, and reorders all non-SUPER checks to follow the setup flow.

This keeps authorization behavior effectively unchanged from the base branch. A user with only Agent - Admin and Expense Mgmt. Admin still cannot activate or deactivate the fixed Entra application, so the reported scenario remains unresolved.

Status of previous suggestions

No previous suggestions.

New observations (commits since round 1)

S1 (🔴 High): Implement the delegated administrator path
The restored SECURITY and Expense Agent checks still block the intended administrator. Move the fixed app and current-company permission updates behind a narrowly scoped privileged facade, and cover the restricted-user path with a regression test.

Risk assessment and necessity

Risk: This code controls a privileged Entra application and its Access Control records. The current version avoids widening access, but it still denies the supported setup flow; the reorder only changes which missing-permission error appears first.

Necessity: The permission-model fix is needed because the intended administrator cannot complete setup without unrelated broad rights. The implementation should stay limited to the fixed client ID, app ID, role ID, and current company.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11997 round=2 by=alexei-dobriansky at=2026-09-29T14:36:44.7593913Z lastSha=bd1b140418ea5fe44b0ea89e6c6b6d910cf4345e reviewKey=46a27eec118aaffe2c9372d0c5578264a51ed28cb44662bab5595ea26d9bb3a4 suggestions=S1@3db828d5:new parentRound=1

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@encimita encimita closed this Oct 8, 2026
@encimita encimita reopened this Oct 8, 2026
@encimita
encimita enabled auto-merge October 8, 2026 11:27
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@encimita encimita closed this Oct 13, 2026
auto-merge was automatically disabled October 13, 2026 14:07

Pull request was closed

@encimita encimita reopened this Oct 13, 2026
@encimita
encimita enabled auto-merge October 16, 2026 12:24
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

This branch was successfully deployed

1 active deployment
triage — bd1b1404 Deployed Oct 13, 2026 by encimita via Classify team ownership #7661
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants