parameters: (self)
return_statement: return (changed_permissions, changed_users, warnings)
docstring: Checks that all permissions are set correctly for the users.
  
          :return: A set of users whose permissions was wrong.
docstring_summary: Checks that all permissions are set correctly for the users.
docstring_tokens: Checks that all permissions are set correctly for the users .
function: def check_permissions(self):
          """
          Checks that all permissions are set correctly for the users.
  
          :return: A set of users whose permissions was wrong.
  
          """
          # Variable to supply some feedback
          changed_permissions = []
          changed_users = []
          warnings = []
  
          # Check that all the permissions are available.
          for model, perms in ASSIGNED_PERMISSIONS.items():
              if model == 'profile':
                  model_obj = get_profile_model()
              else: model_obj = User
              model_content_type = ContentType.objects.get_for_model(model_obj)
              for perm in perms:
                  try:
                      Permission.objects.get(codename=perm[0],
                                             content_type=model_content_type)
                  except Permission.DoesNotExist:
                      changed_permissions.append(perm[1])
                      Permission.objects.create(name=perm[1],
                                                codename=perm[0],
                                                content_type=model_content_type)
  
          for user in User.objects.all():
              if not user.username == 'AnonymousUser':
                  try:
                      user_profile = user.get_profile()
                  except get_profile_model().DoesNotExist:
                      warnings.append(_("No profile found for %(username)s") \
                                          % {'username': user.username})
                  else:
                      all_permissions = get_perms(user, user_profile) + get_perms(user, user)
  
                      for model, perms in ASSIGNED_PERMISSIONS.items():
                          if model == 'profile':
                              perm_object = user.get_profile()
                          else: perm_object = user
  
                          for perm in perms:
                              if perm[0] not in all_permissions:
                                  assign(perm[0], user, perm_object)
                                  changed_users.append(user)
  
          return (changed_permissions, changed_users, warnings)
function_tokens: def check_permissions ( self ) : # Variable to supply some feedback changed_permissions = [ ] changed_users = [ ] warnings = [ ] # Check that all the permissions are available. for model , perms in ASSIGNED_PERMISSIONS . items ( ) : if model == 'profile' : model_obj = get_profile_model ( ) else : model_obj = User model_content_type = ContentType . objects . get_for_model ( model_obj ) for perm in perms : try : Permission . objects . get ( codename = perm [ 0 ] , content_type = model_content_type ) except Permission . DoesNotExist : changed_permissions . append ( perm [ 1 ] ) Permission . objects . create ( name = perm [ 1 ] , codename = perm [ 0 ] , content_type = model_content_type ) for user in User . objects . all ( ) : if not user . username == 'AnonymousUser' : try : user_profile = user . get_profile ( ) except get_profile_model ( ) . DoesNotExist : warnings . append ( _ ( "No profile found for %(username)s" ) % { 'username' : user . username } ) else : all_permissions = get_perms ( user , user_profile ) + get_perms ( user , user ) for model , perms in ASSIGNED_PERMISSIONS . items ( ) : if model == 'profile' : perm_object = user . get_profile ( ) else : perm_object = user for perm in perms : if perm [ 0 ] not in all_permissions : assign ( perm [ 0 ] , user , perm_object ) changed_users . append ( user ) return ( changed_permissions , changed_users , warnings )