async def get_default_acl(self, acl_type, share_type): """ Returns a default ACL depending on the usage specified by `acl_type`. If an admin group is defined, then an entry granting it full control will be placed at the top of the ACL. Optionally may pass `share_type` to argument to get share-specific template ACL. """ acl = [] admin_group = (await self.middleware.call('smb.config'))['admin_group'] if acl_type == 'HOME' and (await self.middleware.call('activedirectory.get_state')) == 'HEALTHY': acl_type = 'DOMAIN_HOME' if admin_group: acl.append({ 'tag': 'GROUP', 'id': (await self.middleware.call('dscache.get_uncached_group', admin_group))['gr_gid'], 'perms': {'BASIC': 'FULL_CONTROL'}, 'flags': {'BASIC': 'INHERIT'}, 'type': 'ALLOW' }) if share_type == 'SMB': acl.append({ 'tag': 'GROUP', 'id': int(SMBBuiltin['USERS'].value[1][9:]), 'perms': {'BASIC': 'MODIFY'}, 'flags': {'BASIC': 'INHERIT'}, 'type': 'ALLOW' }) acl.extend((ACLDefault[acl_type].value)['acl']) return acl
async def get_default_acl(self, acl_type): """ Returns a default ACL depending on the usage specified by `acl_type`. If an admin group is defined, then an entry granting it full control will be placed at the top of the ACL. """ acl = [] admin_group = (await self.middleware.call('smb.config'))['admin_group'] if admin_group: acl.append({ 'tag': 'GROUP', 'id': (await self.middleware.call('dscache.get_uncached_group', admin_group))['gr_gid'], 'perms': { 'BASIC': 'FULL_CONTROL' }, 'flags': { 'BASIC': 'INHERIT' }, 'type': 'ALLOW' }) acl.extend(ACLDefault[acl_type].value) return acl
async def get_default_acl(self, acl_type, share_type): acl = [] admin_group = (await self.middleware.call('smb.config'))['admin_group'] if acl_type == 'HOME' and (await self.middleware.call( 'activedirectory.get_state')) == 'HEALTHY': acl_type = 'DOMAIN_HOME' if admin_group: acl.append({ 'tag': 'GROUP', 'id': (await self.middleware.call('dscache.get_uncached_group', admin_group))['gr_gid'], 'perms': { 'BASIC': 'FULL_CONTROL' }, 'flags': { 'BASIC': 'INHERIT' }, 'type': 'ALLOW' }) if share_type == 'SMB': acl.append({ 'tag': 'GROUP', 'id': int(SMBBuiltin['USERS'].value[1][9:]), 'perms': { 'BASIC': 'MODIFY' }, 'flags': { 'BASIC': 'INHERIT' }, 'type': 'ALLOW' }) acl.extend((ACLDefault[acl_type].value)['acl']) return acl