Output Checkbox Data on Template If you have a checkbox  field on an entry type, how do you display all the selected values for an entry in a template with twig?

Using this for page permissions via user groups. We have a plugin that adds a new field type "user groups". It lists all groups (which we have many) on the admin page of each entry. We want to check which groups will have access and then limit the page to users in that group only.

edit: not using a standard checkbox field but a new field (via plugin). https://github.com/quebecstudio/usergroupfield
You get all available options with the options attribute and you can check if it is selected in the current entry with option.selected

{% for opt in entry.checkboxFieldHandle.options %}
    &lt;label&gt;
        &lt;input name="fields[checkboxFieldHandle][]" type="checkbox" value="{{ opt.value }}"&gt;
        {{ opt.label }}
        {% if opt.selected %}
            I'm selected
        {% endif %}
    &lt;/label&gt;
{% endfor %}


But to be honest I don't really understand your second part

Edit
As for your field, you can display all the selected values with

{% set selectedUserGroupIds = entry.userGroupFieldHandle %}
{% for userGroupId in selectedUserGroupIds %}
    {% set usergroup = craft.userGroups.getGroupById(userGroupId) %}
    {{ usergroup.name }}
{% endfor %}