Skip to content

Commit

Permalink
Merge pull request #28 from BNWEIN/Dev
Browse files Browse the repository at this point in the history
Update to 1.1.9
  • Loading branch information
BNWEIN authored Dec 3, 2024
2 parents c468516 + fa967d1 commit dced4ca
Show file tree
Hide file tree
Showing 11 changed files with 316 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CIPPAPIModule/CIPPAPIModule.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'CIPPAPIModule.psm1'

# Version number of this module.
ModuleVersion = '1.1.8'
ModuleVersion = '1.1.9'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
41 changes: 41 additions & 0 deletions CIPPAPIModule/public/CIPP/Settings/Get-CIPPExtensionMapping.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<#
.SYNOPSIS
Retrieves the extension mapping for a specified extension name.
.DESCRIPTION
The Get-CIPPExtensionMapping function calls an API endpoint to get the extension mapping for a given extension name.
The function supports the following extension names: "HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", and "HuduFields".
.PARAMETER ExtensionName
The name of the extension for which to retrieve the mapping. This parameter is mandatory and accepts the following values:
"HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", "HuduFields".
.EXAMPLE
PS C:\> Get-CIPPExtensionMapping -ExtensionName "HaloPSA"
This example retrieves the extension mapping for the "HaloPSA" extension.
.NOTES
This function uses the Invoke-CIPPRestMethod cmdlet to call the API endpoint.
#>
function Get-CIPPExtensionMapping {
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[ValidateSet(
"HaloPSA",
"NinjaOne",
"NinjaOneFields",
"Hudu",
"HuduFields")]
[string]$ExtensionName
)

Write-Verbose 'Getting Extension Mapping'

$endpoint = '/api/ExecExtensionMapping'
$params = @{
List = $ExtensionName
}

Invoke-CIPPRestMethod -Endpoint $endpoint -Params $params
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<#
.SYNOPSIS
Sets the extension mapping for HaloPSA in the CIPP system.
.DESCRIPTION
The Set-CIPPExtensionMappingHaloPSA function sets the extension mapping for HaloPSA by adding or updating the mapping for a specified tenant. It retrieves the current extension mappings, updates them with the provided Halo client information, and sends the updated mappings to the CIPP system via a REST API call.
.PARAMETER HaloClientID
The ID of the Halo client. This parameter is mandatory.
.PARAMETER HaloClientName
The name of the Halo client. This parameter is mandatory.
.PARAMETER TenantID
The ID of the tenant for which the extension mapping is being set. This parameter is mandatory.
.EXAMPLE
Set-CIPPExtensionMappingHaloPSA -HaloClientID "12345" -HaloClientName "ExampleClient" -TenantID "7174f39b-33c6-4226-a67b-67fc1f127ef5"
This example sets the extension mapping for the Halo client with ID "12345" and name "ExampleClient" for the tenant with ID "67890".
#>
function Set-CIPPExtensionMappingHaloPSA {
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$HaloClientID,
[Parameter(Mandatory = $true)]
[string]$HaloClientName,
[Parameter(Mandatory = $true)]
[string]$TenantID
)

Write-Verbose 'Setting Extension Mapping'

$endpoint = '/api/ExecExtensionMapping'
$params = @{
AddMapping = "HaloPSA"
}

$ExtensionMappings = Get-CIPPExtensionMapping -ExtensionName HaloPSA

# Convert the JSON string to a PowerShell object
$jsonObject = $ExtensionMappings.mappings

# Convert the PSCustomObject to a hashtable for modification
$jsonHashtable = @{}
$jsonObject.PSObject.Properties | ForEach-Object {
$jsonHashtable[$_.Name] = $_.Value
}

# Add the new key-value pair to the hashtable
$jsonHashtable[$TenantID] = @{
value = $HaloClientID
label = $HaloClientName
}

# Convert the updated hashtable back to JSON
$json = $jsonHashtable | ConvertTo-Json -Depth 10

