[gen] Bugfix: slave groups; bugfix: security check for pod fields; security bugfix for pod fields: write access to the field is required for performing any freeze-related action; migration to Appy 0.9.0: dump frozen pod fields on disk; repaired test system for Appy 0.9.0; more explicit error message when using, on some field, a specific write or read permission that is not used in the workflow.

This commit is contained in:
Gaetan Delannay 2014-05-14 15:10:41 +02:00
parent 61598b91f7
commit b4e6333472
9 changed files with 66 additions and 39 deletions

View file

@ -9,11 +9,6 @@ except ImportError:
# ------------------------------------------------------------------------------
class TestMixin:
'''This class is mixed in with any ZopeTestCase.'''
def changeUser(self, userId):
'''Logs out currently logged user and logs in p_loginName.'''
self.logout()
self.login(userId)
def getNonEmptySubModules(self, moduleName):
'''Returns the list of sub-modules of p_app that are non-empty.'''
res = []
@ -53,16 +48,7 @@ class TestMixin:
for arg in sys.argv:
if arg.startswith('[coverage'):
return arg[10:].strip(']')
return None
def login(self, name='admin'):
user = self.app.acl_users.getUserById(name)
newSecurityManager(None, user)
def logout(self):
'''Logs out.'''
noSecurityManager()
return
def _setup(self): pass
# Functions executed before and after every test -------------------------------
@ -74,7 +60,6 @@ def beforeTest(test):
g['appFolder'] = cfg.diskFolder
moduleOrClassName = g['test'].name # Not used yet.
# Initialize the test
test.login('admin')
g['t'] = g['test']
def afterTest(test):

View file

@ -1201,6 +1201,11 @@ class BaseMixin:
'''Gets, according to the workflow, the roles that are currently granted
p_permission on this object.'''
state = self.State(name=False)
if permission not in state.permissions:
wf = self.getWorkflow().__name__
raise Exception('Permission "%s" not in permissions dict for ' \
'state %s.%s' % \
(permission, wf, self.State(name=True)))
roles = state.permissions[permission]
if roles: return [role.name for role in roles]
return ()