예제 #1
0
class host_show(Method):
    __doc__ = _("Display information about a host.")

    takes_args = (
        parameters.Str(
            'fqdn',
            cli_name='hostname',
            label=_(u'Host name'),
            no_convert=True,
        ),
    )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=_(u'Display the access rights of this entry (requires --all). See ipa man page for details.'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'out',
            required=False,
            doc=_(u'file to store certificate in'),
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #2
0
class privilege_add_permission(LDAPAddReverseMember):
    __doc__ = _('Add permissions to a privilege.')

    show_command = 'privilege_show'
    member_command = 'permission_add_member'
    reverse_attr = 'permission'
    member_attr = 'privilege'

    has_output = (
        output.Entry('result'),
        output.Output('failed',
            type=dict,
            doc=_('Members that could not be added'),
        ),
        output.Output('completed',
            type=int,
            doc=_('Number of permissions added'),
        ),
    )

    def pre_callback(self, ldap, dn, *keys, **options):
        if options.get('permission'):
            # We can only add permissions with bind rule type set to
            # "permission" (or old-style permissions)
            validate_permission_to_privilege(self.api, options['permission'])
        return dn
예제 #3
0
class sudorule_remove_deny_command(Method):
    __doc__ = _(
        "Remove commands and sudo command groups affected by Sudo Rule.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='sudorule_name',
        label=_(u'Rule name'),
    ), )
    takes_options = (
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'sudocmd',
            required=False,
            multivalue=True,
            cli_name='sudocmds',
            label=_(u'member sudo command'),
            doc=_(u'comma-separated list of sudo commands to remove'),
            alwaysask=True,
        ),
        parameters.Str(
            'sudocmdgroup',
            required=False,
            multivalue=True,
            cli_name='sudocmdgroups',
            label=_(u'member sudo command group'),
            doc=_(u'comma-separated list of sudo command groups to remove'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry('result', ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be removed'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members removed'),
        ),
    )
