示例#1
0
 def test_includes_global_roles(self):
     setRoles(self.portal, TEST_USER_ID, ['Manager', 'Contributor'])
     self.assertEquals(['Authenticated',
                        'user:AuthenticatedUsers',
                        'user:test_user_1_',
                        'Manager',
                        'Anonymous',
                        'Contributor'], get_roles_and_users())
示例#2
0
 def test_anonymous_users_get_anonymous_role_only(self):
     logout()
     self.assertEquals(['Anonymous'], get_roles_and_users())
示例#3
0
 def test_always_includes_anonymous(self):
     john = create(Builder('user'))
     login(self.portal, john.getId())
     self.assertIn('Anonymous', get_roles_and_users())
示例#4
0
 def test_always_includes_authenticated(self):
     john = create(Builder('user'))
     login(self.portal, john.getId())
     self.assertIn('Authenticated', get_roles_and_users())
示例#5
0
 def test_includes_group_ids(self):
     john = create(Builder('user'))
     create(Builder('group').titled('Does').with_members(john))
     login(self.portal, john.getId())
     self.assertIn('user:does', get_roles_and_users())
示例#6
0
 def test_includes_userid(self):
     john = create(Builder('user'))
     login(self.portal, john.getId())
     self.assertIn('user:john.doe', get_roles_and_users())
示例#7
0
def make_allowed_roles_and_users_query(index=u'allowed_roles_and_users'):
    return reduce(Or, map(partial(Eq, index), get_roles_and_users()))