Skip to content

Commit ba1e574

Browse files
authored
Merge pull request #47 from KelvinTegelaar/master
[pull] master from KelvinTegelaar:master
2 parents f07299d + 6b50f40 commit ba1e574

23 files changed

+177
-307
lines changed

.github/workflows/dev_api.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -25,67 +25,6 @@ jobs:
2525
uses: actions/checkout@v4
2626
with:
2727
persist-credentials: false
28-
29-
- name: Setup PowerShell module cache
30-
id: cacher
31-
uses: actions/cache@v3
32-
with:
33-
path: "~/.local/share/powershell/Modules"
34-
key: ${{ runner.os }}-ModuleBuilder
35-
36-
- name: Install ModuleBuilder
37-
if: steps.cacher.outputs.cache-hit != 'true'
38-
shell: pwsh
39-
run: |
40-
Set-PSRepository PSGallery -InstallationPolicy Trusted
41-
Install-Module ModuleBuilder -AllowClobber -Force
42-
43-
- name: Build CIPPCore Module
44-
shell: pwsh
45-
run: |
46-
$ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CIPPCore"
47-
$OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output"
48-
49-
Write-Host "Building module from: $ModulePath"
50-
Write-Host "Output directory: $OutputPath"
51-
52-
# Generate function permissions before replacing the source module
53-
$ToolsPath = Join-Path $env:GITHUB_WORKSPACE "Tools"
54-
$ScriptPath = Join-Path $ToolsPath "Build-FunctionPermissions.ps1"
55-
pwsh -File $ScriptPath -ModulePath $ModulePath
56-
57-
# Build the module using ModuleBuilder
58-
Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose
59-
60-
# Replace the source module with the built module
61-
Remove-Item -Path $ModulePath -Recurse -Force
62-
Copy-Item -Path (Join-Path $OutputPath "CIPPCore") -Destination $ModulePath -Recurse -Force
63-
64-
Write-Host "Module built and replaced successfully"
65-
66-
# Clean up output directory
67-
Remove-Item -Path $OutputPath -Recurse -Force
68-
69-
- name: Build CippExtensions Module
70-
shell: pwsh
71-
run: |
72-
$ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CippExtensions"
73-
$OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output"
74-
75-
Write-Host "Building module from: $ModulePath"
76-
Write-Host "Output directory: $OutputPath"
77-
78-
# Build the module using ModuleBuilder
79-
Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose
80-
81-
# Replace the source module with the built module
82-
Remove-Item -Path $ModulePath -Recurse -Force
83-
Copy-Item -Path (Join-Path $OutputPath "CippExtensions") -Destination $ModulePath -Recurse -Force
84-
85-
Write-Host "Module built and replaced successfully"
86-
87-
# Clean up output directory
88-
Remove-Item -Path $OutputPath -Recurse -Force
8928

9029
- name: Login to Azure
9130
uses: azure/login@v2

.github/workflows/publish_release.yml

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -70,68 +70,6 @@ jobs:
7070
env:
7171
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7272

