Hi *,

I am trying to have a folderish object that acquires from a user object
(ldapuserfolder). It should have its own properties and contents, but
fall back to the ones of the ldap user.

I have created an object, extending Folder, and it behaves nicely in
zopectl debug. When I try to access it through e.g. a python script  I
get an:

Error Type: Unauthorized
Error Value: Unable to find __roles__ in the container and the container
is not wrapped. Access to 'dn' of test, acquired through (LDAPProxy at
/testfolder/ldapproxy), denied.

I am sure its my lack of understanding of acquisition. I am trying to
bascially put ldap user object 'on top' of the aquisition line (with the
ldapproxy at the bottom), but obviously failing in doing so. Any ideas?



--------8< excerpt from code ---------------

class LDAPProxy(Folder):


    def __init__(self, id, remoteid,title='',REQUEST=None):
        self.id = id
        self.title = title
        self.remoteid = remoteid

    def __of__(self, parent):
        if not hasattr(parent,'aq_base'):
            return self
        folder,id = self.remoteid.split(':')
        acl = parent.restrictedTraverse(folder)
        remote = acl.getUser(id)
        return Folder.__of__(self,parent.__of__(remote))

------- teststructure----------

           ldapproxy (LDAPProxy)
           testscript (.py)

--------8< testscript ---------------------
return context.ldapproxy.dn

Traceback (most recent call last):
  File "/home/joerg/zope/Zope-2.8.5/lib/python/ZPublisher/Publish.py",
line 113, in publish
    request, bind=1)
  File "/home/joerg/zope/Zope-2.8.5/lib/python/ZPublisher/mapply.py",
line 88, in mapply
    if debug is not None: return debug(object,args,context)
  File "/home/joerg/zope/Zope-2.8.5/lib/python/ZPublisher/Publish.py",
line 40, in call_object
    result=apply(object,args) # Type s<cr> to step into published object.
line 311, in __call__
    return self._bindAndExec(args, kw, None)
line 348, in _bindAndExec
    return self._exec(bound_data, args, kw)
line 323, in _exec
    result = f(*args, **kw)
  File "Script (Python)", line 1, in testscript
line 727, in guarded_getattr
    aq_acquire(inst, name, aq_validate, validate)
line 669, in aq_validate
    return validate(inst, object, name, v)
line 563, in validate
line 293, in validate
    accessed, container, name, value, context)
line 808, in raiseVerbose
    raise Unauthorized(text)
Unauthorized: Unable to find __roles__ in the container and the
container is not wrapped.  Access to 'dn' of test, acquired through
(LDAPProxy at /testfolder/ldapproxy), denied.

Attachment: signature.asc
Description: OpenPGP digital signature

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to