From 1d3240a972a63562bd9d9af3391788889e6a85d8 Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 14:01:22 +0200 Subject: [PATCH] added functions to make new project groups --- AddProjectACL.ps1 | 20 ++++++++++++++++++++ AddProjectRoles.ps1 | 20 ++++++++++++++++++++ NewProject.ps1 | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 AddProjectACL.ps1 create mode 100644 AddProjectRoles.ps1 create mode 100644 NewProject.ps1 diff --git a/AddProjectACL.ps1 b/AddProjectACL.ps1 new file mode 100644 index 0000000..b7723da --- /dev/null +++ b/AddProjectACL.ps1 @@ -0,0 +1,20 @@ +[CmdletBinding()] +param ( + [string] + $ProjectName, + [string] + $Server +) + +. .\Variables.ps1 + +$Read = 'ACL-'+$ProjectName+'-RO' +$Write = 'ACL-'+$ProjectName+'-RW' + +if($PSBoundParameters.ContainsKey("Server")){ + New-ADGroup -Path $ACL -Server $Server -Name $Read + New-ADGroup -Path $ACL -Server $Server -Name $Write +} else { + New-ADGroup -Path $ACL -Name $Read + New-ADGroup -Path $ACL -Name $Write +} diff --git a/AddProjectRoles.ps1 b/AddProjectRoles.ps1 new file mode 100644 index 0000000..6bc7417 --- /dev/null +++ b/AddProjectRoles.ps1 @@ -0,0 +1,20 @@ +[CmdletBinding()] +param ( + [string] + $ProjectName, + [string] + $Server +) + +. .\Variables.ps1 + +$Read = 'GR-'+$ProjectName+'-RO' +$Write = 'GR-'+$ProjectName+'-RW' + +if($PSBoundParameters.ContainsKey("Server")){ + New-ADGroup -Path $Roles -Server $Server -Name $Read + New-ADGroup -Path $Roles -Server $Server -Name $Write +} else { + New-ADGroup -Path $Roles -Name $Read + New-ADGroup -Path $Roles -Name $Write +} \ No newline at end of file diff --git a/NewProject.ps1 b/NewProject.ps1 new file mode 100644 index 0000000..055b2f0 --- /dev/null +++ b/NewProject.ps1 @@ -0,0 +1,20 @@ +[CmdletBinding()] +param ( + [string] + $ProjectName, + [string] + $Server +) + +. .\Variables.ps1 + +if($PSBoundParameters.ContainsKey("Server")){ + New-ADGroup -Path $Projects -Server $Server -Name $ProjectName + . .\AddProjectACL.ps1 -ProjectName $ProjectName -Server $Server + . .\AddProjectRoles.ps1 -ProjectName $ProjectName -Server $Server +} else { + + New-ADGroup -Path $Projects -Name $ProjectName + . .\AddProjectACL.ps1 -ProjectName $ProjectName + . .\AddProjectRoles.ps1 -ProjectName $ProjectName +} \ No newline at end of file