73-
- name: Setup PowerShell module cache
74-
id: cacher
75-
uses: actions/cache@v3
76-
with:
77-
path: "~/.local/share/powershell/Modules"
78-
key: ${{ runner.os }}-ModuleBuilder
79-
80-
- name: Install ModuleBuilder
81-
if: steps.cacher.outputs.cache-hit != 'true'
82-
shell: pwsh
83-
run: |
84-
Set-PSRepository PSGallery -InstallationPolicy Trusted
85-
Install-Module ModuleBuilder -AllowClobber -Force
86-
87-
- name: Build CIPPCore Module
88-
shell: pwsh
89-
run: |
90-
$ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CIPPCore"
91-
$OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output"
92-
93-
Write-Host "Building module from: $ModulePath"
94-
Write-Host "Output directory: $OutputPath"
95-
96-
# Generate function permissions before replacing the source module
97-
$ToolsPath = Join-Path $env:GITHUB_WORKSPACE "Tools"
98-
$ScriptPath = Join-Path $ToolsPath "Build-FunctionPermissions.ps1"
99-
pwsh -File $ScriptPath -ModulePath $ModulePath
100-
101-
# Build the module using ModuleBuilder
102-
Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose
103-
104-
# Replace the source module with the built module
105-
Remove-Item -Path $ModulePath -Recurse -Force
106-
Copy-Item -Path (Join-Path $OutputPath "CIPPCore") -Destination $ModulePath -Recurse -Force
107-
108-
Write-Host "Module built and replaced successfully"
109-
110-
# Clean up output directory
111-
Remove-Item -Path $OutputPath -Recurse -Force
112-
113-
- name: Build CippExtensions Module
114-
shell: pwsh
115-
run: |
116-
$ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CippExtensions"
117-
$OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output"
118-
119-
Write-Host "Building module from: $ModulePath"
120-
Write-Host "Output directory: $OutputPath"
121-
122-
# Build the module using ModuleBuilder
123-
Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose
124-
125-
# Replace the source module with the built module
126-
Remove-Item -Path $ModulePath -Recurse -Force
127-
Copy-Item -Path (Join-Path $OutputPath "CippExtensions") -Destination $ModulePath -Recurse -Force
128-
129-
Write-Host "Module built and replaced successfully"
130-
131-
# Clean up output directory
132-
Remove-Item -Path $OutputPath -Recurse -Force
133-
134-
13573
# Create ZIP File in a New Source Directory
13674
- name: Prepare and Zip Release Files
13775
if: env.tag_exists == 'false'

.github/workflows/upload_dev.yml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -17,66 +17,6 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
persist-credentials: false
20-
- name: Setup PowerShell module cache
21-
id: cacher
22-
uses: actions/cache@v3
23-
with:
24-
path: "~/.local/share/powershell/Modules"
25-
key: ${{ runner.os }}-ModuleBuilder
26-
27-
- name: Install ModuleBuilder
28-
if: steps.cacher.outputs.cache-hit != 'true'
29-
shell: pwsh
30-
run: |
31-
Set-PSRepository PSGallery -InstallationPolicy Trusted
32-
Install-Module ModuleBuilder -AllowClobber -Force
33-
34-
- name: Build CIPPCore Module
35-
shell: pwsh
36-
run: |
37-
$ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CIPPCore"
38-
$OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output"
39-
40-
Write-Host "Building module from: $ModulePath"
41-
Write-Host "Output directory: $OutputPath"
42-
43-
# Generate function permissions before replacing the source module
44-
$ToolsPath = Join-Path $env:GITHUB_WORKSPACE "Tools"
45-
$ScriptPath = Join-Path $ToolsPath "Build-FunctionPermissions.ps1"
46-
pwsh -File $ScriptPath -ModulePath $ModulePath
47-
48-
# Build the module using ModuleBuilder
49-
Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose
50-
51-
# Replace the source module with the built module
52-
Remove-Item -Path $ModulePath -Recurse -Force
53-
Copy-Item -Path (Join-Path $OutputPath "CIPPCore") -Destination $ModulePath -Recurse -Force
54-
55-
Write-Host "Module built and replaced successfully"
56-
57-
# Clean up output directory
58-
Remove-Item -Path $OutputPath -Recurse -Force
59-
60-
- name: Build CippExtensions Module
61-
shell: pwsh
62-
run: |
63-
$ModulePath = Join-Path $env:GITHUB_WORKSPACE "Modules/CippExtensions"
64-
$OutputPath = Join-Path $env:GITHUB_WORKSPACE "Output"
65-
66-
Write-Host "Building module from: $ModulePath"
67-
Write-Host "Output directory: $OutputPath"
68-
69-
# Build the module using ModuleBuilder
70-
Build-Module -SourcePath $ModulePath -OutputDirectory $OutputPath -Verbose
71-
72-
# Replace the source module with the built module
73-
Remove-Item -Path $ModulePath -Recurse -Force
74-
Copy-Item -Path (Join-Path $OutputPath "CippExtensions") -Destination $ModulePath -Recurse -Force
75-
76-
Write-Host "Module built and replaced successfully"
77-
78-
# Clean up output directory
79-
Remove-Item -Path $OutputPath -Recurse -Force
8020

