Skip to content
This repository was archived by the owner on Jul 23, 2026. It is now read-only.

Support own tenant role access#6

Closed
Logan Cook (MWG-Logan) wants to merge 1 commit into
devfrom
mwg-logan-verbose-happiness
Closed

Support own tenant role access#6
Logan Cook (MWG-Logan) wants to merge 1 commit into
devfrom
mwg-logan-verbose-happiness

Conversation

@MWG-Logan

Copy link
Copy Markdown
Member

Summary

Adds centralized support for the Own Tenant custom-role allowance. Access is limited to the tenant whose default or initial domain matches the signed-in user's UPN.

Testing

Untested: no build or behavioral test suite was run.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 21, 2026 15:01
@github-actions

Copy link
Copy Markdown

This PR title does not follow the Conventional Commits format.

Expected format: type(scope)?: description

Allowed types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert

Examples:

  • feat: add SharePoint external user management
  • fix(auth): handle expired refresh tokens
  • docs: update self-hosting guide

Received: Support own tenant role access

🔒 This PR has been automatically closed. Please update the title to match the format above and reopen the PR.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for an Own Tenant allowance in custom roles, intended to scope access to the tenant whose default or initial domain matches the signed-in user’s UPN. This fits into the existing centralized RBAC enforcement performed by Test-CIPPAccess, and exposes the new allowance in the custom-role listing endpoint for UI configuration.

Changes:

  • Update custom role listing to surface an Own Tenant option in AllowedTenants.
  • Add “own tenant” resolution logic to Test-CIPPAccess and expand AllowedTenants entries accordingly.
  • Extend tenant resolution to also match initialDomainName in addition to defaultDomainName.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ListCustomRole.ps1 Adds UI-facing shaping for AllowedTenants to include an “Own Tenant” display entry.
Modules/CIPPCore/Public/Authentication/Test-CIPPAccess.ps1 Adds own-tenant ID resolution and enforces own-tenant scoping during allowed-tenant expansion and AllTenants handling.

Comment on lines 64 to +71
$AllowedTenants = $Role.AllowedTenants | ConvertFrom-Json -ErrorAction Stop | ForEach-Object {
if ($_ -is [PSCustomObject] -and $_.type -eq 'Group') {
if ($_ -eq 'OwnTenant') {
[PSCustomObject]@{
type = 'OwnTenant'
value = 'OwnTenant'
label = 'Own Tenant'
}
} elseif ($_ -is [PSCustomObject] -and $_.type -eq 'Group') {
Comment on lines +378 to 382
} elseif ($AllowedItem -eq 'OwnTenant') {
$OwnTenantIds
} else {
$AllowedItem
}
Comment on lines +471 to 475
} elseif ($AllowedItem -eq 'OwnTenant') {
$OwnTenantIds
} else {
$AllowedItem
}
Comment on lines +446 to +447
} elseif ($TenantFilter -eq 'AllTenants' -and $Role.AllowedTenants -contains 'OwnTenant' -and $Role.AllowedTenants -notcontains 'AllTenants') {
$TenantAllowed = $false
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants