parameters: (self, update=False)
return_statement: return acl
docstring: Generate a single new Role object based off of a combination of all of
          the user's assigned roles. Each attribute is analyzed across all roles
          and the "highest-order-access" is granted.
  
          :param update: Update the cache before returning. If the cache is empty
                         we always update first.
          :type update: boolean
          :returns: :class:`crits.core.role.Role`
docstring_summary: Generate a single new Role object based off of a combination of all of
          the user's assigned roles. Each attribute is analyzed across all roles
          and the "highest-order-access" is granted.
docstring_tokens: Generate a single new Role object based off of a combination of all of the user s assigned roles . Each attribute is analyzed across all roles and the highest - order - access is granted .
function: def get_access_list(self, update=False):
          """
          Generate a single new Role object based off of a combination of all of
          the user's assigned roles. Each attribute is analyzed across all roles
          and the "highest-order-access" is granted.
  
          :param update: Update the cache before returning. If the cache is empty
                         we always update first.
          :type update: boolean
          :returns: :class:`crits.core.role.Role`
          """
  
          # If we already have this cached, return it unless we are supposed to
          # update the cache first.
          if not update:
              return self.acl
  
          acl = {}
          roles = Role.objects(name__in=self.roles)
          if not roles:
              logger.error("No ROLES defined for user: {0}".format(self.username))
              return False
          acl = roles.first()._data
  
          # for each role, modify the acl object to reflect all of the attributes
          # the user should be granted access to.
          for r in roles:
              for p,v in r._data.iteritems():
                  if p in ['name', 'description', 'active', 'id']:
                      # No need to worry about these. Added benefit of
                      # throwing a validation error since there is no name
                      # preventing people from accidentally saving this as a new
                      # Role.
                      pass
                  elif p == 'sources':
                      # For each source, try to find it in the existing list. If
                      # we find it, adjust the attributes based on which ones the
                      # user should get access to. If not, append it to the list
                      # of sources.
                      for s in r.sources:
                          c = 0
                          found = False
                          for src in acl['sources']:
                              if s.name == src.name:
                                  for x,y in s._data.iteritems():
                                      if not acl['sources'][c].get(x, True):
                                          acl['sources'][c][x] = y
                                  found = True
                                  break
                              c += 1
                          if not found:
                              acl['sources'].append(s)
                  elif p in settings.CRITS_TYPES.iterkeys():
                      # For each CRITs Type adjust the attributes based on which
                      # ones the # user should get access to.
  
                      # Get the attribute we are working with.
                      attr = acl.get(p, False)
  
                      # Modify the attributes.
                      for x,y in getattr(r, p)._data.iteritems():
                          if not getattr(attr, x, False):
                              setattr(attr, x, y)
  
                      # Set the attribute on the ACL.
                      acl[p] = attr
                  else:
                      # Set the attribute if the user should get access to it.
                      if not acl.get(p, False):
                          acl[p] = v
          acl = dict(acl)
          self.acl = acl
          self.acl_needs_update = False
          self.save()
          return acl
function_tokens: def get_access_list ( self , update = False ) : # If we already have this cached, return it unless we are supposed to # update the cache first. if not update : return self . acl acl = { } roles = Role . objects ( name__in = self . roles ) if not roles : logger . error ( "No ROLES defined for user: {0}" . format ( self . username ) ) return False acl = roles . first ( ) . _data # for each role, modify the acl object to reflect all of the attributes # the user should be granted access to. for r in roles : for p , v in r . _data . iteritems ( ) : if p in [ 'name' , 'description' , 'active' , 'id' ] : # No need to worry about these. Added benefit of # throwing a validation error since there is no name # preventing people from accidentally saving this as a new # Role. pass elif p == 'sources' : # For each source, try to find it in the existing list. If # we find it, adjust the attributes based on which ones the # user should get access to. If not, append it to the list # of sources. for s in r . sources : c = 0 found = False for src in acl [ 'sources' ] : if s . name == src . name : for x , y in s . _data . iteritems ( ) : if not acl [ 'sources' ] [ c ] . get ( x , True ) : acl [ 'sources' ] [ c ] [ x ] = y found = True break c += 1 if not found : acl [ 'sources' ] . append ( s ) elif p in settings . CRITS_TYPES . iterkeys ( ) : # For each CRITs Type adjust the attributes based on which # ones the # user should get access to. # Get the attribute we are working with. attr = acl . get ( p , False ) # Modify the attributes. for x , y in getattr ( r , p ) . _data . iteritems ( ) : if not getattr ( attr , x , False ) : setattr ( attr , x , y ) # Set the attribute on the ACL. acl [ p ] = attr else : # Set the attribute if the user should get access to it. if not acl . get ( p , False ) : acl [ p ] = v acl = dict ( acl ) self . acl = acl self . acl_needs_update = False self . save ( ) return acl