diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-12-01 11:23:52 -0500 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2010-12-01 20:42:31 -0500 |
commit | 4ad8055341b9f12c833abdf757755ed95f1b375e (patch) | |
tree | 1733fffdfe47574f2c5eb723e52f88cd58a7e0a4 /tests/test_xmlrpc/test_taskgroup_plugin.py | |
parent | 85d5bfd1b19b0ed6282a8c6cc056e8e550dde79d (diff) | |
download | freeipa-4ad8055341b9f12c833abdf757755ed95f1b375e.tar.gz freeipa-4ad8055341b9f12c833abdf757755ed95f1b375e.tar.xz freeipa-4ad8055341b9f12c833abdf757755ed95f1b375e.zip |
Re-implement access control using an updated model.
The new model is based on permssions, privileges and roles.
Most importantly it corrects the reverse membership that caused problems
in the previous implementation. You add permission to privileges and
privileges to roles, not the other way around (even though it works that
way behind the scenes).
A permission object is a combination of a simple group and an aci.
The linkage between the aci and the permission is the description of
the permission. This shows as the name/description of the aci.
ldap:///self and groups granting groups (v1-style) are not supported by
this model (it will be provided separately).
This makes the aci plugin internal only.
ticket 445
Diffstat (limited to 'tests/test_xmlrpc/test_taskgroup_plugin.py')
-rw-r--r-- | tests/test_xmlrpc/test_taskgroup_plugin.py | 496 |
1 files changed, 0 insertions, 496 deletions
diff --git a/tests/test_xmlrpc/test_taskgroup_plugin.py b/tests/test_xmlrpc/test_taskgroup_plugin.py deleted file mode 100644 index ce3166020..000000000 --- a/tests/test_xmlrpc/test_taskgroup_plugin.py +++ /dev/null @@ -1,496 +0,0 @@ -# Authors: -# Rob Crittenden <rcritten@redhat.com> -# Pavel Zuna <pzuna@redhat.com> -# -# Copyright (C) 2009 Red Hat -# see file 'COPYING' for use and warranty information -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; version 2 only -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -""" -Test the `ipalib/plugins/taskgroup.py` module. -""" - -from ipalib import api, errors -from tests.test_xmlrpc import objectclasses -from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid - -search = u'test-taskgroup' - -taskgroup1 = u'test-taskgroup-1' -taskgroup1_dn = u'cn=%s,cn=taskgroups,cn=accounts,%s' % ( - taskgroup1, api.env.basedn -) -renamedtaskgroup1 = u'test-taskgroup1' - -taskgroup2 = u'test-taskgroup-2' -taskgroup2_dn = u'cn=%s,cn=taskgroups,cn=accounts,%s' % ( - taskgroup2, api.env.basedn -) - -group1 = u'testgroup1' -group1_dn = u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn) - -rolegroup1 = u'test-rolegroup-1' -rolegroup1_dn = u'cn=%s,cn=rolegroups,cn=accounts,%s' % ( - rolegroup1, api.env.basedn -) - - -class test_taskgroup(Declarative): - - cleanup_commands = [ - ('taskgroup_del', [taskgroup1], {}), - ('taskgroup_del', [taskgroup2], {}), - ('group_del', [group1], {}), - ('rolegroup_del', [rolegroup1], {}), - ] - - tests = [ - - dict( - desc='Try to retrieve non-existent %r' % taskgroup1, - command=('taskgroup_show', [taskgroup1], {}), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Try to update non-existent %r' % taskgroup1, - command=('taskgroup_mod', [taskgroup1], dict(description=u'Foo')), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Try to delete non-existent %r' % taskgroup1, - command=('taskgroup_del', [taskgroup1], {}), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Try to rename non-existent %r' % taskgroup1, - command=('taskgroup_del', [taskgroup1], dict(setattr=u'cn=%s' % renamedtaskgroup1)), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Search for non-existent %r' % taskgroup1, - command=('taskgroup_find', [taskgroup1], {}), - expected=dict( - count=0, - truncated=False, - summary=u'0 taskgroups matched', - result=[], - ), - ), - - - dict( - desc='Create %r' % taskgroup1, - command=( - 'taskgroup_add', [taskgroup1], dict(description=u'Test desc 1') - ), - expected=dict( - value=taskgroup1, - summary=u'Added taskgroup "test-taskgroup-1"', - result=dict( - dn=taskgroup1_dn, - cn=[taskgroup1], - description=[u'Test desc 1'], - objectclass=objectclasses.taskgroup, - ), - ), - ), - - - dict( - desc='Try to create duplicate %r' % taskgroup1, - command=( - 'taskgroup_add', [taskgroup1], dict(description=u'Test desc 1') - ), - expected=errors.DuplicateEntry(), - ), - - - dict( - desc='Create %r' % rolegroup1, - command=('rolegroup_add', [rolegroup1], - dict(description=u'rolegroup desc. 1') - ), - expected=dict( - value=rolegroup1, - summary=u'Added rolegroup "test-rolegroup-1"', - result=dict( - dn=rolegroup1_dn, - cn=[rolegroup1], - description=[u'rolegroup desc. 1'], - objectclass=objectclasses.rolegroup, - ), - ), - ), - - - dict( - desc='Create %r' % group1, - command=( - 'group_add', [group1], dict(description=u'Test group desc 1', - nonposix=True,) - ), - expected=dict( - value=group1, - summary=u'Added group "testgroup1"', - result=dict( - dn=group1_dn, - cn=[group1], - description=[u'Test group desc 1'], - objectclass=objectclasses.group, - ipauniqueid=[fuzzy_uuid], - ), - ), - ), - - - dict( - desc='Add member to %r' % taskgroup1, - command=('taskgroup_add_member', [taskgroup1], - dict(rolegroup=rolegroup1, group=group1) - ), - expected=dict( - completed=2, - failed=dict( - member=dict( - rolegroup=[], - group=[], - user=[], - ), - ), - result={ - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'Test desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - } - ), - ), - - - dict( - desc='Retrieve %r' % taskgroup1, - command=('taskgroup_show', [taskgroup1], {}), - expected=dict( - value=taskgroup1, - summary=None, - result={ - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'Test desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - }, - ), - ), - - - dict( - desc='Search for %r' % taskgroup1, - command=('taskgroup_find', [taskgroup1], {}), - expected=dict( - count=1, - truncated=False, - summary=u'1 taskgroup matched', - result=[ - { - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'Test desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - }, - ], - ), - ), - - - dict( - desc='Search for %r' % search, - command=('taskgroup_find', [search], {}), - expected=dict( - count=1, - truncated=False, - summary=u'1 taskgroup matched', - result=[ - { - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'Test desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - }, - ], - ), - ), - - - dict( - desc='Create %r' % taskgroup2, - command=( - 'taskgroup_add', [taskgroup2], dict(description=u'Test desc 2') - ), - expected=dict( - value=taskgroup2, - summary=u'Added taskgroup "test-taskgroup-2"', - result=dict( - dn=taskgroup2_dn, - cn=[taskgroup2], - description=[u'Test desc 2'], - objectclass=objectclasses.taskgroup, - ), - ), - ), - - - dict( - desc='Search for %r' % taskgroup1, - command=('taskgroup_find', [taskgroup1], {}), - expected=dict( - count=1, - truncated=False, - summary=u'1 taskgroup matched', - result=[ - { - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'Test desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - }, - ], - ), - ), - - - dict( - desc='Search for %r' % search, - command=('taskgroup_find', [search], {}), - expected=dict( - count=2, - truncated=False, - summary=u'2 taskgroups matched', - result=[ - { - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'Test desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - }, - { - 'dn': taskgroup2_dn, - 'cn': [taskgroup2], - 'description': [u'Test desc 2'], - }, - ], - ), - ), - - - dict( - desc='Updated %r' % taskgroup1, - command=( - 'taskgroup_mod', [taskgroup1], dict(description=u'New desc 1') - ), - expected=dict( - value=taskgroup1, - summary=u'Modified taskgroup "test-taskgroup-1"', - result=dict( - cn=[taskgroup1], - description=[u'New desc 1'], - member_rolegroup=[rolegroup1], - member_group=[group1], - - ), - ), - ), - - - dict( - desc='Retrieve %r to verify update' % taskgroup1, - command=('taskgroup_show', [taskgroup1], {}), - expected=dict( - value=taskgroup1, - summary=None, - result={ - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'New desc 1'], - 'member_rolegroup': [rolegroup1], - 'member_group': [group1], - }, - ), - ), - - - dict( - desc='Remove member from %r' % taskgroup1, - command=('taskgroup_remove_member', [taskgroup1], - dict(group=group1), - ), - expected=dict( - completed=1, - failed=dict( - member=dict( - rolegroup=[], - group=[], - user=[], - ), - ), - result={ - 'dn': taskgroup1_dn, - 'cn': [taskgroup1], - 'description': [u'New desc 1'], - 'member_rolegroup': [rolegroup1], - } - ), - ), - - - dict( - desc='Rename %r' % taskgroup1, - command=('taskgroup_mod', [taskgroup1], dict(setattr=u'cn=%s' % renamedtaskgroup1)), - expected=dict( - value=taskgroup1, - result=dict( - cn=[renamedtaskgroup1], - description=[u'New desc 1'], - member_rolegroup=[u'test-rolegroup-1'], - ), - summary=u'Modified taskgroup "%s"' % taskgroup1 - ) - ), - - - dict( - desc='Rename %r back' % renamedtaskgroup1, - command=('taskgroup_mod', [renamedtaskgroup1], dict(setattr=u'cn=%s' % taskgroup1)), - expected=dict( - value=renamedtaskgroup1, - result=dict( - cn=[taskgroup1], - description=[u'New desc 1'], - member_rolegroup=[u'test-rolegroup-1'], - ), - summary=u'Modified taskgroup "%s"' % renamedtaskgroup1 - ) - ), - - - dict( - desc='Delete %r' % taskgroup1, - command=('taskgroup_del', [taskgroup1], {}), - expected=dict( - result=True, - value=taskgroup1, - summary=u'Deleted taskgroup "test-taskgroup-1"', - ) - ), - - - dict( - desc='Try to delete non-existent %r' % taskgroup1, - command=('taskgroup_del', [taskgroup1], {}), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Try to retrieve non-existent %r' % taskgroup1, - command=('taskgroup_show', [group1], {}), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Try to update non-existent %r' % taskgroup1, - command=('taskgroup_mod', [taskgroup1], dict(description=u'Foo')), - expected=errors.NotFound(reason='no such entry'), - ), - - - dict( - desc='Search for %r' % search, - command=('taskgroup_find', [search], {}), - expected=dict( - count=1, - truncated=False, - summary=u'1 taskgroup matched', - result=[ - { - 'dn': taskgroup2_dn, - 'cn': [taskgroup2], - 'description': [u'Test desc 2'], - }, - ], - ), - ), - - - dict( - desc='Delete %r' % taskgroup2, - command=('taskgroup_del', [taskgroup2], {}), - expected=dict( - result=True, - value=taskgroup2, - summary=u'Deleted taskgroup "test-taskgroup-2"', - ) - ), - - - dict( - desc='Search for %r' % search, - command=('taskgroup_find', [search], {}), - expected=dict( - count=0, - truncated=False, - summary=u'0 taskgroups matched', - result=[], - ), - ), - - - dict( - desc='Delete %r' % group1, - command=('group_del', [group1], {}), - expected=dict( - result=True, - value=group1, - summary=u'Deleted group "testgroup1"', - ) - ), - - - dict( - desc='Delete %r' % rolegroup1, - command=('rolegroup_del', [rolegroup1], {}), - expected=dict( - result=True, - value=rolegroup1, - summary=u'Deleted rolegroup "test-rolegroup-1"', - ) - ), - - ] |