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 (3)
......@@ -7,7 +7,7 @@
RootModule = 'IAMClient.psm1'
# Version number of this module.
ModuleVersion = '1.2.3'
ModuleVersion = '1.2.4'
# ID used to uniquely identify this module
GUID = '33ce3afe-9156-4f0e-bbc7-6d4fab3f2ad7'
......
......@@ -27,7 +27,7 @@ function Get-ETHMaillistMember {
[pscustomobject]@{
name = $Name;
objectClass = $objectClass;
distinguishedName = $membersCn;
distinguishedName = $member;
}
}
}
......
function Add-ETHUserMailAlias {
<#
.SYNOPSIS
Adds a new e-mail alias (proxyAddress) to a user's mailbox
.DESCRIPTION
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.
.PARAMETER Identity
The user to add the alias to
.PARAMETER Alias
The alias(es) to give to the user
.EXAMPLE
Add-ETHUserMailAlias -Identity aurels -Alias "aurels.new@ethz.ch","my_cool_email@micro.biol.ethz.ch"
#>
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = 1)]
[string]$Identity,
[Parameter(Position = 1, Mandatory = 1, ValueFromPipeline = 1)]
[string[]]$Alias
)
BEGIN {
# Check if client is initialized
$null = Test-IsIAMClientInitialized
$OriginalUser = Get-ETHUser -Identity $Identity -Service "Mailbox"
}
PROCESS {
foreach ($_alias in $AliasToCreate) {
if ($OriginalUser.proxyAdresses -contains "smtp:$_alias"){
# this alias already exists, nothing do to
continue
}
$OriginalUser.mail = $_alias
}
Invoke-IAMMethod -Url ""
}
Invoke-IAMMethod -Url "/usermgr/user/$Identity/service/$Service" -Method Put -Body $changedProperties -Credentials $script:IAMCreds
}
\ No newline at end of file
......@@ -17,6 +17,11 @@ function Set-ETHUser {
$sourceUser = Get-ETHUser -Identity $Identity
$changedProperties = Get-ObjectDiffs $sourceUser $User
if ($changedProperties.Count -eq 0){
# nothing to do
return $sourceUser
}
Invoke-IAMMethod -Url "/usermgr/user/$Identity/service/$Service" -Method Put -Body $changedProperties -Credentials $script:IAMCreds
......