Brief update, got my code working. This is how I altered it:

    def add_metadata(self, environ, identity):        """        Load
the groups and permissions of the authenticated user.
It will load such data into the :mod:`repoze.who` ``identity`` and
    the :mod:`repoze.what` ``credentials`` dictionaries.
 :param environ: The WSGI environment.        :param identity: The
:mod:`repoze.who`'s ``identity`` dictionary.                """
logger = environ.get('repoze.who.logger')        # Finding the groups
and permissions:        groups, permissions =
identity.setdefault('groups', set()).update(groups)
identity.setdefault('permissions', set()).update(permissions)
      # Adding the groups and permissions to the repoze.what
credentials for        # forward compatibility:        if
'repoze.what.credentials' not in environ:
environ['repoze.what.credentials'] = {}
environ['repoze.what.credentials']['groups'] = identity['groups']
  environ['repoze.what.credentials']['permissions'] =
identity['permissions']        # Adding the userid:        userid =
environ['repoze.what.credentials']['repoze.what.userid'] = userid
  # Adding the adapters:        environ['repoze.what.adapters'] = {
        'groups': self.group_adapters,            'permissions':
self.permission_adapters            }        # Logging        logger
and'User belongs to the following groups: %s' %
                    str(groups))        logger and'User
has the following permissions: %s' %


I'm not certain if environ['repoze.what.credentials']['groups'] should
be a reference or a copy of identity['groups'] - but given the
comment, I don't see a problem with it. I'm not 100% sure how it
behaved before since they were both set from the groups/permissions
variables (which are temporary?)
Repoze-dev mailing list

Reply via email to