Skip to content

Commit d7c6230

Browse files
committed
fix: Return value for bultin repo indicating it can not be deleted
1 parent a96f209 commit d7c6230

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎CommunityRepos.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{
33
"Id": "1041442982",
4+
"BuiltIn": true,
45
"Name": "CISTemplates",
56
"Description": "CIPP CIS Templates",
67
"URL": "https://github.com/CyberDrain/CyberDrain-CIS-Templates",
@@ -19,6 +20,7 @@
1920
},
2021
{
2122
"Id": "930523724",
23+
"BuiltIn": true,
2224
"Name": "CIPP-Templates",
2325
"Description": "CIPP Community Templates",
2426
"URL": "https://github.com/CyberDrain/CIPP-Templates",
@@ -37,6 +39,7 @@
3739
},
3840
{
3941
"Id": "784230225",
42+
"BuiltIn": true,
4043
"Name": "ConditionalAccessBaseline",
4144
"Description": "",
4245
"URL": "https://github.com/j0eyv/ConditionalAccessBaseline",
@@ -55,6 +58,7 @@
5558
},
5659
{
5760
"Id": "493403016",
61+
"BuiltIn": true,
5862
"Name": "OpenIntuneBaseline",
5963
"Description": "Community-driven baseline to accelerate Intune adoption and learning.",
6064
"URL": "https://github.com/SkipToTheEndpoint/OpenIntuneBaseline",
@@ -73,6 +77,7 @@
7377
},
7478
{
7579
"Id": "863076113",
80+
"BuiltIn": true,
7681
"Name": "IntuneBaseLines",
7782
"Description": "In this repo, you will find Intune profiles in JSON format, which can be used in setting up your Modern Workplace. All policies were created in Microsoft Intune and exported to share with the community.",
7883
"URL": "https://github.com/IntuneAdmin/IntuneBaselines",

‎Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ListCommunityRepos.ps1‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ function Invoke-ListCommunityRepos {
2323
$Repos = Get-CIPPAzDataTableEntity @Table -Filter $Filter
2424

2525
if (!$Request.Query.WriteAccess) {
26-
$CIPPRoot = (Get-Item (Get-Module -Name CIPPCore).ModuleBase).Parent.Parent.FullName
27-
$CommunityRepos = Join-Path -Path $CIPPRoot -ChildPath 'CommunityRepos.json'
26+
$CommunityRepos = Join-Path $env:CIPPRootPath 'CommunityRepos.json'
2827
$DefaultCommunityRepos = [System.IO.File]::ReadAllText($CommunityRepos) | ConvertFrom-Json
2928

3029
$DefaultsMissing = $false
3130
foreach ($Repo in $DefaultCommunityRepos) {
32-
if ($Repos.Url -notcontains $Repo.Url) {
31+
if ($Repos.Url -notcontains $Repo.Url -or $Repos.Buitin -notcontains $Repo.BuiltIn) {
3332
$Entity = [PSCustomObject]@{
3433
PartitionKey = 'CommunityRepos'
3534
RowKey = $Repo.Id
35+
BuiltIn = $Repo.BuiltIn
3636
Name = $Repo.Name
3737
Description = $Repo.Description
3838
URL = $Repo.URL
@@ -44,7 +44,7 @@ function Invoke-ListCommunityRepos {
4444
UploadBranch = $Repo.DefaultBranch
4545
Permissions = [string]($Repo.RepoPermissions | ConvertTo-Json -ErrorAction SilentlyContinue -Compress)
4646
}
47-
Add-CIPPAzDataTableEntity @Table -Entity $Entity
47+
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
4848
$DefaultsMissing = $true
4949
}
5050
}
@@ -56,6 +56,7 @@ function Invoke-ListCommunityRepos {
5656
$Repos = $Repos | ForEach-Object {
5757
[pscustomobject]@{
5858
Id = $_.RowKey
59+
BuiltIn = $_.BuiltIn
5960
Name = $_.Name
6061
Description = $_.Description
6162
URL = $_.URL

0 commit comments

Comments
 (0)