예제 #4
0
class automountlocation_add(Method):
    __doc__ = _("Create a new automount location.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='location',
        label=_(u'Location'),
        doc=_(u'Automount location name.'),
    ), )
    takes_options = (
        parameters.Str(
            'setattr',
            required=False,
            multivalue=True,
            doc=
            _(u'Set an attribute to a name/value pair. Format is attr=value.\nFor multi-valued attributes, the command replaces the values already present.'
              ),
            exclude=('webui', ),
        ),
        parameters.Str(
            'addattr',
            required=False,
            multivalue=True,
            doc=
            _(u'Add an attribute/value pair. Format is attr=value. The attribute\nmust be part of the schema.'
              ),
            exclude=('webui', ),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #5
0
class idoverridegroup_show(Method):
    __doc__ = _("Display information about an Group ID override.")

    takes_args = (
        parameters.Str(
            'idviewcn',
            cli_name='idview',
            label=_(u'ID View Name'),
        ),
        parameters.Str(
            'ipaanchoruuid',
            cli_name='anchor',
            label=_(u'Anchor to override'),
        ),
    )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=_(u'Display the access rights of this entry (requires --all). See ipa man page for details.'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'fallback_to_ldap',
            required=False,
            label=_(u'Fallback to AD DC LDAP'),
            doc=_(u'Allow falling back to AD DC LDAP when resolving AD trusted objects. For two-way trusts only.'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #6
0
class selfservice_mod(Method):
    __doc__ = _("Modify a self-service permission.")

    takes_args = (parameters.Str(
        'aciname',
        cli_name='name',
        label=_(u'Self-service name'),
    ), )
    takes_options = (
        parameters.Str(
            'permissions',
            required=False,
            multivalue=True,
            label=_(u'Permissions'),
            doc=
            _(u'Comma-separated list of permissions to grant (read, write). Default is write.'
              ),
        ),
        parameters.Str(
            'attrs',
            required=False,
            multivalue=True,
            label=_(u'Attributes'),
            doc=_(u'Comma-separated list of attributes'),
            no_convert=True,
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #7
0
class hbacrule_add_service(Method):
    __doc__ = _("Add services to an HBAC rule.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='name',
        label=_(u'Rule name'),
    ), )
    takes_options = (
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'hbacsvc',
            required=False,
            multivalue=True,
            cli_name='hbacsvcs',
            label=_(u'member HBAC service'),
            doc=_(u'comma-separated list of HBAC services to add'),
            alwaysask=True,
        ),
        parameters.Str(
            'hbacsvcgroup',
            required=False,
            multivalue=True,
            cli_name='hbacsvcgroups',
            label=_(u'member HBAC service group'),
            doc=_(u'comma-separated list of HBAC service groups to add'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry('result', ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be added'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members added'),
        ),
    )
예제 #8
0
파일: service.py 프로젝트: zz22394/freeipa
class service_add_host(Method):
    __doc__ = _("Add hosts that can manage this service.")

    takes_args = (
        parameters.Str(
            'krbprincipalname',
            cli_name='principal',
            label=_(u'Principal'),
            doc=_(u'Service principal'),
            no_convert=True,
        ),
    )
    takes_options = (
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'host',
            required=False,
            multivalue=True,
            cli_name='hosts',
            label=_(u'member host'),
            doc=_(u'hosts to add'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry(
            'result',
        ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be added'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members added'),
        ),
    )
예제 #9
0
class stageuser_add_manager(Method):
    __doc__ = _("Add a manager to the stage user entry")

    takes_args = (
        parameters.Str(
            'uid',
            cli_name='login',
            label=_(u'User login'),
            default_from=DefaultFrom(lambda givenname, sn: givenname[0] + sn, 'principal'),
            no_convert=True,
        ),
    )
    takes_options = (
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'user',
            required=False,
            multivalue=True,
            cli_name='users',
            label=_(u'member user'),
            doc=_(u'users to add'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry(
            'result',
        ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be added'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members added'),
        ),
    )
예제 #10
0
class automountmap_show(Method):
    __doc__ = _("Display an automount map.")

    takes_args = (
        parameters.Str(
            'automountlocationcn',
            cli_name='automountlocation',
            label=_(u'Location'),
            doc=_(u'Automount location name.'),
        ),
        parameters.Str(
            'automountmapname',
            cli_name='map',
            label=_(u'Map'),
            doc=_(u'Automount map name.'),
        ),
    )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=
            _(u'Display the access rights of this entry (requires --all). See ipa man page for details.'
              ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #11
0
class sudorule_add_runasuser(Method):
    __doc__ = _("Add users and groups for Sudo to execute as.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='sudorule_name',
        label=_(u'Rule name'),
    ), )
    takes_options = (
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'user',
            required=False,
            multivalue=True,
            cli_name='users',
            label=_(u'member user'),
            doc=_(u'comma-separated list of users to add'),
            alwaysask=True,
        ),
        parameters.Str(
            'group',
            required=False,
            multivalue=True,
            cli_name='groups',
            label=_(u'member group'),
            doc=_(u'comma-separated list of groups to add'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry('result', ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be added'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members added'),
        ),
    )
예제 #12
0
class permission_remove_member(Method):
    __doc__ = _("Remove members from a permission.")

    NO_CLI = True

    takes_args = (
        parameters.Str(
            'cn',
            cli_name='name',
            label=_(u'Permission name'),
        ),
    )
    takes_options = (
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'privilege',
            required=False,
            multivalue=True,
            cli_name='privileges',
            label=_(u'member privilege'),
            doc=_(u'privileges to remove'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry(
            'result',
        ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be removed'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members removed'),
        ),
    )
예제 #13
0
class selinuxusermap_remove_host(Method):
    __doc__ = _("Remove target hosts and hostgroups from an SELinux User Map rule.")

    takes_args = (
        parameters.Str(
            'cn',
            cli_name='name',
            label=_(u'Rule name'),
        ),
    )
    takes_options = (
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'host',
            required=False,
            multivalue=True,
            cli_name='hosts',
            label=_(u'member host'),
            doc=_(u'comma-separated list of hosts to remove'),
            alwaysask=True,
        ),
        parameters.Str(
            'hostgroup',
            required=False,
            multivalue=True,
            cli_name='hostgroups',
            label=_(u'member host group'),
            doc=_(u'comma-separated list of host groups to remove'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry(
            'result',
        ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be removed'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members removed'),
        ),
    )
예제 #14
0
class pwpolicy_show(Method):
    __doc__ = _("Display information about password policy.")

    takes_args = (parameters.Str(
        'cn',
        required=False,
        cli_name='group',
        label=_(u'Group'),
        doc=_(u'Manage password policy for specific group'),
    ), )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=
            _(u'Display the access rights of this entry (requires --all). See ipa man page for details.'
              ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'user',
            required=False,
            label=_(u'User'),
            doc=_(u'Display effective policy for a specific user'),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #15
0
class cosentry_add(Method):
    NO_CLI = True

    takes_args = (parameters.Str('cn', ), )
    takes_options = (
        parameters.DNParam('krbpwdpolicyreference', ),
        parameters.Int('cospriority', ),
        parameters.Str(
            'setattr',
            required=False,
            multivalue=True,
            doc=
            _(u'Set an attribute to a name/value pair. Format is attr=value.\nFor multi-valued attributes, the command replaces the values already present.'
              ),
            exclude=('webui', ),
        ),
        parameters.Str(
            'addattr',
            required=False,
            multivalue=True,
            doc=
            _(u'Add an attribute/value pair. Format is attr=value. The attribute\nmust be part of the schema.'
              ),
            exclude=('webui', ),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #16
0
파일: service.py 프로젝트: zz22394/freeipa
class service_add_cert(Method):
    __doc__ = _("Add new certificates to a service")

    takes_args = (
        parameters.Str(
            'krbprincipalname',
            cli_name='principal',
            label=_(u'Principal'),
            doc=_(u'Service principal'),
            no_convert=True,
        ),
    )
    takes_options = (
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Bytes(
            'usercertificate',
            required=False,
            multivalue=True,
            cli_name='certificate',
            label=_(u'Certificate'),
            doc=_(u'Base-64 encoded server certificate'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #17
0
class certprofile_import(Method):
    __doc__ = _("Import a Certificate Profile.")

    takes_args = (
        parameters.Str(
            'cn',
            cli_name='id',
            label=_(u'Profile ID'),
            doc=_(u'Profile ID for referring to this profile'),
        ),
    )
    takes_options = (
        parameters.Str(
            'description',
            cli_name='desc',
            label=_(u'Profile description'),
            doc=_(u'Brief description of this profile'),
        ),
        parameters.Bool(
            'ipacertprofilestoreissued',
            cli_name='store',
            label=_(u'Store issued certificates'),
            doc=_(u'Whether to store certs issued using this profile'),
            default=True,
        ),
        parameters.Str(
            'file',
            label=_(u'Filename of a raw profile. The XML format is not supported.'),
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #18
0
파일: sudorule.py 프로젝트: zz22394/freeipa
class sudorule_remove_runasgroup(Method):
    __doc__ = _("Remove group for Sudo to execute as.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='sudorule_name',
        label=_(u'Rule name'),
    ), )
    takes_options = (
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'group',
            required=False,
            multivalue=True,
            cli_name='groups',
            label=_(u'member group'),
            doc=_(u'groups to remove'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry('result', ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be removed'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members removed'),
        ),
    )
예제 #19
0
파일: caacl.py 프로젝트: zz22394/freeipa
class caacl_add_profile(Method):
    __doc__ = _("Add profiles to a CA ACL.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='name',
        label=_(u'ACL name'),
    ), )
    takes_options = (
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'certprofile',
            required=False,
            multivalue=True,
            cli_name='certprofiles',
            label=_(u'member Certificate Profile'),
            doc=_(u'Certificate Profiles to add'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry('result', ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be added'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members added'),
        ),
    )
예제 #20
0
class otptoken_remove_managedby(Method):
    __doc__ = _("Remove users that can manage this token.")

    takes_args = (parameters.Str(
        'ipatokenuniqueid',
        cli_name='id',
        label=_(u'Unique ID'),
    ), )
    takes_options = (
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'user',
            required=False,
            multivalue=True,
            cli_name='users',
            label=_(u'member user'),
            doc=_(u'users to remove'),
            alwaysask=True,
        ),
    )
    has_output = (
        output.Entry('result', ),
        output.Output(
            'failed',
            dict,
            doc=_(u'Members that could not be removed'),
        ),
        output.Output(
            'completed',
            int,
            doc=_(u'Number of members removed'),
        ),
    )
예제 #21
0
class topologysegment_show(Method):
    __doc__ = _("Display a segment.")

    takes_args = (
        parameters.Str(
            'topologysuffixcn',
            cli_name='topologysuffix',
            label=_(u'Suffix name'),
        ),
        parameters.Str(
            'cn',
            cli_name='name',
            label=_(u'Segment name'),
            doc=_(u'Arbitrary string identifying the segment'),
            default_from=DefaultFrom(lambda iparepltoposegmentleftnode, iparepltoposegmentrightnode: None, 'iparepltoposegmentleftnode', 'iparepltoposegmentrightnode'),
            # FIXME:
            # lambda iparepltoposegmentleftnode, iparepltoposegmentrightnode:
            no_convert=True,
        ),
    )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=_(u'Display the access rights of this entry (requires --all). See ipa man page for details.'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #22
0
class aci_show(Method):
    __doc__ = _("Display a single ACI given an ACI name.")

    NO_CLI = True

    takes_args = (parameters.Str(
        'aciname',
        cli_name='name',
        label=_(u'ACI name'),
    ), )
    takes_options = (
        parameters.Str(
            'aciprefix',
            cli_name='prefix',
            cli_metavar="['permission', 'delegation', 'selfservice', 'none']",
            label=_(u'ACI prefix'),
            doc=
            _(u'Prefix used to distinguish ACI types (permission, delegation, selfservice, none)'
              ),
        ),
        parameters.DNParam(
            'location',
            required=False,
            label=_(u'Location of the ACI'),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #23
0
파일: idviews.py 프로젝트: zz22394/freeipa
class idview_show(Method):
    __doc__ = _("Display information about an ID View.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='name',
        label=_(u'ID View Name'),
    ), )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=
            _(u'Display the access rights of this entry (requires --all). See ipa man page for details.'
              ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'show_hosts',
            required=False,
            doc=_(u'Enumerate all the hosts the view applies to.'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #24
0
class automember_default_group_set(Method):
    __doc__ = _("Set default (fallback) group for all unmatched entries.")

    takes_options = (
        parameters.Str(
            'description',
            required=False,
            cli_name='desc',
            label=_(u'Description'),
            doc=_(u'A description of this auto member rule'),
        ),
        parameters.Str(
            'automemberdefaultgroup',
            cli_name='default_group',
            label=_(u'Default (fallback) Group'),
            doc=_(u'Default (fallback) group for entries to land'),
        ),
        parameters.Str(
            'type',
            cli_metavar="['group', 'hostgroup']",
            label=_(u'Grouping Type'),
            doc=_(u'Grouping to which the rule applies'),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #25
0
class certprofile_show(Method):
    __doc__ = _("Display the properties of a Certificate Profile.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='id',
        label=_(u'Profile ID'),
        doc=_(u'Profile ID for referring to this profile'),
    ), )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=
            _(u'Display the access rights of this entry (requires --all). See ipa man page for details.'
              ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'out',
            required=False,
            doc=_(u'Write profile configuration to file'),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #26
0
class subid_stats(LDAPQuery):
    __doc__ = _("Subordinate id statistics")

    takes_options = ()
    has_output = (
        output.summary,
        output.Entry("result"),
    )

    def get_args(self):
        return ()

    def get_remaining_dna(self, ldap, **options):
        base_dn = DN(self.api.env.container_dna_subordinate_ids,
                     self.api.env.basedn)
        entries, _truncated = ldap.find_entries(
            "(objectClass=dnaSharedConfig)",
            attrs_list=["dnaRemainingValues"],
            base_dn=base_dn,
            scope=ldap.SCOPE_ONELEVEL,
        )
        return sum(
            int(entry.single_value["dnaRemainingValues"]) for entry in entries)

    def get_idrange(self, ldap, **options):
        cn = f"{self.api.env.realm}_subid_range"
        result = self.api.Command.idrange_show(cn, version=options["version"])
        baseid = int(result["result"]["ipabaseid"][0])
        rangesize = int(result["result"]["ipaidrangesize"][0])
        return baseid, rangesize

    def get_subid_assigned(self, ldap, **options):
        dn = DN(self.api.env.container_subids, self.api.env.basedn)
        entry = ldap.get_entry(dn=dn, attrs_list=["numSubordinates"])
        return int(entry.single_value["numSubordinates"])

    def execute(self, *keys, **options):
        ldap = self.obj.backend
        dna_remaining = self.get_remaining_dna(ldap, **options)
        baseid, rangesize = self.get_idrange(ldap, **options)
        assigned_subids = self.get_subid_assigned(ldap, **options)
        remaining_subids = dna_remaining // constants.SUBID_COUNT
        return dict(
            summary=_("%(remaining)i remaining subordinate id ranges") % {
                "remaining": remaining_subids,
            },
            result=dict(
                baseid=baseid,
                rangesize=rangesize,
                dna_remaining=dna_remaining,
                assigned_subids=assigned_subids,
                remaining_subids=remaining_subids,
            ),
        )
예제 #27
0
파일: trust.py 프로젝트: zz22394/freeipa
class trustconfig_show(Method):
    __doc__ = _("Show global trust configuration.")

    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=
            _(u'Display the access rights of this entry (requires --all). See ipa man page for details.'
              ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'trust_type',
            cli_name='type',
            cli_metavar="['ad']",
            label=_(u'Trust type (ad for Active Directory, default)'),
            default=u'ad',
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #28
0
class user_show(Method):
    __doc__ = _("Display information about a user.")

    takes_args = (parameters.Str(
        'uid',
        cli_name='login',
        label=_(u'User login'),
        default_from=DefaultFrom(lambda givenname, sn: givenname[0] + sn,
                                 'principal'),
        no_convert=True,
    ), )
    takes_options = (
        parameters.Flag(
            'rights',
            label=_(u'Rights'),
            doc=
            _(u'Display the access rights of this entry (requires --all). See ipa man page for details.'
              ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #29
0
class permission_add_noaci(Method):
    __doc__ = _("Add a system permission without an ACI (internal command)")

    NO_CLI = True

    takes_args = (
        parameters.Str(
            'cn',
            cli_name='name',
            label=_(u'Permission name'),
        ),
    )
    takes_options = (
        parameters.Str(
            'ipapermissiontype',
            multivalue=True,
            label=_(u'Permission flags'),
        ),
        parameters.Flag(
            'all',
            doc=_(u'Retrieve and print all attributes from the server. Affects command output.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=_(u'Print entries as stored on the server. Only affects output format.'),
            exclude=('webui',),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry(
            'result',
        ),
        output.PrimaryKey(
            'value',
            doc=_(u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
예제 #30
0
파일: sudorule.py 프로젝트: zz22394/freeipa
class sudorule_add_option(Method):
    __doc__ = _("Add an option to the Sudo Rule.")

    takes_args = (parameters.Str(
        'cn',
        cli_name='sudorule_name',
        label=_(u'Rule name'),
    ), )
    takes_options = (
        parameters.Str(
            'ipasudoopt',
            cli_name='sudooption',
            label=_(u'Sudo Option'),
        ),
        parameters.Flag(
            'all',
            doc=
            _(u'Retrieve and print all attributes from the server. Affects command output.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'raw',
            doc=
            _(u'Print entries as stored on the server. Only affects output format.'
              ),
            exclude=('webui', ),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Entry('result', ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )