We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e31162 commit a43d01aCopy full SHA for a43d01a
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCustomRole.ps1
@@ -70,6 +70,16 @@ function Invoke-ExecCustomRole {
70
if (!$ExistingRole) {
71
throw "Role $($Request.Body.RoleName) not found"
72
}
73
+
74
+ if ($ExistingRole.RowKey -eq $Request.Body.NewRoleName.ToLower()) {
75
+ throw "New role name cannot be the same as the existing role name"
76
+ }
77
78
+ $NewRoleTest = Get-CIPPAzDataTableEntity @Table -Filter "RowKey eq '$($Request.Body.NewRoleName.ToLower())'"
79
+ if ($NewRoleTest) {
80
+ throw "Role name $($Request.Body.NewRoleName) already exists"
81
82
83
$NewRole = @{
84
'PartitionKey' = 'CustomRoles'
85
'RowKey' = "$($Request.Body.NewRoleName.ToLower())"
0 commit comments