changed in requires which may have fixed issue 1330

This commit is contained in:
mdipierro
2013-02-17 21:30:21 -06:00
parent 55afa0f31d
commit a36366ac61
2 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.1-alpha.2+timestamp.2013.02.17.11.27.22
Version 2.4.1-alpha.2+timestamp.2013.02.17.21.29.36
+9 -6
View File
@@ -2960,8 +2960,9 @@ class Auth(object):
If role is provided instead of group_id then the
group_id is calculated.
"""
return self.requires(lambda: self.has_membership(
group_id=group_id, role=role), otherwise=otherwise)
def has_membership(self=self, group_id=group_id, role=role):
return self.has_membership(group_id=group_id, role=role)
return self.requires(has_membership, otherwise=otherwise)
def requires_permission(self, name, table_name='', record_id=0,
otherwise=None):
@@ -2970,8 +2971,9 @@ class Auth(object):
if user logged in is not a member of any group (role) that
has 'name' access to 'table_name', 'record_id'.
"""
return self.requires(lambda: self.has_permission(
name, table_name, record_id), otherwise=otherwise)
def has_permission(self=self, name=name, table_name=table_name, record_id=record_id):
return self.has_permission(name, table_name, record_id)
return self.requires(has_permission, otherwise=otherwise)
def requires_signature(self, otherwise=None):
"""
@@ -2980,8 +2982,9 @@ class Auth(object):
If role is provided instead of group_id then the
group_id is calculated.
"""
return self.requires(lambda: URL.verify(
current.request, user_signature=True), otherwise=otherwise)
def verify():
return URL.verify(current.request, user_signature=True)
return self.requires(verify, otherwise)
def add_group(self, role, description=''):
"""