Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from KelvinTegelaar:main #22

Merged
merged 10 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
__*
__*
.next/*
60 changes: 18 additions & 42 deletions deployment/AzureDeploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
"metadata": {
"description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token"
}
},
"GithubAPIRepository": {
"defaultValue": "https://github.com/KelvinTegelaar/CIPP-API",
"type": "string",
"metadata": {
"description": "URL to your Github backend fork."
}
}
},
"variables": {
Expand Down Expand Up @@ -57,7 +50,7 @@
"objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]",
"permissions": {
"keys": [],
"secrets": ["all"],
"secrets": [ "all" ],
"certificates": []
}
}
Expand Down Expand Up @@ -116,7 +109,7 @@
]
}
],
"dependsOn": ["[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"]
"dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" ]
},
{
"apiVersion": "2015-08-01",
Expand All @@ -135,7 +128,7 @@
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]",
"siteConfig": {
"Use32BitWorkerProcess": false,
"powerShellVersion": "7.2",
"powerShellVersion": "7.4",
"appSettings": [
{
"name": "AzureWebJobsStorage",
Expand All @@ -154,45 +147,28 @@
"value": "~4"
},
{
"name": "ApplicationID",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationId)')]"
},
{
"name": "ApplicationSecret",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationSecret)')]"
},
{
"name": "RefreshToken",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/RefreshToken)')]"
},
{
"name": "TenantID",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/tenantid)')]"
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "powershell"
}
]
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": ["[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]"],
"properties": {
"RepoUrl": "[parameters('GithubAPIRepository')]",
"repositoryToken": "[parameters('GithubToken')]",
"token": "[parameters('GithubToken')]",

"branch": "master",
"publishRunbook": true,
"IsManualIntegration": true
}
}
]
}
},
{
"name": "[concat(variables('funcAppName'), '/ZipDeploy')]",
"type": "Microsoft.Web/sites/extensions",
"apiVersion": "2021-02-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"
],
"properties": {
"packageUri": "https://cippreleases.blob.core.windows.net/cipp-api/latest.zip"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
Expand Down
57 changes: 18 additions & 39 deletions deployment/AzureDeploymentTemplate_regionoptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
"metadata": {
"description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)"
}
},
"GithubAPIRepository": {
"defaultValue": "https://github.com/KelvinTegelaar/CIPP-API",
"type": "string",
"metadata": {
"description": "URL to your Github backend fork."
}
}
},
"variables": {
Expand Down Expand Up @@ -57,7 +50,7 @@
"objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]",
"permissions": {
"keys": [],
"secrets": ["all"],
"secrets": [ "all" ],
"certificates": []
}
}
Expand Down Expand Up @@ -116,7 +109,7 @@
]
}
],
"dependsOn": ["[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"]
"dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" ]
},
{
"apiVersion": "2015-08-01",
Expand All @@ -135,7 +128,7 @@
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]",
"siteConfig": {
"Use32BitWorkerProcess": false,
"powerShellVersion": "7.2",
"powerShellVersion": "7.4",
"appSettings": [
{
"name": "AzureWebJobsStorage",
Expand All @@ -154,42 +147,28 @@
"value": "~4"
},
{
"name": "ApplicationID",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationId)')]"
},
{
"name": "ApplicationSecret",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationSecret)')]"
},
{
"name": "RefreshToken",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/RefreshToken)')]"
},
{
"name": "TenantID",
"value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/tenantid)')]"
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "powershell"
}
]
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": ["[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]"],
"properties": {
"RepoUrl": "[parameters('GithubAPIRepository')]",
"branch": "master",
"publishRunbook": true,
"IsManualIntegration": true
}
}
]
}
},
{
"name": "[concat(variables('funcAppName'), '/ZipDeploy')]",
"type": "Microsoft.Web/sites/extensions",
"apiVersion": "2021-02-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"
],
"properties": {
"packageUri": "https://cippreleases.blob.core.windows.net/cipp-api/latest.zip"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "6.4.0",
"version": "6.4.1",
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.4.1
29 changes: 20 additions & 9 deletions src/components/utilities/CippAppPermissionBuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const CippAppPermissionBuilder = ({
} = useGenericGetRequestQuery({
path: 'api/ExecServicePrincipals',
})

const [createServicePrincipal, createResult] = useLazyGenericGetRequestQuery()

const removeServicePrincipal = (appId) => {
Expand Down Expand Up @@ -407,9 +406,17 @@ const CippAppPermissionBuilder = ({
])

const ApiPermissionRow = ({ servicePrincipal = null }) => {
const {
data: servicePrincipalData = [],
isFetching: spFetching,
isSuccess: spIdSuccess,
} = useGenericGetRequestQuery({
path: 'api/ExecServicePrincipals?Id=' + servicePrincipal.id,
})

return (
<>
{spSuccess && servicePrincipal !== null && (
{spSuccess && servicePrincipal !== null && spIdSuccess && (
<CRow>
<CCol xl={12}>
<CRow>
Expand Down Expand Up @@ -457,7 +464,7 @@ const CippAppPermissionBuilder = ({
'.applicationPermissions'
}
label="Application Permissions"
values={servicePrincipal?.appRoles
values={servicePrincipalData?.Results?.appRoles
?.filter((role) => {
return newPermissions?.Permissions[
servicePrincipal.appId
Expand Down Expand Up @@ -524,8 +531,9 @@ const CippAppPermissionBuilder = ({
},
{
selector: (row) =>
servicePrincipal.appRoles.find((role) => role.id === row.id)
.description,
servicePrincipalData?.Results?.appRoles.find(
(role) => role.id === row.id,
).description,
name: 'Description',
cell: cellGenericFormatter({ wrap: true }),
maxWidth: '60%',
Expand Down Expand Up @@ -577,7 +585,7 @@ const CippAppPermissionBuilder = ({
</CRow>
<CRow>
<CCol xl={12}>
{servicePrincipal?.publishedPermissionScopes?.length == 0 && (
{servicePrincipalData?.Results?.publishedPermissionScopes?.length == 0 && (
<CCallout color="warning">
<FontAwesomeIcon icon="exclamation-triangle" className="me-2" />
No Published Delegated Permissions found.
Expand All @@ -594,8 +602,8 @@ const CippAppPermissionBuilder = ({
}
label="Delegated Permissions"
values={
servicePrincipal?.publishedPermissionScopes?.length > 0
? servicePrincipal?.publishedPermissionScopes
servicePrincipalData?.Results?.publishedPermissionScopes?.length > 0
? servicePrincipalData?.Results?.publishedPermissionScopes
.filter((scopes) => {
return newPermissions?.Permissions[
servicePrincipal.appId
Expand Down Expand Up @@ -664,7 +672,7 @@ const CippAppPermissionBuilder = ({
},
{
selector: (row) =>
servicePrincipal.publishedPermissionScopes.find(
servicePrincipalData?.Results?.publishedPermissionScopes.find(
(scope) => scope?.id === row?.id,
)?.userConsentDescription ?? 'No Description',
name: 'Description',
Expand Down Expand Up @@ -921,6 +929,9 @@ const CippAppPermissionBuilder = ({
Object.keys(
newPermissions?.MissingPermissions[perm],
).map((type) => {
if (!updatedPermissions.Permissions[perm][type]) {
updatedPermissions.Permissions[perm][type] = []
}
newPermissions?.MissingPermissions[perm][type].map(
(p) => {
updatedPermissions.Permissions[perm][type].push(p)
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.4.1
Loading