8121
# Create ZIP File in a New Source Directory
8222
- name: Prepare and Zip Release Files

Config/schemaDefinitions.json

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,46 @@
22
{
33
"id": "cippUser",
44
"description": "CIPP User Schema",
5-
"targetTypes": ["User"],
5+
"targetTypes": [
6+
"User"
7+
],
68
"properties": [
7-
{ "name": "jitAdminEnabled", "type": "Boolean" },
8-
{ "name": "jitAdminExpiration", "type": "DateTime" },
9-
{ "name": "jitAdminReason", "type": "String" },
10-
{ "name": "mailboxType", "type": "String" },
11-
{ "name": "archiveEnabled", "type": "Boolean" },
12-
{ "name": "autoExpandingArchiveEnabled", "type": "Boolean" },
13-
{ "name": "perUserMfaState", "type": "String" }
9+
{
10+
"name": "jitAdminEnabled",
11+
"type": "Boolean"
12+
},
13+
{
14+
"name": "jitAdminExpiration",
15+
"type": "DateTime"
16+
},
17+
{
18+
"name": "jitAdminReason",
19+
"type": "String"
20+
},
21+
{
22+
"name": "jitAdminStartDate",
23+
"type": "DateTime"
24+
},
25+
{
26+
"name": "jitAdminCreatedBy",
27+
"type": "String"
28+
},
29+
{
30+
"name": "mailboxType",
31+
"type": "String"
32+
},
33+
{
34+
"name": "archiveEnabled",
35+
"type": "Boolean"
36+
},
37+
{
38+
"name": "autoExpandingArchiveEnabled",
39+
"type": "Boolean"
40+
},
41+
{
42+
"name": "perUserMfaState",
43+
"type": "String"
44+
}
1445
],
1546
"status": "Available"
1647
}

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertGlobalAdminAllowList.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function Get-CIPPAlertGlobalAdminAllowList {
4646
$UpnPrefix = ($admin.userPrincipalName -split '@')[0].ToLowerInvariant()
4747
if ($AllowedLookup -notcontains $UpnPrefix) {
4848
[PSCustomObject]@{
49-
Admin = $admin
50-
UpnPrefix = $UpnPrefix
49+
Admin = $admin
50+
UpnPrefix = $UpnPrefix
5151
}
5252
}
5353
}
@@ -69,10 +69,10 @@ function Get-CIPPAlertGlobalAdminAllowList {
6969
} else {
7070
$NonCompliantUpns = @($UnapprovedAdmins.Admin.userPrincipalName)
7171
$AlertData = @([PSCustomObject]@{
72-
Message = "Found $($NonCompliantUpns.Count) Global Administrator account(s) not in the approved allow list."
73-
NonCompliantUsers = $NonCompliantUpns
74-
ApprovedPrefixes = if ($AllowedAdmins) { $AllowedAdmins -join ', ' } else { 'Not provided' }
75-
Tenant = $TenantFilter
72+
Message = "Found $($NonCompliantUpns.Count) Global Administrator account(s) not in the approved allow list."
73+
NonCompliantUsers = $NonCompliantUpns -join ', '
74+
ApprovedPrefixes = if ($AllowedAdmins) { $AllowedAdmins -join ', ' } else { 'Not provided' }
75+
Tenant = $TenantFilter
7676
})
7777
}
7878

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertMXRecordChanged.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ function Get-CIPPAlertMXRecordChanged {
3030
# Update cache with current data
3131
foreach ($Domain in $DomainData) {
3232
$CacheEntity = @{
33-
PartitionKey = $TenantFilter
34-
RowKey = $Domain.Domain
35-
Domain = $Domain.Domain
36-
ActualMXRecords = $Domain.ActualMXRecords
37-
LastRefresh = $Domain.LastRefresh
38-
MailProvider = $Domain.MailProvider
33+
PartitionKey = [string]$TenantFilter
34+
RowKey = [string]$Domain.Domain
35+
Domain = [string]$Domain.Domain
36+
ActualMXRecords = [string]$Domain.ActualMXRecords
37+
LastRefresh = [string]$Domain.LastRefresh
38+
MailProvider = [string]$Domain.MailProvider
3939
}
4040
Add-CIPPAzDataTableEntity @CacheTable -Entity $CacheEntity -Force
4141
}

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertRestrictedUsers.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
3838
}
3939
} catch {
40-
Write-AlertMessage -tenant $($TenantFilter) -message "Could not get restricted users for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)"
40+
Write-LogMessage -tenant $($TenantFilter) -message "Could not get restricted users for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)" -severity 'Error' -API 'Get-CIPPAlertRestrictedUsers' -LogData (Get-CippException -Exception $_)
4141
}
4242
}

