Grant access to auto-mounted shared folders to the users.

    User is specified by it's name. To grant access for several users use
    argument `users`.

    name
        Name of the user to grant access to auto-mounted shared folders to.
    users
        List of names of users to grant access to auto-mounted shared folders to.
        If specified, `name` will not be taken into account.

def grant_access_to_shared_folders_to(name, users=None):
    '''
    Grant access to auto-mounted shared folders to the users.

    User is specified by it's name. To grant access for several users use
    argument `users`.

    name
        Name of the user to grant access to auto-mounted shared folders to.
    users
        List of names of users to grant access to auto-mounted shared folders to.
        If specified, `name` will not be taken into account.
    '''
    ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
    current_state = __salt__['vbox_guest.list_shared_folders_users']()
    if users is None:
        users = [name]
    if current_state == users:
        ret['result'] = True
        ret['comment'] = 'System already in the correct state'
        return ret
    if __opts__['test']:
        ret['comment'] = ('List of users who have access to auto-mounted '
                          'shared folders will be changed')
        ret['changes'] = {
            'old': current_state,
            'new': users,
        }
        ret['result'] = None
        return ret

    new_state = __salt__['vbox_guest.grant_access_to_shared_folders_to'](
        name=name, users=users)

    ret['comment'] = ('List of users who have access to auto-mounted shared '
                      'folders was changed')
    ret['changes'] = {
        'old': current_state,
        'new': new_state,
    }
    ret['result'] = True
    return ret