mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add Support for CachingMode Setting (#21103)
Add Support for CachingMode Setting
This commit is contained in:
parent
778dc9ad38
commit
7d44b2987e
2 changed files with 19 additions and 2 deletions
|
@ -67,7 +67,7 @@ Function UserSearch
|
|||
$Searcher.Filter = "userPrincipalName=$($accountName)"
|
||||
}
|
||||
|
||||
$result = $Searcher.FindOne()
|
||||
$result = $Searcher.FindOne()
|
||||
if ($result)
|
||||
{
|
||||
$user = $result.GetDirectoryEntry()
|
||||
|
@ -138,6 +138,8 @@ Try {
|
|||
$permissionFull = Get-AnsibleParam -obj $params -name "full" -type "str" -default "" | NormalizeAccounts
|
||||
$permissionDeny = Get-AnsibleParam -obj $params -name "deny" -type "str" -default "" | NormalizeAccounts
|
||||
|
||||
$cachingMode = Get-Attr $params "caching_mode" "" -validateSet "BranchCache","Documents","Manual","None","Programs", "Unkown"
|
||||
|
||||
If (-Not (Test-Path -Path $path)) {
|
||||
Fail-Json $result "$path directory does not exist on the host"
|
||||
}
|
||||
|
@ -170,6 +172,10 @@ Try {
|
|||
Set-SmbShare -Force -Name $name -FolderEnumerationMode $folderEnum
|
||||
$result.changed = $true
|
||||
}
|
||||
if ($share.CachingMode -ne $cachingMode) {
|
||||
Set-SmbShare -Force -Name $name -CachingMode $cachingMode
|
||||
Set-Attr $result "changed" $true;
|
||||
}
|
||||
|
||||
# clean permissions that imply others
|
||||
ForEach ($user in $permissionFull) {
|
||||
|
|
|
@ -84,7 +84,18 @@ options:
|
|||
- Specify user list that should get no access, regardless of implied access on share, separated by comma.
|
||||
required: no
|
||||
default: none
|
||||
author: Hans-Joachim Kliemeck (@h0nIg)
|
||||
caching_mode:
|
||||
description:
|
||||
- Set the CachingMode for this share.
|
||||
choices:
|
||||
- BranchCache
|
||||
- Documents
|
||||
- Manual
|
||||
- None
|
||||
- Programs
|
||||
- Unknown
|
||||
required: no
|
||||
author: Hans-Joachim Kliemeck (@h0nIg), David Baumann (@daBONDi)
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
|
Loading…
Reference in a new issue