On Mar 2, 2010, at 1:18 PM, mdipierro wrote:

> ok. I will take a patch.

Have a look at this, please. It's completely untested. I made a couple of other 
changes along the way.


http://web.me.com/jlundell/filechute/tools.diff.zip


> 
> On Mar 2, 2:01 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Mar 2, 2010, at 11:21 AM, mdipierro wrote:
>> 
>>> What about we give has_membership two arguments (id=None, role=None)
>>> and use the one that is not None?
>> 
>> Works for me. And the reverse for requires_membership?
>> 
>> 
>> 
>>> On Mar 2, 10:45 am, Jonathan Lundell <jlund...@pobox.com> wrote:
>>>> I've been implementing role/permission checking this week, and I'd like to 
>>>> propose an enhancement.
>> 
>>>> requires_membership() takes a role, and unconditionally converts it to a 
>>>> group_id: group_id = self.id_group(role) (and then calls has_membership().
>> 
>>>> has_membership() takes a group_id
>> 
>>>> It's a little confusing, because given the names of the functions, you'd 
>>>> expect them to take the same argument.
>> 
>>>> One potential solution would be to accept either, interpreting the 
>>>> argument as a group_id if it's numeric. There's a small risk of a 
>>>> compatibility break if someone has numeric roles, since the semantics of 
>>>> requires_membership() would change in such a case.
>> 
>>>> Another solution is to add has_role() and requires_role(), to do the 
>>>> obvious thing (requires_role would just be a synonym for 
>>>> requires_membership), but that doesn't fix the _membership inconsistency.
>> 
>>>> Same argument wrt add_membership.


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to