#NEWLINE# def group_has_object_permission( self , instance , perm , require_all = False ) : #NEWLINE# #INDENT# "\n    Basic testing of permissions. Permissions can be passed as an int, using the \n    object's ``perms`` attribute::\n    \n        obj.perms.perm1 + obj.perms.perm2\n    \n    Permissions can be referenced by name::\n    \n        'perm1'\n    \n    Permissions can be referenced by a list of names:\n    \n        ['perm1', 'perm2']\n    \n    When passing in multiple permissions, you can force the checking that the \n    user has *all* the permissions by passing ``True`` as the third parameter. By\n    default it returns ``True`` if the user has *any* of the permissions.\n    \n    :param instance: The object for which the group may or may not have permissions.\n    :type instance:  A Django model subclass that has been registered with :ref:`objectpermissions.register`\n    :param perm:     Permission(s) to check for in either an integer, a string or a list of strings\n    :type perm:      ``int``, ``string`` or ``list of string``\n    :param require_all: Does the user need to have all the permissions? ``True``\n                        if they do. **Default:** ``False``\n    :type require_all:  ``bool``\n    " #NEWLINE# perms = instance . perms . as_int ( perm ) #NEWLINE# try : #NEWLINE# #INDENT# group_perm = instance . group_perms_set . get ( group = self ) #NEWLINE# if ( ( group_perm . permission & perms ) > 0 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# except GroupPermission . DoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return False