$output = $json | ConvertFrom-Json

$Body = @{
mappings = $output
}

Invoke-CIPPRestMethod -Endpoint $endpoint -Params $params -Body $Body -Method Post
}
66 changes: 66 additions & 0 deletions CIPPAPIModule/public/Tenant/GDAP/Get-CIPPGDAPInvite.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<#
.SYNOPSIS
Creates a GDAP (Granular Delegated Admin Privileges) invite.
.DESCRIPTION
The Get-CIPPGDAPInvite function sends a request to create a GDAP invite using the specified GDAP roles.
You can either provide a custom set of roles using the `-GDAPRoles` parameter or include all existing roles by using the `-UseAllExistingRoles` switch.
.PARAMETER GDAPRoles
An array of GDAP roles to be included in the invite. Each role is represented as a hashtable with the following keys:
- `GroupName`: The name of the role group.
- `GroupId`: The unique identifier of the role group.
- `RoleName`: The name of the specific role.
- `roleDefinitionId`: The unique identifier for the role definition.
.PARAMETER UseAllExistingRoles
A switch parameter that, when specified, includes all existing roles in the GDAP invite. This is mutually exclusive with `-GDAPRoles`.
.EXAMPLE
PS C:\> Get-CIPPGDAPInvite -GDAPRoles @(@{GroupName="M365 GDAP Cloud Device Administrator";GroupId="fa03defa-27c4-4639-8e50-14cbb746a78d";RoleName="Cloud Device Administrator";roleDefinitionId="7698a772-787b-4ac8-901f-60d6b08affd2"},@{GroupName="M365 GDAP Intune Administrator";GroupId="3d1c917f-8d1e-4a1e-a61c-df3263a0d1bc";RoleName="Intune Administrator";roleDefinitionId="3a2c62db-5318-420d-8d74-23affee5d9d5"})
This example creates a GDAP invite with the roles "Cloud Device Administrator" and "Intune Administrator."
.EXAMPLE
PS C:\> Get-CIPPGDAPInvite -UseAllExistingRoles
This example creates a GDAP invite including all existing roles retrieved by the `Get-CIPPGDAPRoles` function.
.NOTES
- This function uses the `Invoke-CIPPRestMethod` cmdlet to send the request to the `/api/ExecGDAPInvite` endpoint.
- You must specify either `-GDAPRoles` or `-UseAllExistingRoles`, but not both.
- Ensure the GDAP roles are valid and correctly formatted before calling this function.
#>

function Get-CIPPGDAPInvite {
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)]
[array]$GDAPRoles,
[Parameter(Mandatory = $false)]
[switch]$UseAllExistingRoles
)

if ($GDAPRoles -and $UseAllExistingRoles) {
throw 'Cannot specify both GDAPRoles and UseAllExistingRoles'
}

if (-not $GDAPRoles -and -not $UseAllExistingRoles) {
throw 'Must specify either GDAPRoles or UseAllExistingRoles'
}

if ($UseAllExistingRoles) {
Write-Verbose 'Using all existing roles for GDAP Invite'
$GDAPRoles = Get-CIPPGDAPRoles
}

Write-Verbose 'Creating GDAP Invite'

$endpoint = '/api/ExecGDAPInvite'

$Body = @{
gdapRoles = $GDAPRoles
}

Invoke-CIPPRestMethod -Endpoint $endpoint -Body $Body
}
31 changes: 31 additions & 0 deletions CIPPAPIModule/public/Tenant/Standards/Remove-CIPPStandard.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<#
.SYNOPSIS
Removes standards for a specified customer domain.
.DESCRIPTION
The Remove-CIPPStandard function removes standards associated with a given customer domain by calling the appropriate API endpoint.
.PARAMETER CustomerDefaultDomain
The default domain of the customer for which the standards are to be removed. This parameter is mandatory.
.EXAMPLE
Remove-CIPPStandard -CustomerDefaultDomain "example.com"
This example removes the standards for the customer with the default domain "example.com".
.NOTES
This function uses the Invoke-CIPPRestMethod cmdlet to call the API endpoint.
#>
function Remove-CIPPStandard {
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$CustomerDefaultDomain
)

