Skip to content

Commit

Permalink
Fixes for New-PasswordStateList -LinkToTemplate (#162)
Browse files Browse the repository at this point in the history
* Update New-PasswordStateList.ps1

Fixed -CopyPermissionsFromTemplateID so it no longer requires a value for  -Permission

* Update New-PasswordStateList.md

Updated to reflect fix to Template parameter set in the function
  • Loading branch information
miked1313 authored Jan 19, 2024
1 parent bf84299 commit 235d1f5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
41 changes: 34 additions & 7 deletions docs/New-PasswordStateList.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ New-PasswordStateList [-Name] <String> [-Description] <String> [[-FolderID] <Int
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### TemplatePermission
```
New-PasswordStateList [-Name] <String> [-Description] <String> [[-FolderID] <Int32>]
[-CopyPermissionsFromTemplateID] <String> [[-ImageFileName] <String>] [[-SiteID] <Int32>] [-AllowExport]
[[-Guide] <String>] [-PreventBadPasswordUse] [-PasswordResetEnabled] [[-PasswordGeneratorID] <Int32>]
[[-PasswordStrengthPolicyID] <Int32>] [-Sort] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Creates a passwordstate List.
Adding a new Password List object can be achieved by making a POST request on the URL, with appropriate fields forming the HTTP message body. To create Password Lists, you must have access to the 'Add Shared Password List' and/or 'Add Private Password List' menus within the Passwordstate UI.
Expand Down Expand Up @@ -97,6 +105,13 @@ New-PasswordStateList -Name "TestPrivateList" -PrivatePasswordList -description

Creates a private password list under folder with ID 4. Applying administrator permissions to the given user.

### EXAMPLE 4
```
New-PasswordStateList -Name "TestSharedList" -Description "Test shared password list" -FolderID 4 -CopySettingsFromTemplateID 1 -CopyPermissionsFromTemplateID 1 -LinkToTemplate "true"
```

Creates an advanced shared password list under folder with ID 4. The settings and permissions will be copied from an existing password list template with ID 1 and the list will be linked to the password list template.

## PARAMETERS

### -AllowExport
Expand Down Expand Up @@ -179,6 +194,18 @@ Accept wildcard characters: False
Optionally copy the permissions from a password list template.
To copy permissions to the Password List from an existing Password List Template, you can specify the TemplateID value for this field.
```yaml
Type: String
Parameter Sets: TemplatePermission
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
```yaml
Type: String
Parameter Sets: Permission
Expand Down Expand Up @@ -229,7 +256,7 @@ Parameter Sets: Permission, Template
Aliases:

Required: False
Position: 5
Position: 3, 5
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Expand Down Expand Up @@ -314,16 +341,16 @@ Accept wildcard characters: False
### -LinkToTemplate
Link template to an existing password list template.
If you want to Link the new Password List to an existing Password List Template, then you can specify the TemplateID here.
If you want to Link the new Password List to an existing Password List Template, set this to "true".
**Note**: When doing this, you must also specify a value for the field CopySettingsFromTemplateID, and not use the field CopySettingsFromPasswordListID.
```yaml
Type: String
Parameter Sets: Permission
Parameter Sets: TemplatePermission
Aliases:

Required: False
Required: True
Position: 4
Default value: None
Accept pipeline input: True (ByPropertyName)
Expand All @@ -332,11 +359,11 @@ Accept wildcard characters: False
```yaml
Type: String
Parameter Sets: Template
Parameter Sets: Permission
Aliases:

Required: True
Position: 4
Required: False
Position: 12
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Expand Down
2 changes: 2 additions & 0 deletions functions/New-PasswordStateList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[parameter(parameterSetName = 'Permission', ValueFromPipelineByPropertyName, Position = 5, Mandatory = $false)]
[string]$CopySettingsFromTemplateID = $null,
[parameter(parameterSetName = 'Permission', ValueFromPipelineByPropertyName, Position = 6, Mandatory = $false)]
[parameter(parameterSetName = 'TemplatePermission', ValueFromPipelineByPropertyName, Position = 4, Mandatory = $true)]
[string]$CopyPermissionsFromTemplateID = $null,
[parameter(parameterSetName = 'Permission', ValueFromPipelineByPropertyName, Position = 6, Mandatory = $false)]
[parameter(parameterSetName = 'Template', ValueFromPipelineByPropertyName, Position = 4, Mandatory = $true)]
Expand All @@ -36,6 +37,7 @@
[parameter(parameterSetName = 'Permission', Position = 11, ValueFromPipelineByPropertyName, Mandatory = $false)]
[string]$ApplyPermissionsForSecurityGroupName = $null,
[parameter(parameterSetName = 'Private', ValueFromPipelineByPropertyName, Position = 6, Mandatory = $false)]
[parameter(parameterSetName = 'TemplatePermission', ValueFromPipelineByPropertyName, Position = 4, Mandatory = $false)]
[parameter(ParameterSetName = 'Permission', Position = 12, ValueFromPipelineByPropertyName, Mandatory = $true)]
[ValidateSet('A', 'M', 'V')]
[string]$Permission,
Expand Down

0 comments on commit 235d1f5

Please sign in to comment.