def accessible_to(self, user):
if user.is_superuser:<EOL><INDENT>try:<EOL><INDENT>queryset = self.get_queryset()<EOL><DEDENT>except AttributeError:<EOL><INDENT>queryset = self<EOL><DEDENT><DEDENT>elif user.is_authenticated():<EOL><INDENT>group = user.groups.all().order_by('<STR_LIT>')[<NUM_LIT:0>]<EOL>queryset = self.filter(access_level__lte=ACCESS_LEVELS.get(group.name))<EOL><DEDENT>else:<EOL><INDENT>queryset = self.filter(access_level__lte=ACCESS_LEVELS.get('<STR_LIT>'))<EOL><DEDENT>return queryset<EOL>
returns all the items that are accessible to the specified user
if user is not authenticated will return public items

:param user: an user instance