To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

...
 
Commits (2)
......@@ -7,7 +7,7 @@
RootModule = 'IAMClient.psm1'
# Version number of this module.
ModuleVersion = '1.2.4'
ModuleVersion = '1.2.5'
# ID used to uniquely identify this module
GUID = '33ce3afe-9156-4f0e-bbc7-6d4fab3f2ad7'
......
......@@ -8,6 +8,8 @@ function Add-ETHUserMailAlias {
Adds a new e-mail alias (proxyAddress) to a user's mailbox, this works by changing the main
e-mail to the new alias and then back to the existing.
!! WARNING: The Cmdlet currently does not reset the main e-mail address again, because IAM does not work (bug as of 14.02.2020) !!
.PARAMETER Identity
The user to add the alias to
......@@ -23,6 +25,7 @@ function Add-ETHUserMailAlias {
param (
[Parameter(Position = 0, Mandatory = 1)]
[string]$Identity,
[Parameter(Position = 1, Mandatory = 1, ValueFromPipeline = 1)]
[string[]]$Alias
)
......@@ -32,23 +35,25 @@ function Add-ETHUserMailAlias {
# Check if client is initialized
$null = Test-IsIAMClientInitialized
$OriginalUser = Get-ETHUser -Identity $Identity -Service "Mailbox"
$User = Get-ETHUser -Identity $Identity
$SavedEmail = $User.mail
}
PROCESS {
foreach ($_alias in $AliasToCreate) {
if ($OriginalUser.proxyAdresses -contains "smtp:$_alias"){
foreach ($_alias in $Alias) {
if ($User.proxyAdresses -contains "smtp:$_alias"){
# this alias already exists, nothing do to
continue
}
$OriginalUser.mail = $_alias
}
$User.mail = $_alias
Invoke-IAMMethod -Url ""
$User = Set-ETHUser -Identity $Identity -User $User
}
}
Invoke-IAMMethod -Url "/usermgr/user/$Identity/service/$Service" -Method Put -Body $changedProperties -Credentials $script:IAMCreds
END {
$User.mail = $SavedEmail
Set-ETHUser -Identity $Identity -User $User
}
}
\ No newline at end of file