diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-09-12 10:43:44 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-10-30 11:50:04 +0100 |
commit | 7051f510b669277fdddc9b63b0faabc3ba451663 (patch) | |
tree | 71851ada4b817addc7d016c735766692c93d7b78 /ipalib/plugins | |
parent | 7d341937ff1f65c5660278220e4ed09c81bbae64 (diff) | |
download | freeipa-7051f510b669277fdddc9b63b0faabc3ba451663.tar.gz freeipa-7051f510b669277fdddc9b63b0faabc3ba451663.tar.xz freeipa-7051f510b669277fdddc9b63b0faabc3ba451663.zip |
Update Permission and ACI plugins to decorator registration API
Diffstat (limited to 'ipalib/plugins')
-rw-r--r-- | ipalib/plugins/aci.py | 24 | ||||
-rw-r--r-- | ipalib/plugins/permission.py | 30 |
2 files changed, 24 insertions, 30 deletions
diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py index a7f85dd36..76f87aaf8 100644 --- a/ipalib/plugins/aci.py +++ b/ipalib/plugins/aci.py @@ -125,10 +125,13 @@ from ipalib import Flag, Int, Str, StrEnum from ipalib.aci import ACI from ipalib import output from ipalib import _, ngettext +from ipalib.plugable import Registry from ipalib.plugins.baseldap import gen_pkey_only_option from ipapython.ipa_log_manager import * from ipapython.dn import DN +register = Registry() + ACI_NAME_PREFIX_SEP = ":" _type_map = { @@ -419,6 +422,8 @@ _prefix_option = StrEnum('aciprefix', values=_valid_prefix_values, ) + +@register() class aci(Object): """ ACI object. @@ -501,8 +506,8 @@ class aci(Object): ), ) -api.register(aci) +@register() class aci_add(crud.Create): """ Create new ACI. @@ -555,9 +560,8 @@ class aci_add(crud.Create): value=aciname, ) -api.register(aci_add) - +@register() class aci_del(crud.Delete): """ Delete ACI. @@ -597,9 +601,8 @@ class aci_del(crud.Delete): value=aciname, ) -api.register(aci_del) - +@register() class aci_mod(crud.Update): """ Modify ACI. @@ -666,9 +669,8 @@ class aci_mod(crud.Update): value=aciname, ) -api.register(aci_mod) - +@register() class aci_find(crud.Search): """ Search for ACIs. @@ -872,9 +874,8 @@ class aci_find(crud.Search): truncated=False, ) -api.register(aci_find) - +@register() class aci_show(crud.Retrieve): """ Display a single ACI given an ACI name. @@ -914,9 +915,8 @@ class aci_show(crud.Retrieve): value=aciname, ) -api.register(aci_show) - +@register() class aci_rename(crud.Update): """ Rename an ACI. @@ -976,5 +976,3 @@ class aci_rename(crud.Update): result=result, value=kw['newname'], ) - -api.register(aci_rename) diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py index 11819890a..2284dbe4d 100644 --- a/ipalib/plugins/permission.py +++ b/ipalib/plugins/permission.py @@ -20,6 +20,7 @@ from ipalib.plugins.baseldap import * from ipalib import api, _, ngettext from ipalib import Flag, Str, StrEnum +from ipalib.plugable import Registry from ipalib.request import context from ipalib import errors from ipapython.dn import DN, EditableDN @@ -80,6 +81,8 @@ EXAMPLES: ACI_PREFIX=u"permission" +register = Registry() + output_params = ( Str('ipapermissiontype', label=_('Permission Type'), @@ -99,6 +102,8 @@ def filter_options(options, keys): """ return dict((k, options[k]) for k in keys if k in options) + +@register() class permission(LDAPObject): """ Permission object. @@ -194,9 +199,8 @@ class permission(LDAPObject): return dict((k, v) for k, v in options.items() if k in self.aci_attributes) -api.register(permission) - +@register() class permission_add(LDAPCreate): __doc__ = _('Add a new permission.') @@ -251,8 +255,8 @@ class permission_add(LDAPCreate): raise e return dn -api.register(permission_add) +@register() class permission_add_noaci(LDAPCreate): __doc__ = _('Add a system permission without an ACI') @@ -285,9 +289,8 @@ class permission_add_noaci(LDAPCreate): entry_attrs['ipapermissiontype'] = [ permission_type ] return dn -api.register(permission_add_noaci) - +@register() class permission_del(LDAPDelete): __doc__ = _('Delete a permission.') @@ -313,9 +316,8 @@ class permission_del(LDAPDelete): pass return dn -api.register(permission_del) - +@register() class permission_mod(LDAPUpdate): __doc__ = _('Modify a permission.') @@ -403,9 +405,8 @@ class permission_mod(LDAPUpdate): entry_attrs[r] = result[r] return dn -api.register(permission_mod) - +@register() class permission_find(LDAPSearch): __doc__ = _('Search for permissions.') @@ -485,9 +486,8 @@ class permission_find(LDAPSearch): break return truncated -api.register(permission_find) - +@register() class permission_show(LDAPRetrieve): __doc__ = _('Display information about a permission.') @@ -510,22 +510,18 @@ class permission_show(LDAPRetrieve): entry_attrs['attributelevelrights'][attr] = entry_attrs['attributelevelrights']['aci'] return dn -api.register(permission_show) - +@register() class permission_add_member(LDAPAddMember): """ Add members to a permission. """ NO_CLI = True -api.register(permission_add_member) - +@register() class permission_remove_member(LDAPRemoveMember): """ Remove members from a permission. """ NO_CLI = True - -api.register(permission_remove_member) |