changes param src to path, and updates docs accordingly

reviewable/pr18780/r1
Phil 9 years ago
parent 05e01bd3b5
commit 26bdf16e69

@ -88,15 +88,15 @@ $result = New-Object psobject @{
changed = $false
}
If ($params.src) {
$src = $params.src.toString()
If ($params.path) {
$path = $params.path.toString()
If (-Not (Test-Path -Path $src)) {
Fail-Json $result "$src file or directory does not exist on the host"
If (-Not (Test-Path -Path $path)) {
Fail-Json $result "$path file or directory does not exist on the host"
}
}
Else {
Fail-Json $result "missing required argument: src"
Fail-Json $result "missing required argument: path"
}
If ($params.user) {
@ -124,7 +124,7 @@ Else {
If ($params.inherit) {
# If it's a file then no flags can be set or an exception will be thrown
If (Test-Path -Path $src -PathType Leaf) {
If (Test-Path -Path $path -PathType Leaf) {
$inherit = "None"
}
Else {
@ -133,7 +133,7 @@ If ($params.inherit) {
}
Else {
# If it's a file then no flags can be set or an exception will be thrown
If (Test-Path -Path $src -PathType Leaf) {
If (Test-Path -Path $path -PathType Leaf) {
$inherit = "None"
}
Else {
@ -176,7 +176,7 @@ Try {
$objUser = New-Object System.Security.Principal.NTAccount($user)
$objACE = New-Object System.Security.AccessControl.FileSystemAccessRule ($objUser, $colRights, $InheritanceFlag, $PropagationFlag, $objType)
$objACL = Get-ACL $src
$objACL = Get-ACL $path
# Check if the ACE exists already in the objects ACL list
$match = $false
@ -190,7 +190,7 @@ Try {
If ($state -eq "add" -And $match -eq $false) {
Try {
$objACL.AddAccessRule($objACE)
Set-ACL $src $objACL
Set-ACL $path $objACL
$result.changed = $true
}
Catch {
@ -200,7 +200,7 @@ Try {
ElseIf ($state -eq "remove" -And $match -eq $true) {
Try {
$objACL.RemoveAccessRule($objACE)
Set-ACL $src $objACL
Set-ACL $path $objACL
$result.changed = $true
}
Catch {
@ -219,7 +219,7 @@ Try {
}
}
Catch {
Fail-Json $result "an error occured when attempting to $state $rights permission(s) on $src for $user"
Fail-Json $result "an error occured when attempting to $state $rights permission(s) on $path for $user"
}
Exit-Json $result

@ -29,18 +29,15 @@ short_description: Set file/directory permissions for a system user or group.
description:
- Add or remove rights/permissions for a given user or group for the specified src file or folder.
options:
src:
path:
description:
- File or Directory
required: yes
default: none
aliases: []
user:
description:
- User or Group to add specified rights to act on src file/folder
required: yes
default: none
aliases: []
state:
description:
- Specify whether to add (present) or remove (absent) the specified access rule
@ -49,7 +46,6 @@ options:
- present
- absent
default: present
aliases: []
type:
description:
- Specify whether to allow or deny the rights specified
@ -58,7 +54,6 @@ options:
- allow
- deny
default: none
aliases: []
rights:
description:
- The rights/permissions that are to be allowed/denyed for the specified user or group for the given src file or directory. Can be entered as a comma separated list (Ex. "Modify, Delete, ExecuteFile"). For more information on the choices see MSDN FileSystemRights Enumeration.
@ -86,7 +81,6 @@ options:
- WriteData
- WriteExtendedAttributes
default: none
aliases: []
inherit:
description:
- Inherit flags on the ACL rules. Can be specified as a comma separated list (Ex. "ContainerInherit, ObjectInherit"). For more information on the choices see MSDN InheritanceFlags Enumeration.
@ -96,7 +90,6 @@ options:
- ObjectInherit
- None
default: For Leaf File: None; For Directory: ContainerInherit, ObjectInherit;
aliases: []
propagation:
description:
- Propagation flag on the ACL rules. For more information on the choices see MSDN PropagationFlags Enumeration.
@ -106,7 +99,6 @@ options:
- NoPropagateInherit
- InheritOnly
default: "None"
aliases: []
author: Phil Schwartz, Trond Hindenes
'''

Loading…
Cancel
Save