Write-Verbose "Removing standards for $CustomerTenantID"
$endpoint = '/api/RemoveStandard'
$params = @{
ID = $CustomerDefaultDomain
}
Invoke-CIPPRestMethod -Endpoint $endpoint -Params $params
}
23 changes: 15 additions & 8 deletions Docs/Add-CIPPRoomMailbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,39 @@
Adds a room mailbox to a specified tenant.

## DESCRIPTION
This function adds a room mailbox to a specified tenant by calling the CIPP API endpoint '/api/AddRoomMailbox'.
It requires the tenant ID, display name, domain, and username as mandatory parameters.
This function adds a room mailbox to a specified tenant by calling the CIPP API endpoint '/api/AddRoomMailbox'.
It requires the tenant ID, display name, domain, and username as mandatory parameters.
Optionally, the resource capacity can also be specified.

# PARAMETERS

## **-CustomerTenantID**
> ![Type](https://img.shields.io/badge/Type-String-Blue?) ![Mandatory](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?)
The ID of the customer tenant where the room mailbox will be added. Either TenantID or Default domain can be used to identify the tenant.

## **-DisplayName**
> ![Type](https://img.shields.io/badge/Type-String-Blue?) ![Mandatory](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?)
The display name for the room mailbox.

## **-Domain**
> ![Type](https://img.shields.io/badge/Type-String-Blue?) ![Mandatory](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?)
The domain for the room mailbox.

## **-Username**
> ![Type](https://img.shields.io/badge/Type-String-Blue?) ![Mandatory](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?)
The username for the room mailbox.

## **-ResourceCapacity**
> ![Type](https://img.shields.io/badge/Type-Int32-Blue?) ![Mandatory](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![DefaultValue](https://img.shields.io/badge/DefaultValue-0-Blue?color=5547a8) \
![Foo](https://img.shields.io/badge/Type-Int32-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-0-Blue?color=5547a8)
The resource capacity for the room mailbox. This parameter is optional.

---

#### EXAMPLE 1

```powershell
Add-CIPPRoomMailbox -CustomerTenantID "7e3effb6-6efe-42f2-b071-48ce318eaf95" -DisplayName "Conference Room 1" -Domain "example.com" -Username "confroom1" -ResourceCapacity 10
Add-CIPPRoomMailbox -CustomerTenantID "7e3effb6-6efe-42f2-b071-48ce318eaf95" `
-DisplayName "Conference Room 1" `
-Domain "example.com" `
-Username "confroom1" `
-ResourceCapacity 10
17 changes: 17 additions & 0 deletions Docs/Get-CIPPExtensionMapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Get-CIPPExtensionMapping
## SYNOPSIS
Retrieves the extension mapping for a specified extension name.
## DESCRIPTION
The Get-CIPPExtensionMapping function calls an API endpoint to get the extension mapping for a given extension name.
The function supports the following extension names: "HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", and "HuduFields".
# PARAMETERS

## **-ExtensionName**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The name of the extension for which to retrieve the mapping. This parameter is mandatory and accepts the following values: "HaloPSA", "NinjaOne", "NinjaOneFields", "Hudu", "HuduFields".

#### EXAMPLE 1
```powershell
PS C:\>Get-CIPPExtensionMapping -ExtensionName "HaloPSA"
```

29 changes: 29 additions & 0 deletions Docs/Get-CIPPGDAPInvite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Get-CIPPGDAPInvite
## SYNOPSIS
Creates a GDAP (Granular Delegated Admin Privileges) invite.
## DESCRIPTION
The Get-CIPPGDAPInvite function sends a request to create a GDAP invite using the specified GDAP roles.
You can either provide a custom set of roles using the `-GDAPRoles` parameter or include all existing roles by using the `-UseAllExistingRoles` switch.
# PARAMETERS

## **-GDAPRoles**
> ![Foo](https://img.shields.io/badge/Type-Array-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) \
An array of GDAP roles to be included in the invite. Each role is represented as a hashtable with the following keys: - `GroupName`: The name of the role group. - `GroupId`: The unique identifier of the role group. - `RoleName`: The name of the specific role. - `roleDefinitionId`: The unique identifier for the role definition.

## **-UseAllExistingRoles**
> ![Foo](https://img.shields.io/badge/Type-SwitchParameter-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-FALSE-Green?) ![Foo](https://img.shields.io/badge/DefaultValue-False-Blue?color=5547a8)\
A switch parameter that, when specified, includes all existing roles in the GDAP invite. This is mutually exclusive with `-GDAPRoles`.

#### EXAMPLE 1
```powershell
PS C:\>Get-CIPPGDAPInvite -GDAPRoles @(@{GroupName="M365 GDAP Cloud Device Administrator";GroupId="fa03defa-27c4-4639-8e50-14cbb746a78d";RoleName="Cloud Device Administrator";roleDefinitionId="7698a772-787b-4ac8-901f-60d6b08affd2"},@{GroupName="M365 GDAP Intune Administrator";GroupId="3d1c917f-8d1e-4a1e-a61c-df3263a0d1bc";RoleName="Intune Administrator";roleDefinitionId="3a2c62db-5318-420d-8d74-23affee5d9d5"})
This example creates a GDAP invite with the roles "Cloud Device Administrator" and "Intune Administrator."
```
#### EXAMPLE 2
```powershell
PS C:\>Get-CIPPGDAPInvite -UseAllExistingRoles
This example creates a GDAP invite including all existing roles retrieved by the `Get-CIPPGDAPRoles` function.
```

16 changes: 16 additions & 0 deletions Docs/Remove-CIPPStandard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Remove-CIPPStandard
## SYNOPSIS
Removes standards for a specified customer domain.
## DESCRIPTION
The Remove-CIPPStandard function removes standards associated with a given customer domain by calling the appropriate API endpoint.
# PARAMETERS

## **-CustomerDefaultDomain**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The default domain of the customer for which the standards are to be removed. This parameter is mandatory.

#### EXAMPLE 1
```powershell
PS > Remove-CIPPStandard -CustomerDefaultDomain "example.com"
```

24 changes: 24 additions & 0 deletions Docs/Set-CIPPExtensionMappingHaloPSA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Set-CIPPExtensionMappingHaloPSA
## SYNOPSIS
Sets the extension mapping for HaloPSA in the CIPP system.
## DESCRIPTION
The Set-CIPPExtensionMappingHaloPSA function sets the extension mapping for HaloPSA by adding or updating the mapping for a specified tenant. It retrieves the current extension mappings, updates them with the provided Halo client information, and sends the updated mappings to the CIPP system via a REST API call.
# PARAMETERS

## **-HaloClientID**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The ID of the Halo client. This parameter is mandatory.

## **-HaloClientName**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The name of the Halo client. This parameter is mandatory.

## **-TenantID**
> ![Foo](https://img.shields.io/badge/Type-String-Blue?) ![Foo](https://img.shields.io/badge/Mandatory-TRUE-Red?) \
The ID of the tenant for which the extension mapping is being set. This parameter is mandatory.

#### EXAMPLE 1
```powershell
PS > Set-CIPPExtensionMappingHaloPSA -HaloClientID "12345" -HaloClientName "ExampleClient" -TenantID "7174f39b-33c6-4226-a67b-67fc1f127ef5"
```

Loading

0 comments on commit dced4ca

Please sign in to comment.