mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Fix for #77 and add activated as parameter
This commit is contained in:
parent
6828244dfa
commit
d3fb9762ab
1 changed files with 14 additions and 20 deletions
|
|
@ -68,11 +68,11 @@ function New-User() {
|
||||||
[string]$lastName,
|
[string]$lastName,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$userName,
|
[string]$username,
|
||||||
|
|
||||||
[string]$password,
|
[string]$password,
|
||||||
|
|
||||||
[string]$jobTitle,
|
[string]$jobtitle,
|
||||||
|
|
||||||
[string]$email,
|
[string]$email,
|
||||||
|
|
||||||
|
|
@ -90,33 +90,27 @@ function New-User() {
|
||||||
|
|
||||||
[bool]$ldap_user = $false,
|
[bool]$ldap_user = $false,
|
||||||
|
|
||||||
|
[bool]$activated = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
$Values= @{}
|
||||||
$Values = @{
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
first_name = $firstName
|
if($Values.ContainsKey('firstname')) {
|
||||||
last_name = $lastName
|
$Values['first_name']=$Values['firstname']
|
||||||
username = $userName
|
$Values.Remove('firstname')
|
||||||
|
|
||||||
email = $email
|
|
||||||
phone = $phone
|
|
||||||
company_id = $company_id
|
|
||||||
location_id = $location_id
|
|
||||||
department_id = $department_id
|
|
||||||
manager_id = $manager_id
|
|
||||||
jobtitle = $jobTitle
|
|
||||||
employee_num = $employee_num
|
|
||||||
notes = "Imported using SnipeitPS Script"
|
|
||||||
activated = 1
|
|
||||||
}
|
}
|
||||||
|
if($Values.ContainsKey('lastname')) {
|
||||||
|
$Values['last_name']=$Values['lastname']
|
||||||
|
$Values.Remove('lastname')
|
||||||
|
}
|
||||||
|
|
||||||
if ($ldap_user -eq $false) {
|
if ($ldap_user -eq $false) {
|
||||||
$ldap = @{
|
$ldap = @{
|
||||||
password = $password
|
|
||||||
password_confirmation = $password
|
password_confirmation = $password
|
||||||
ldap_import = 0
|
ldap_import = 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue