My context factories can be used in a hybrid way. As regular context factories they retrieve the object according to matchdict. But they can be passed the object as well and then just compute the permission. So in the Index i'd loop over all possible tasks and ask the factories for each route whether the User gas this permission.
Am 16.02.2012 17:36 schrieb "Antonio Beamud Montero" < antonio.bea...@gmail.com>: > El 16/02/12 16:44, Robert Forkel escribió: > >> i went with a custom context factory [1] per route; i.e. i have routes >> for patterns like "/task/{id}/edit" or "/task/{id}/view" and register >> context factories for these which retrieve the task object from the db >> and compute the permissions, i.e. attach an appropriate __acl__ object >> to the task object. >> regards >> robert >> >> [1] http://docs.pylonsproject.org/**projects/pyramid/en/1.2-** >> branch/narr/urldispatch.html#**route-factories<http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/urldispatch.html#route-factories> >> >> > Ok, but if you want to show the list of tasks in the index user page, how > do you check the tasks permission, for example to show a icon near the task > description, in case you can edit that task? > > A lot of thanks. > > PD: My conclusion is I need to created a role or group attribute in the > user-task relation, to see if the user has the correct role/group assigned > to this object... > > > On Thu, Feb 16, 2012 at 4:12 PM, Antonio Beamud Montero >> <antonio.bea...@gmail.com> wrote: >> >>> Hi, what's the best way to implement a permission per object in pyramid >>> using SQLAlchemy to store users info, and using url distpatch. >>> For example, If a user has three tasks assigned, he can edit two of them, >>> but only view the 3rd, or view tasks of other users (if they want), but >>> not >>> edit them. >>> >>> Greetings. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "pylons-discuss" group. >>> To post to this group, send email to >>> pylons-discuss@googlegroups.**com<pylons-discuss@googlegroups.com> >>> . >>> To unsubscribe from this group, send email to >>> pylons-discuss+unsubscribe@**googlegroups.com<pylons-discuss%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/**group/pylons-discuss?hl=en<http://groups.google.com/group/pylons-discuss?hl=en> >>> . >>> >>> > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to > pylons-discuss@googlegroups.**com<pylons-discuss@googlegroups.com> > . > To unsubscribe from this group, send email to pylons-discuss+unsubscribe@* > *googlegroups.com <pylons-discuss%2bunsubscr...@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/pylons-discuss?hl=en<http://groups.google.com/group/pylons-discuss?hl=en> > . > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.