Debian Codegraph @

test/support/windows-integration/plugins/modules/win_acl.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright: (c) 2015, Phil Schwartz <[email protected]>
5 # Copyright: (c) 2015, Trond Hindenes
6 # Copyright: (c) 2015, Hans-Joachim Kliemeck <[email protected]>
7 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
8
9 ANSIBLE_METADATA = {'metadata_version': '1.1',
10 'status': ['preview'],
11 'supported_by': 'core'}
12
13 DOCUMENTATION = r"""
14 ---
15 module: win_acl
16 version_added: "2.0"
17 short_description: Set file/directory/registry permissions for a system user or group
18 description:
19 - Add or remove rights/permissions for a given user or group for the specified
20 file, folder, registry key or AppPool identifies.
21 options:
22 path:
23 description:
24 - The path to the file or directory.
25 type: str
26 required: yes
27 user:
28 description:
29 - User or Group to add specified rights to act on src file/folder or
30 registry key.
31 type: str
32 required: yes
33 state:
34 description:
35 - Specify whether to add C(present) or remove C(absent) the specified access rule.
36 type: str
37 choices: [ absent, present ]
38 default: present
39 type:
40 description:
41 - Specify whether to allow or deny the rights specified.
42 type: str
43 required: yes
44 choices: [ allow, deny ]
45 rights:
46 description:
47 - The rights/permissions that are to be allowed/denied for the specified
48 user or group for the item at C(path).
49 - If C(path) is a file or directory, rights can be any right under MSDN
50 FileSystemRights U(https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemrights.aspx).
51 - If C(path) is a registry key, rights can be any right under MSDN
52 RegistryRights U(https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.registryrights.aspx).
53 type: str
54 required: yes
55 inherit:
56 description:
57 - Inherit flags on the ACL rules.
58 - Can be specified as a comma separated list, e.g. C(ContainerInherit),
59 C(ObjectInherit).
60 - For more information on the choices see MSDN InheritanceFlags enumeration
61 at U(https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.inheritanceflags.aspx).
62 - Defaults to C(ContainerInherit, ObjectInherit) for Directories.
63 type: str
64 choices: [ ContainerInherit, ObjectInherit ]
65 propagation:
66 description:
67 - Propagation flag on the ACL rules.
68 - For more information on the choices see MSDN PropagationFlags enumeration
69 at U(https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.propagationflags.aspx).
70 type: str
71 choices: [ InheritOnly, None, NoPropagateInherit ]
72 default: "None"
73 notes:
74 - If adding ACL's for AppPool identities (available since 2.3), the Windows
75 Feature "Web-Scripting-Tools" must be enabled.
76 seealso:
77 - module: win_acl_inheritance
78 - module: win_file
79 - module: win_owner
80 - module: win_stat
81 author:
82 - Phil Schwartz (@schwartzmx)
83 - Trond Hindenes (@trondhindenes)
84 - Hans-Joachim Kliemeck (@h0nIg)
85 """
86
87 EXAMPLES = r"""
88 - name: Restrict write and execute access to User Fed-Phil
89 win_acl:
90 user: Fed-Phil
91 path: C:\Important\Executable.exe
92 type: deny
93 rights: ExecuteFile,Write
94
95 - name: Add IIS_IUSRS allow rights
96 win_acl:
97 path: C:\inetpub\wwwroot\MySite
98 user: IIS_IUSRS
99 rights: FullControl
100 type: allow
101 state: present
102 inherit: ContainerInherit, ObjectInherit
103 propagation: 'None'
104
105 - name: Set registry key right
106 win_acl:
107 path: HKCU:\Bovine\Key
108 user: BUILTIN\Users
109 rights: EnumerateSubKeys
110 type: allow
111 state: present
112 inherit: ContainerInherit, ObjectInherit
113 propagation: 'None'
114
115 - name: Remove FullControl AccessRule for IIS_IUSRS
116 win_acl:
117 path: C:\inetpub\wwwroot\MySite
118 user: IIS_IUSRS
119 rights: FullControl
120 type: allow
121 state: absent
122 inherit: ContainerInherit, ObjectInherit
123 propagation: 'None'
124
125 - name: Deny Intern
126 win_acl:
127 path: C:\Administrator\Documents
128 user: Intern
129 rights: Read,Write,Modify,FullControl,Delete
130 type: deny
131 state: present
132 """