I think you need to use the SecureObject descriptor. Something like:

class Root(controllers.RootController):
    # Mount catwalk for admins only
    catwalk = CatWalk(model)
catwalk = identity.SecureObject(catwalk, identity.in_group ("admin"))

I haven't tested it so I might be wrong, but you can try... ;)

Alberto

On Feb 5, 2006, at 6:41 PM, Nyenyec N wrote:


Hi,

I'd like to limit access to a mounted CatWalk in my app to a specific
user group only.
I tried this, but it doesn't work.

class Root(controllers.RootController):
    # Mount catwalk for admins only
    catwalk = CatWalk(model)
    catwalk = identity.require(identity.in_group("admin"))(catwalk)

I get:
Traceback (most recent call last):
  File "start-turbowp.py", line 24, in ?
    from turbowp.controllers import Root
  File "c:\local\python\turbowp\turbowp\controllers.py", line 10, in ?
    class Root(controllers.RootController):
File "c:\local\python\turbowp\turbowp\controllers.py", line 13, in Root
    catwalk = identity.require(identity.in_group("admin"))(catwalk)
File "c:\local\turbogears\svn\turbogears\turbogears\identity \conditions.py", l
ine 238, in entangle
    return decorator(require)(fn)
File "c:\local\turbogears\svn\turbogears\turbogears \decorator.py", line 11, in
 entangle
    argnames, varargs, kwargs, defaults = getargspec(func)
  File "c:\python24\lib\inspect.py", line 666, in getargspec
    raise TypeError('arg is not a Python function')

Is there an easy way to do this?

Thanks,
nyenyec

Reply via email to