Skip to content

Commit b3f2201

Browse files
authored
Merge pull request #627 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents a096d20 + f3c5e3d commit b3f2201

File tree

7 files changed

+53
-24
lines changed

7 files changed

+53
-24
lines changed

.github/workflows/dev_api.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ jobs:
2626
with:
2727
persist-credentials: false
2828

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-
3629
- name: Login to Azure
3730
uses: azure/login@v2
3831
with:

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/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)

Modules/CIPPCore/Public/Entrypoints/Invoke-ListFunctionParameters.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Invoke-ListFunctionParameters {
3636
$Functions = Get-Command @CommandQuery | Where-Object { $_.Visibility -eq 'Public' }
3737
}
3838
$Results = foreach ($Function in $Functions) {
39-
if ($Function -In $TemporaryBlacklist) { continue }
39+
if ($Function -in $TemporaryBlacklist) { continue }
4040
$GetHelp = @{
4141
Name = $Function
4242
}
@@ -72,8 +72,8 @@ function Invoke-ListFunctionParameters {
7272
$StatusCode = [HttpStatusCode]::BadRequest
7373
}
7474
return [HttpResponseContext]@{
75-
StatusCode = $StatusCode
76-
Body = @($Results)
77-
}
75+
StatusCode = $StatusCode
76+
Body = @($Results)
77+
}
7878

7979
}

Modules/CIPPCore/Public/Set-CIPPUserJITAdmin.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function Set-CIPPUserJITAdmin {
7070
forceChangePasswordNextSignInWithMfa = $false
7171
password = $Password
7272
}
73-
$Schema.id = @{
73+
"$($Schema.id)" = @{
7474
jitAdminEnabled = $false
7575
jitAdminExpiration = $Expiration.ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
7676
jitAdminStartDate = if ($StartDate) { $StartDate.ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') } else { $null }
@@ -127,8 +127,11 @@ function Set-CIPPUserJITAdmin {
127127
New-GraphPOSTRequest -type PATCH -uri "https://graph.microsoft.com/beta/users/$($UserObj.id)" -tenantid $TenantFilter -body $Json | Out-Null
128128
} catch {}
129129
}
130+
$CreatedBy = if ($Headers) {
131+
([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Headers.'x-ms-client-principal')) | ConvertFrom-Json).userDetails
132+
} else { 'Unknown' }
130133

131-
Set-CIPPUserJITAdminProperties -TenantFilter $TenantFilter -UserId $UserObj.id -Enabled -Expiration $Expiration -StartDate $StartDate -Reason $Reason -CreatedBy (if ($Headers) { ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Headers.'x-ms-client-principal')) | ConvertFrom-Json).userDetails } else { 'Unknown' }) | Out-Null
134+
Set-CIPPUserJITAdminProperties -TenantFilter $TenantFilter -UserId $UserObj.id -Enabled -Expiration $Expiration -StartDate $StartDate -Reason $Reason -CreatedBy $CreatedBy | Out-Null
132135
$Message = "Added admin roles to user $($UserObj.displayName) ($($UserObj.userPrincipalName)). Reason: $Reason"
133136
$LogData = @{
134137
UserPrincipalName = $UserObj.userPrincipalName

Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ function Test-CIPPAuditLogRules {
209209
} else {
210210
# Use cached lookups
211211
$Users = ($Lookups | Where-Object { $_.RowKey -eq 'users' }).Data | ConvertFrom-Json
212-
$Groups = (($Lookups | Where-Object { $_.RowKey -eq 'groups' }).Data | ConvertFrom-Json) ?? @()
213-
$Devices = (($Lookups | Where-Object { $_.RowKey -eq 'devices' }).Data | ConvertFrom-Json) ?? @()
212+
$Groups = (($Lookups | Where-Object { $_.RowKey -eq 'groups' }).Data | ConvertFrom-Json -ErrorAction SilentlyContinue) ?? @()
213+
$Devices = (($Lookups | Where-Object { $_.RowKey -eq 'devices' }).Data | ConvertFrom-Json -ErrorAction SilentlyContinue) ?? @()
214214
$ServicePrincipals = ($Lookups | Where-Object { $_.RowKey -eq 'servicePrincipals' }).Data | ConvertFrom-Json
215215
Write-Information "Using cached directory lookups for tenant $TenantFilter"
216216
}

Tools/Build-FunctionPermissions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ foreach ($command in $commands | Sort-Object -Property Name | Select-Object -Uni
7070
$functionality = ''
7171
}
7272

73-
if ($role -or $functionality) {
73+
if ($role -and $functionality) {
7474
$permissions[$command.Name] = @{
7575
Role = $role
7676
Functionality = $functionality

0 commit comments

Comments
 (0)