Modules/CIPPCore/Public/Authentication/Get-CippAllowedPermissions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function Get-CippAllowedPermissions {
3232
$AllPermissionCacheTable = Get-CIPPTable -tablename 'cachehttppermissions'
3333
$AllPermissionsRow = Get-CIPPAzDataTableEntity @AllPermissionCacheTable -Filter "PartitionKey eq 'HttpFunctions' and RowKey eq 'HttpFunctions' and Version eq '$($Version)'"
3434

35-
if (-not $AllPermissionsRow) {
35+
if (-not $AllPermissionsRow.Permissions) {
3636
$AllPermissions = Get-CIPPHttpFunctions -ByRole | Select-Object -ExpandProperty Permission
3737
$Entity = @{
3838
PartitionKey = 'HttpFunctions'

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ExecCAServiceExclusion.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Function Invoke-ExecCAServiceExclusion {
1+
function Invoke-ExecCAServiceExclusion {
22
<#
33
.FUNCTIONALITY
44
Entrypoint
@@ -17,15 +17,15 @@ Function Invoke-ExecCAServiceExclusion {
1717
try {
1818
$result = Set-CIPPCAPolicyServiceException -TenantFilter $TenantFilter -PolicyId $ID
1919
$Body = @{ Results = $result }
20-
Write-LogMessage -headers $Headers -API 'Set-CIPPCAPolicyServiceException' -message $Message -Sev 'Info' -tenant $TenantFilter
20+
Write-LogMessage -headers $Headers -API 'Set-CIPPCAPolicyServiceException' -message $result -Sev 'Info' -tenant $TenantFilter
2121
} catch {
2222
$ErrorMessage = Get-CippException -Exception $_
2323
$Body = @{ Results = "Failed to add service provider exception to policy $($ID): $($ErrorMessage.NormalizedError)" }
2424
Write-LogMessage -headers $Headers -API 'Set-CIPPCAPolicyServiceException' -message "Failed to update policy $($PolicyId) with service provider exception for tenant $($CSPtenantId): $($_.Exception.Message)" -Sev 'Error' -tenant $TenantFilter -LogData (Get-CippException -Exception $_)
2525
}
2626

2727
return ([HttpResponseContext]@{
28-
StatusCode = [HttpStatusCode]::OK
29-
Body = $Body
30-
})
28+
StatusCode = [HttpStatusCode]::OK
29+
Body = $Body
30+
})
3131
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/GDAP/Invoke-ListGDAPAccessAssignments.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ function Invoke-ListGDAPAccessAssignments {
22
<#
33
.FUNCTIONALITY
44
Entrypoint,AnyTenant
5+
.ROLE
6+
Tenant.Relationship.Read
57
#>
68
[CmdletBinding()]
79
param($Request, $TriggerMetadata)

0 commit comments

Comments
 (0)