In TG2b1 with tg.authorize I can do this:

    class SomeSecureController(SecureController):
        require = authorize.has_permission('onePermission')

        @expose('my_package.template.index')
        def index(self):
            # do something here

        @expose('my_package.template.add')
        @authorize.require(authorize.has_permission('specialPerm'))
        def do_things(self, **kw):
            # do other things here

But since TG2b2 with repoze.what it will throw an error:

    >>  @require(predicates.has_permission('specialPerm'))
    TypeError: 'has_permission' object is not callable

To implement the same permission checking, since TG2b2 I have to write
it like this:

    class SomeSecureController(BaseController):

        @expose('my_package.template.index')
        @require(predicates.has_permission('onePermission'))
        def index(self):
            # do something here

        @expose('my_package.template.add')
        @require(predicates.has_all_permission('onePermission',
'specialPerm'))
        def do_things(self, **kw):
            # do other things here

I kinda like the behavior of the first code, where you can define a
default permission requirement and then define additional permissions
as necessary.Is there a way to define a default permission requirement
with repoze.what?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to