Exemplo n.º 1
0
class stageuser_remove_manager(Method):
    __doc__ = _("Remove 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 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'),
        ),
    )
Exemplo n.º 2
0
class passwd(Command):
    __doc__ = _("Set a user's password.")

    takes_args = (
        parameters.Str(
            'principal',
            cli_name='user',
            label=_(u'User name'),
            default_from=DefaultFrom(lambda: None),
            # FIXME:
            # lambda: util.get_current_principal()
            autofill=True,
            no_convert=True,
        ),
        parameters.Password(
            'password',
            label=_(u'New Password'),
            confirm=True,
        ),
        parameters.Password(
            'current_password',
            label=_(u'Current Password'),
            default_from=DefaultFrom(lambda principal: None, 'principal'),
            # FIXME:
            # lambda principal: get_current_password(principal)
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Output(
            'result',
            bool,
            doc=_(u'True means the operation was successful'),
        ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
Exemplo n.º 3
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"),
        ),
    )
Exemplo n.º 4
0
class stageuser_show(Method):
    __doc__ = _("Display information about a stage 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,
        ),
        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"),
        ),
    )
Exemplo n.º 5
0
class join(Command):
    __doc__ = _("Join an IPA domain")

    takes_args = (
        parameters.Str(
            'cn',
            cli_name='hostname',
            doc=_(u'The hostname to register as'),
            default_from=DefaultFrom(lambda : None),
            # FIXME:
            # lambda: unicode(installutils.get_fqdn())
            autofill=True,
        ),
    )
    takes_options = (
        parameters.Str(
            'realm',
            doc=_(u'The IPA realm'),
            default_from=DefaultFrom(lambda : None),
            # FIXME:
            # lambda: get_realm()
            autofill=True,
        ),
        parameters.Str(
            'nshardwareplatform',
            required=False,
            cli_name='platform',
            doc=_(u'Hardware platform of the host (e.g. Lenovo T61)'),
        ),
        parameters.Str(
            'nsosversion',
            required=False,
            cli_name='os',
            doc=_(u'Operating System and version of the host (e.g. Fedora 9)'),
        ),
    )
    has_output = (
    )
Exemplo n.º 6
0
class topologysegment_del(Method):
    __doc__ = _("Delete a segment.")

    NO_CLI = True

    takes_args = (
        parameters.Str(
            'topologysuffixcn',
            cli_name='topologysuffix',
            label=_(u'Suffix name'),
        ),
        parameters.Str(
            'cn',
            multivalue=True,
            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(
        'continue',
        doc=_(u"Continuous mode: Don't stop on errors."),
        default=False,
        autofill=True,
    ), )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Output(
            'result',
            dict,
            doc=_(u'List of deletions that failed'),
        ),
        output.ListOfPrimaryKeys('value', ),
    )
Exemplo n.º 7
0
    def _create_default_from(self, api, name, keys):
        cmd_name = self.full_name

        def get_default(*args):
            kw = dict(zip(keys, args))
            result = api.Command.command_defaults(
                unicode(cmd_name),
                params=[unicode(name)],
                kw=kw,
            )['result']
            return result.get(name)

        if keys:
            def callback(*args):
                return get_default(*args)
        else:
            def callback():
                return get_default()

        callback.__name__ = '{0}_{1}_default'.format(self.name, name)

        return DefaultFrom(callback, *keys)
Exemplo n.º 8
0
class user_del(Method):
    __doc__ = _("Delete a user.")

    takes_args = (parameters.Str(
        'uid',
        multivalue=True,
        cli_name='login',
        label=_(u'User login'),
        default_from=DefaultFrom(lambda givenname, sn: givenname[0] + sn,
                                 'principal'),
        no_convert=True,
    ), )
    takes_options = (parameters.Flag(
        'continue',
        doc=_(u"Continuous mode: Don't stop on errors."),
        default=False,
        autofill=True,
    ), )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Output(
            'result',
            dict,
            doc=_(u'List of deletions that failed'),
        ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
Exemplo n.º 9
0
class user_unlock(Method):
    __doc__ = _("""
Unlock a user account

    An account may become locked if the password is entered incorrectly too
    many times within a specific time period as controlled by password
    policy. A locked account is a temporary condition and may be unlocked by
    an administrator.
    """)

    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,
    ), )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Output(
            'result',
            bool,
            doc=_(u'True means the operation was successful'),
        ),
        output.Output(
            'value',
            unicode,
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
Exemplo n.º 10
0
class otptoken_add(Method):
    __doc__ = _("Add a new OTP token.")

    takes_args = (parameters.Str(
        'ipatokenuniqueid',
        required=False,
        cli_name='id',
        label=_(u'Unique ID'),
    ), )
    takes_options = (
        parameters.Str(
            'type',
            required=False,
            cli_metavar="['totp', 'hotp', 'TOTP', 'HOTP']",
            label=_(u'Type'),
            doc=_(u'Type of the token'),
            default=u'totp',
            autofill=True,
        ),
        parameters.Str(
            'description',
            required=False,
            cli_name='desc',
            label=_(u'Description'),
            doc=_(u'Token description (informational only)'),
        ),
        parameters.Str(
            'ipatokenowner',
            required=False,
            cli_name='owner',
            label=_(u'Owner'),
            doc=_(u'Assigned user of the token (default: self)'),
        ),
        parameters.Bool(
            'ipatokendisabled',
            required=False,
            cli_name='disabled',
            label=_(u'Disabled'),
            doc=_(u'Mark the token as disabled (default: false)'),
        ),
        parameters.DateTime(
            'ipatokennotbefore',
            required=False,
            cli_name='not_before',
            label=_(u'Validity start'),
            doc=_(u'First date/time the token can be used'),
        ),
        parameters.DateTime(
            'ipatokennotafter',
            required=False,
            cli_name='not_after',
            label=_(u'Validity end'),
            doc=_(u'Last date/time the token can be used'),
        ),
        parameters.Str(
            'ipatokenvendor',
            required=False,
            cli_name='vendor',
            label=_(u'Vendor'),
            doc=_(u'Token vendor name (informational only)'),
        ),
        parameters.Str(
            'ipatokenmodel',
            required=False,
            cli_name='model',
            label=_(u'Model'),
            doc=_(u'Token model (informational only)'),
        ),
        parameters.Str(
            'ipatokenserial',
            required=False,
            cli_name='serial',
            label=_(u'Serial'),
            doc=_(u'Token serial (informational only)'),
        ),
        parameters.Bytes(
            'ipatokenotpkey',
            required=False,
            cli_name='key',
            label=_(u'Key'),
            doc=_(u'Token secret (Base32; default: random)'),
            default_from=DefaultFrom(lambda: None),
            # FIXME:
            # lambda: os.urandom(KEY_LENGTH)
            autofill=True,
        ),
        parameters.Str(
            'ipatokenotpalgorithm',
            required=False,
            cli_name='algo',
            cli_metavar="['sha1', 'sha256', 'sha384', 'sha512']",
            label=_(u'Algorithm'),
            doc=_(u'Token hash algorithm'),
            default=u'sha1',
            autofill=True,
        ),
        parameters.Int(
            'ipatokenotpdigits',
            required=False,
            cli_name='digits',
            cli_metavar="['6', '8']",
            label=_(u'Digits'),
            doc=_(u'Number of digits each token code will have'),
            default=6,
            autofill=True,
        ),
        parameters.Int(
            'ipatokentotpclockoffset',
            required=False,
            cli_name='offset',
            label=_(u'Clock offset'),
            doc=_(u'TOTP token / IPA server time difference'),
            default=0,
            autofill=True,
        ),
        parameters.Int(
            'ipatokentotptimestep',
            required=False,
            cli_name='interval',
            label=_(u'Clock interval'),
            doc=_(u'Length of TOTP token code validity'),
            default=30,
            autofill=True,
        ),
        parameters.Int(
            'ipatokenhotpcounter',
            required=False,
            cli_name='counter',
            label=_(u'Counter'),
            doc=_(u'Initial counter for the HOTP token'),
            default=0,
            autofill=True,
        ),
        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(
            'qrcode',
            required=False,
            label=_(u'(deprecated)'),
            exclude=('cli', 'webui'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'no_qrcode',
            label=_(u'Do not display QR code'),
            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,
        ),
        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"),
        ),
    )
Exemplo n.º 11
0
class topologysegment_mod(Method):
    __doc__ = _("Modify 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.Str(
            'nsds5replicastripattrs',
            required=False,
            cli_name='stripattrs',
            label=_(u'Attributes to strip'),
            doc=_(u'A space separated list of attributes which are removed from replication updates.'),
            no_convert=True,
        ),
        parameters.Str(
            'nsds5replicatedattributelist',
            required=False,
            cli_name='replattrs',
            label=_(u'Attributes to replicate'),
            doc=_(u'Attributes that are not replicated to a consumer server during a fractional update. E.g., `(objectclass=*) $ EXCLUDE accountlockout memberof'),
        ),
        parameters.Str(
            'nsds5replicatedattributelisttotal',
            required=False,
            cli_name='replattrstotal',
            label=_(u'Attributes for total update'),
            doc=_(u'Attributes that are not replicated to a consumer server during a total update. E.g. (objectclass=*) $ EXCLUDE accountlockout'),
        ),
        parameters.Int(
            'nsds5replicatimeout',
            required=False,
            cli_name='timeout',
            label=_(u'Session timeout'),
            doc=_(u'Number of seconds outbound LDAP operations waits for a response from the remote replica before timing out and failing'),
        ),
        parameters.Str(
            'nsds5replicaenabled',
            required=False,
            cli_name='enabled',
            cli_metavar="['on', 'off']",
            label=_(u'Replication agreement enabled'),
            doc=_(u'Whether a replication agreement is active, meaning whether replication is occurring per that agreement'),
            exclude=('cli', 'webui'),
        ),
        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.Str(
            'delattr',
            required=False,
            multivalue=True,
            doc=_(u'Delete an attribute/value pair. The option will be evaluated\nlast, after all sets and adds.'),
            exclude=('webui',),
        ),
        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"),
        ),
    )
Exemplo n.º 12
0
class topologysegment_find(Method):
    __doc__ = _("Search for topology segments.")

    takes_args = (
        parameters.Str(
            'topologysuffixcn',
            cli_name='topologysuffix',
            label=_(u'Suffix name'),
        ),
        parameters.Str(
            'criteria',
            required=False,
            doc=_(u'A string searched in all relevant object attributes'),
        ),
    )
    takes_options = (
        parameters.Str(
            'cn',
            required=False,
            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,
        ),
        parameters.Str(
            'iparepltoposegmentleftnode',
            required=False,
            cli_name='leftnode',
            label=_(u'Left node'),
            doc=_(u'Left replication node - an IPA server'),
            no_convert=True,
        ),
        parameters.Str(
            'iparepltoposegmentrightnode',
            required=False,
            cli_name='rightnode',
            label=_(u'Right node'),
            doc=_(u'Right replication node - an IPA server'),
            no_convert=True,
        ),
        parameters.Str(
            'iparepltoposegmentdirection',
            required=False,
            cli_name='direction',
            cli_metavar="['both', 'left-right', 'right-left']",
            label=_(u'Connectivity'),
            doc=_(u'Direction of replication between left and right replication node'),
            exclude=('cli', 'webui'),
            default=u'both',
        ),
        parameters.Str(
            'nsds5replicastripattrs',
            required=False,
            cli_name='stripattrs',
            label=_(u'Attributes to strip'),
            doc=_(u'A space separated list of attributes which are removed from replication updates.'),
            no_convert=True,
        ),
        parameters.Str(
            'nsds5replicatedattributelist',
            required=False,
            cli_name='replattrs',
            label=_(u'Attributes to replicate'),
            doc=_(u'Attributes that are not replicated to a consumer server during a fractional update. E.g., `(objectclass=*) $ EXCLUDE accountlockout memberof'),
        ),
        parameters.Str(
            'nsds5replicatedattributelisttotal',
            required=False,
            cli_name='replattrstotal',
            label=_(u'Attributes for total update'),
            doc=_(u'Attributes that are not replicated to a consumer server during a total update. E.g. (objectclass=*) $ EXCLUDE accountlockout'),
        ),
        parameters.Int(
            'nsds5replicatimeout',
            required=False,
            cli_name='timeout',
            label=_(u'Session timeout'),
            doc=_(u'Number of seconds outbound LDAP operations waits for a response from the remote replica before timing out and failing'),
        ),
        parameters.Str(
            'nsds5replicaenabled',
            required=False,
            cli_name='enabled',
            cli_metavar="['on', 'off']",
            label=_(u'Replication agreement enabled'),
            doc=_(u'Whether a replication agreement is active, meaning whether replication is occurring per that agreement'),
            exclude=('cli', 'webui'),
        ),
        parameters.Int(
            'timelimit',
            required=False,
            label=_(u'Time Limit'),
            doc=_(u'Time limit of search in seconds (0 is unlimited)'),
        ),
        parameters.Int(
            'sizelimit',
            required=False,
            label=_(u'Size Limit'),
            doc=_(u'Maximum number of entries returned (0 is unlimited)'),
        ),
        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(
            'pkey_only',
            required=False,
            label=_(u'Primary key only'),
            doc=_(u'Results should contain primary key attribute only ("name")'),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.ListOfEntries(
            'result',
        ),
        output.Output(
            'count',
            int,
            doc=_(u'Number of entries returned'),
        ),
        output.Output(
            'truncated',
            bool,
            doc=_(u'True if not all results were returned'),
        ),
    )
Exemplo n.º 13
0
class stageuser_add(Method):
    __doc__ = _("Add a new stage 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.Str(
            'givenname',
            cli_name='first',
            label=_(u'First name'),
        ),
        parameters.Str(
            'sn',
            cli_name='last',
            label=_(u'Last name'),
        ),
        parameters.Str(
            'cn',
            label=_(u'Full name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
            autofill=True,
        ),
        parameters.Str(
            'displayname',
            required=False,
            label=_(u'Display name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
            autofill=True,
        ),
        parameters.Str(
            'initials',
            required=False,
            label=_(u'Initials'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%c%c' % (givenname[0], sn[0]),
                'principal'),
            autofill=True,
        ),
        parameters.Str(
            'homedirectory',
            required=False,
            cli_name='homedir',
            label=_(u'Home directory'),
        ),
        parameters.Str(
            'gecos',
            required=False,
            label=_(u'GECOS'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
            autofill=True,
        ),
        parameters.Str(
            'loginshell',
            required=False,
            cli_name='shell',
            label=_(u'Login shell'),
        ),
        parameters.Str(
            'krbprincipalname',
            required=False,
            cli_name='principal',
            label=_(u'Kerberos principal'),
            default_from=DefaultFrom(
                lambda uid: '%s@%s' % (uid.lower(), api.env.realm),
                'principal'),
            autofill=True,
            no_convert=True,
        ),
        parameters.DateTime(
            'krbprincipalexpiration',
            required=False,
            cli_name='principal_expiration',
            label=_(u'Kerberos principal expiration'),
        ),
        parameters.Str(
            'mail',
            required=False,
            multivalue=True,
            cli_name='email',
            label=_(u'Email address'),
        ),
        parameters.Password(
            'userpassword',
            required=False,
            cli_name='password',
            label=_(u'Password'),
            doc=_(u'Prompt to set the user password'),
            exclude=('webui', ),
            confirm=True,
        ),
        parameters.Flag(
            'random',
            required=False,
            doc=_(u'Generate a random user password'),
            default=False,
            autofill=True,
        ),
        parameters.Int(
            'uidnumber',
            required=False,
            cli_name='uid',
            label=_(u'UID'),
            doc=_(u'User ID Number (system will assign one if not provided)'),
        ),
        parameters.Int(
            'gidnumber',
            required=False,
            label=_(u'GID'),
            doc=_(u'Group ID Number'),
        ),
        parameters.Str(
            'street',
            required=False,
            label=_(u'Street address'),
        ),
        parameters.Str(
            'l',
            required=False,
            cli_name='city',
            label=_(u'City'),
        ),
        parameters.Str(
            'st',
            required=False,
            cli_name='state',
            label=_(u'State/Province'),
        ),
        parameters.Str(
            'postalcode',
            required=False,
            label=_(u'ZIP'),
        ),
        parameters.Str(
            'telephonenumber',
            required=False,
            multivalue=True,
            cli_name='phone',
            label=_(u'Telephone Number'),
        ),
        parameters.Str(
            'mobile',
            required=False,
            multivalue=True,
            label=_(u'Mobile Telephone Number'),
        ),
        parameters.Str(
            'pager',
            required=False,
            multivalue=True,
            label=_(u'Pager Number'),
        ),
        parameters.Str(
            'facsimiletelephonenumber',
            required=False,
            multivalue=True,
            cli_name='fax',
            label=_(u'Fax Number'),
        ),
        parameters.Str(
            'ou',
            required=False,
            cli_name='orgunit',
            label=_(u'Org. Unit'),
        ),
        parameters.Str(
            'title',
            required=False,
            label=_(u'Job Title'),
        ),
        parameters.Str(
            'manager',
            required=False,
            label=_(u'Manager'),
        ),
        parameters.Str(
            'carlicense',
            required=False,
            multivalue=True,
            label=_(u'Car License'),
        ),
        parameters.Str(
            'ipasshpubkey',
            required=False,
            multivalue=True,
            cli_name='sshpubkey',
            label=_(u'SSH public key'),
            no_convert=True,
        ),
        parameters.Str(
            'ipauserauthtype',
            required=False,
            multivalue=True,
            cli_name='user_auth_type',
            cli_metavar="['password', 'radius', 'otp']",
            label=_(u'User authentication types'),
            doc=_(u'Types of supported user authentication'),
        ),
        parameters.Str(
            'userclass',
            required=False,
            multivalue=True,
            cli_name='class',
            label=_(u'Class'),
            doc=
            _(u'User category (semantics placed on this attribute are for local interpretation)'
              ),
        ),
        parameters.Str(
            'ipatokenradiusconfiglink',
            required=False,
            cli_name='radius',
            label=_(u'RADIUS proxy configuration'),
        ),
        parameters.Str(
            'ipatokenradiususername',
            required=False,
            cli_name='radius_username',
            label=_(u'RADIUS proxy username'),
        ),
        parameters.Str(
            'departmentnumber',
            required=False,
            multivalue=True,
            label=_(u'Department Number'),
        ),
        parameters.Str(
            'employeenumber',
            required=False,
            label=_(u'Employee Number'),
        ),
        parameters.Str(
            'employeetype',
            required=False,
            label=_(u'Employee Type'),
        ),
        parameters.Str(
            'preferredlanguage',
            required=False,
            label=_(u'Preferred Language'),
        ),
        parameters.Bytes(
            'usercertificate',
            required=False,
            multivalue=True,
            cli_name='certificate',
            label=_(u'Certificate'),
            doc=_(u'Base-64 encoded server certificate'),
        ),
        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.Bool(
            'from_delete',
            required=False,
            deprecated=True,
            doc=_(u'Create Stage user in from a delete user'),
            exclude=('cli', 'webui'),
            default=False,
        ),
        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"),
        ),
    )
Exemplo n.º 14
0
class topologysegment_reinitialize(Method):
    __doc__ = _(
        "Request a full re-initialization of the node retrieving data from the other node."
    )

    NO_CLI = True

    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(
            'left',
            required=False,
            doc=_(u'Initialize left node'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'right',
            required=False,
            doc=_(u'Initialize right node'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'stop',
            required=False,
            doc=_(u'Stop already started refresh of chosen node(s)'),
            default=False,
            autofill=True,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.Output(
            'result',
            bool,
            doc=_(u'True means the operation was successful'),
        ),
        output.PrimaryKey(
            'value',
            doc=_(
                u"The primary_key value of the entry, e.g. 'jdoe' for a user"),
        ),
    )
Exemplo n.º 15
0
class netgroup_find(Method):
    __doc__ = _("Search for a netgroup.")

    takes_args = (parameters.Str(
        'criteria',
        required=False,
        doc=_(u'A string searched in all relevant object attributes'),
    ), )
    takes_options = (
        parameters.Str(
            'cn',
            required=False,
            cli_name='name',
            label=_(u'Netgroup name'),
            no_convert=True,
        ),
        parameters.Str(
            'description',
            required=False,
            cli_name='desc',
            label=_(u'Description'),
            doc=_(u'Netgroup description'),
        ),
        parameters.Str(
            'nisdomainname',
            required=False,
            cli_name='nisdomain',
            label=_(u'NIS domain name'),
        ),
        parameters.Str(
            'ipauniqueid',
            required=False,
            cli_name='uuid',
            label=_(u'IPA unique ID'),
            doc=_(u'IPA unique ID'),
        ),
        parameters.Str(
            'usercategory',
            required=False,
            cli_name='usercat',
            cli_metavar="['all']",
            label=_(u'User category'),
            doc=_(u'User category the rule applies to'),
        ),
        parameters.Str(
            'hostcategory',
            required=False,
            cli_name='hostcat',
            cli_metavar="['all']",
            label=_(u'Host category'),
            doc=_(u'Host category the rule applies to'),
        ),
        parameters.Str(
            'externalhost',
            required=False,
            multivalue=True,
            label=_(u'External host'),
            exclude=('cli', 'webui'),
        ),
        parameters.Int(
            'timelimit',
            required=False,
            label=_(u'Time Limit'),
            doc=_(u'Time limit of search in seconds (0 is unlimited)'),
        ),
        parameters.Int(
            'sizelimit',
            required=False,
            label=_(u'Size Limit'),
            doc=_(u'Maximum number of entries returned (0 is unlimited)'),
        ),
        parameters.Flag(
            'private',
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'managed',
            doc=_(u'search for managed groups'),
            default=False,
            default_from=DefaultFrom(lambda private: private),
            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,
        ),
        parameters.Flag(
            'no_members',
            doc=_(u'Suppress processing of membership attributes.'),
            exclude=('webui', 'cli'),
            default=False,
            autofill=True,
        ),
        parameters.Flag(
            'pkey_only',
            required=False,
            label=_(u'Primary key only'),
            doc=_(
                u'Results should contain primary key attribute only ("name")'),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'netgroup',
            required=False,
            multivalue=True,
            cli_name='netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for netgroups with these member netgroups.'),
        ),
        parameters.Str(
            'no_netgroup',
            required=False,
            multivalue=True,
            cli_name='no_netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for netgroups without these member netgroups.'),
        ),
        parameters.Str(
            'user',
            required=False,
            multivalue=True,
            cli_name='users',
            label=_(u'user'),
            doc=_(u'Search for netgroups with these member users.'),
        ),
        parameters.Str(
            'no_user',
            required=False,
            multivalue=True,
            cli_name='no_users',
            label=_(u'user'),
            doc=_(u'Search for netgroups without these member users.'),
        ),
        parameters.Str(
            'group',
            required=False,
            multivalue=True,
            cli_name='groups',
            label=_(u'group'),
            doc=_(u'Search for netgroups with these member groups.'),
        ),
        parameters.Str(
            'no_group',
            required=False,
            multivalue=True,
            cli_name='no_groups',
            label=_(u'group'),
            doc=_(u'Search for netgroups without these member groups.'),
        ),
        parameters.Str(
            'host',
            required=False,
            multivalue=True,
            cli_name='hosts',
            label=_(u'host'),
            doc=_(u'Search for netgroups with these member hosts.'),
        ),
        parameters.Str(
            'no_host',
            required=False,
            multivalue=True,
            cli_name='no_hosts',
            label=_(u'host'),
            doc=_(u'Search for netgroups without these member hosts.'),
        ),
        parameters.Str(
            'hostgroup',
            required=False,
            multivalue=True,
            cli_name='hostgroups',
            label=_(u'host group'),
            doc=_(u'Search for netgroups with these member host groups.'),
        ),
        parameters.Str(
            'no_hostgroup',
            required=False,
            multivalue=True,
            cli_name='no_hostgroups',
            label=_(u'host group'),
            doc=_(u'Search for netgroups without these member host groups.'),
        ),
        parameters.Str(
            'in_netgroup',
            required=False,
            multivalue=True,
            cli_name='in_netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for netgroups with these member of netgroups.'),
        ),
        parameters.Str(
            'not_in_netgroup',
            required=False,
            multivalue=True,
            cli_name='not_in_netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for netgroups without these member of netgroups.'),
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.ListOfEntries('result', ),
        output.Output(
            'count',
            int,
            doc=_(u'Number of entries returned'),
        ),
        output.Output(
            'truncated',
            bool,
            doc=_(u'True if not all results were returned'),
        ),
    )
Exemplo n.º 16
0
class user_mod(Method):
    __doc__ = _("Modify 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.Str(
            'givenname',
            required=False,
            cli_name='first',
            label=_(u'First name'),
        ),
        parameters.Str(
            'sn',
            required=False,
            cli_name='last',
            label=_(u'Last name'),
        ),
        parameters.Str(
            'cn',
            required=False,
            label=_(u'Full name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'displayname',
            required=False,
            label=_(u'Display name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'initials',
            required=False,
            label=_(u'Initials'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%c%c' % (givenname[0], sn[0]),
                'principal'),
        ),
        parameters.Str(
            'homedirectory',
            required=False,
            cli_name='homedir',
            label=_(u'Home directory'),
        ),
        parameters.Str(
            'gecos',
            required=False,
            label=_(u'GECOS field'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'loginshell',
            required=False,
            cli_name='shell',
            label=_(u'Login shell'),
        ),
        parameters.Str(
            'mail',
            required=False,
            multivalue=True,
            cli_name='email',
            label=_(u'Email address'),
        ),
        parameters.Password(
            'userpassword',
            required=False,
            cli_name='password',
            label=_(u'Password'),
            doc=_(u'Prompt to set the user password'),
            exclude=('webui', ),
            confirm=True,
        ),
        parameters.Flag(
            'random',
            required=False,
            doc=_(u'Generate a random user password'),
            default=False,
            autofill=True,
        ),
        parameters.Int(
            'uidnumber',
            required=False,
            cli_name='uid',
            label=_(u'UID'),
            doc=_(u'User ID Number (system will assign one if not provided)'),
            default=999,
        ),
        parameters.Int(
            'gidnumber',
            required=False,
            label=_(u'GID'),
            doc=_(u'Group ID Number'),
            default=999,
        ),
        parameters.Str(
            'street',
            required=False,
            label=_(u'Street address'),
        ),
        parameters.Str(
            'l',
            required=False,
            cli_name='city',
            label=_(u'City'),
        ),
        parameters.Str(
            'st',
            required=False,
            cli_name='state',
            label=_(u'State/Province'),
        ),
        parameters.Str(
            'postalcode',
            required=False,
            label=_(u'ZIP'),
        ),
        parameters.Str(
            'telephonenumber',
            required=False,
            multivalue=True,
            cli_name='phone',
            label=_(u'Telephone Number'),
        ),
        parameters.Str(
            'mobile',
            required=False,
            multivalue=True,
            label=_(u'Mobile Telephone Number'),
        ),
        parameters.Str(
            'pager',
            required=False,
            multivalue=True,
            label=_(u'Pager Number'),
        ),
        parameters.Str(
            'facsimiletelephonenumber',
            required=False,
            multivalue=True,
            cli_name='fax',
            label=_(u'Fax Number'),
        ),
        parameters.Str(
            'ou',
            required=False,
            cli_name='orgunit',
            label=_(u'Org. Unit'),
        ),
        parameters.Str(
            'title',
            required=False,
            label=_(u'Job Title'),
        ),
        parameters.Str(
            'manager',
            required=False,
            label=_(u'Manager'),
        ),
        parameters.Str(
            'carlicense',
            required=False,
            label=_(u'Car License'),
        ),
        parameters.Bool(
            'nsaccountlock',
            required=False,
            label=_(u'Account disabled'),
            exclude=('cli', 'webui'),
        ),
        parameters.Str(
            'ipasshpubkey',
            required=False,
            multivalue=True,
            cli_name='sshpubkey',
            label=_(u'SSH public key'),
            no_convert=True,
        ),
        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.Str(
            'delattr',
            required=False,
            multivalue=True,
            doc=
            _(u'Delete an attribute/value pair. The option will be evaluated\nlast, after all sets and adds.'
              ),
            exclude=('webui', ),
        ),
        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,
        ),
        parameters.Str(
            'rename',
            required=False,
            label=_(u'Rename'),
            doc=_(u'Rename the user object'),
            default_from=DefaultFrom(lambda givenname, sn: givenname[0] + sn,
                                     'principal'),
            no_convert=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"),
        ),
    )
Exemplo n.º 17
0
class user_find(Method):
    __doc__ = _("Search for users.")

    takes_args = (parameters.Str(
        'criteria',
        required=False,
        doc=_(u'A string searched in all relevant object attributes'),
    ), )
    takes_options = (
        parameters.Str(
            'uid',
            required=False,
            cli_name='login',
            label=_(u'User login'),
            default_from=DefaultFrom(lambda givenname, sn: givenname[0] + sn,
                                     'principal'),
            no_convert=True,
        ),
        parameters.Str(
            'givenname',
            required=False,
            cli_name='first',
            label=_(u'First name'),
        ),
        parameters.Str(
            'sn',
            required=False,
            cli_name='last',
            label=_(u'Last name'),
        ),
        parameters.Str(
            'cn',
            required=False,
            label=_(u'Full name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'displayname',
            required=False,
            label=_(u'Display name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'initials',
            required=False,
            label=_(u'Initials'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%c%c' % (givenname[0], sn[0]),
                'principal'),
        ),
        parameters.Str(
            'homedirectory',
            required=False,
            cli_name='homedir',
            label=_(u'Home directory'),
        ),
        parameters.Str(
            'gecos',
            required=False,
            label=_(u'GECOS field'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'loginshell',
            required=False,
            cli_name='shell',
            label=_(u'Login shell'),
        ),
        parameters.Str(
            'krbprincipalname',
            required=False,
            cli_name='principal',
            label=_(u'Kerberos principal'),
            default_from=DefaultFrom(
                lambda uid: '%s@%s' % (uid.lower(), api.env.realm),
                'principal'),
            no_convert=True,
        ),
        parameters.Str(
            'mail',
            required=False,
            multivalue=True,
            cli_name='email',
            label=_(u'Email address'),
        ),
        parameters.Password(
            'userpassword',
            required=False,
            cli_name='password',
            label=_(u'Password'),
            doc=_(u'Prompt to set the user password'),
            exclude=('webui', ),
            confirm=True,
        ),
        parameters.Int(
            'uidnumber',
            required=False,
            cli_name='uid',
            label=_(u'UID'),
            doc=_(u'User ID Number (system will assign one if not provided)'),
            default=999,
        ),
        parameters.Int(
            'gidnumber',
            required=False,
            label=_(u'GID'),
            doc=_(u'Group ID Number'),
            default=999,
        ),
        parameters.Str(
            'street',
            required=False,
            label=_(u'Street address'),
        ),
        parameters.Str(
            'l',
            required=False,
            cli_name='city',
            label=_(u'City'),
        ),
        parameters.Str(
            'st',
            required=False,
            cli_name='state',
            label=_(u'State/Province'),
        ),
        parameters.Str(
            'postalcode',
            required=False,
            label=_(u'ZIP'),
        ),
        parameters.Str(
            'telephonenumber',
            required=False,
            multivalue=True,
            cli_name='phone',
            label=_(u'Telephone Number'),
        ),
        parameters.Str(
            'mobile',
            required=False,
            multivalue=True,
            label=_(u'Mobile Telephone Number'),
        ),
        parameters.Str(
            'pager',
            required=False,
            multivalue=True,
            label=_(u'Pager Number'),
        ),
        parameters.Str(
            'facsimiletelephonenumber',
            required=False,
            multivalue=True,
            cli_name='fax',
            label=_(u'Fax Number'),
        ),
        parameters.Str(
            'ou',
            required=False,
            cli_name='orgunit',
            label=_(u'Org. Unit'),
        ),
        parameters.Str(
            'title',
            required=False,
            label=_(u'Job Title'),
        ),
        parameters.Str(
            'manager',
            required=False,
            label=_(u'Manager'),
        ),
        parameters.Str(
            'carlicense',
            required=False,
            label=_(u'Car License'),
        ),
        parameters.Bool(
            'nsaccountlock',
            required=False,
            label=_(u'Account disabled'),
            exclude=('cli', 'webui'),
        ),
        parameters.Int(
            'timelimit',
            required=False,
            label=_(u'Time Limit'),
            doc=_(u'Time limit of search in seconds'),
        ),
        parameters.Int(
            'sizelimit',
            required=False,
            label=_(u'Size Limit'),
            doc=_(u'Maximum number of entries returned'),
        ),
        parameters.Flag(
            'whoami',
            label=_(u'Self'),
            doc=_(u'Display user record for current Kerberos principal'),
            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,
        ),
        parameters.Flag(
            'pkey_only',
            required=False,
            label=_(u'Primary key only'),
            doc=_(
                u'Results should contain primary key attribute only ("login")'
            ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'in_group',
            required=False,
            multivalue=True,
            cli_name='in_groups',
            label=_(u'group'),
            doc=_(u'Search for users with these member of groups.'),
        ),
        parameters.Str(
            'not_in_group',
            required=False,
            multivalue=True,
            cli_name='not_in_groups',
            label=_(u'group'),
            doc=_(u'Search for users without these member of groups.'),
        ),
        parameters.Str(
            'in_netgroup',
            required=False,
            multivalue=True,
            cli_name='in_netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for users with these member of netgroups.'),
        ),
        parameters.Str(
            'not_in_netgroup',
            required=False,
            multivalue=True,
            cli_name='not_in_netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for users without these member of netgroups.'),
        ),
        parameters.Str(
            'in_role',
            required=False,
            multivalue=True,
            cli_name='in_roles',
            label=_(u'role'),
            doc=_(u'Search for users with these member of roles.'),
        ),
        parameters.Str(
            'not_in_role',
            required=False,
            multivalue=True,
            cli_name='not_in_roles',
            label=_(u'role'),
            doc=_(u'Search for users without these member of roles.'),
        ),
        parameters.Str(
            'in_hbacrule',
            required=False,
            multivalue=True,
            cli_name='in_hbacrules',
            label=_(u'HBAC rule'),
            doc=_(u'Search for users with these member of HBAC rules.'),
        ),
        parameters.Str(
            'not_in_hbacrule',
            required=False,
            multivalue=True,
            cli_name='not_in_hbacrules',
            label=_(u'HBAC rule'),
            doc=_(u'Search for users without these member of HBAC rules.'),
        ),
        parameters.Str(
            'in_sudorule',
            required=False,
            multivalue=True,
            cli_name='in_sudorules',
            label=_(u'sudo rule'),
            doc=_(u'Search for users with these member of sudo rules.'),
        ),
        parameters.Str(
            'not_in_sudorule',
            required=False,
            multivalue=True,
            cli_name='not_in_sudorules',
            label=_(u'sudo rule'),
            doc=_(u'Search for users without these member of sudo rules.'),
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.ListOfEntries('result', ),
        output.Output(
            'count',
            int,
            doc=_(u'Number of entries returned'),
        ),
        output.Output(
            'truncated',
            bool,
            doc=_(u'True if not all results were returned'),
        ),
    )
Exemplo n.º 18
0
class user_status(Method):
    __doc__ = _("""
Lockout status of a user account

    An account may become locked if the password is entered incorrectly too
    many times within a specific time period as controlled by password
    policy. A locked account is a temporary condition and may be unlocked by
    an administrator.

    This connects to each IPA master and displays the lockout status on
    each one.

    To determine whether an account is locked on a given server you need
    to compare the number of failed logins and the time of the last failure.
    For an account to be locked it must exceed the maxfail failures within
    the failinterval duration as specified in the password policy associated
    with the user.

    The failed login counter is modified only when a user attempts a log in
    so it is possible that an account may appear locked but the last failed
    login attempt is older than the lockouttime of the password policy. This
    means that the user may attempt a login again.
    """)

    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,
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.ListOfEntries('result', ),
        output.Output(
            'count',
            int,
            doc=_(u'Number of entries returned'),
        ),
        output.Output(
            'truncated',
            bool,
            doc=_(u'True if not all results were returned'),
        ),
    )
Exemplo n.º 19
0
class stageuser_find(Method):
    __doc__ = _("Search for stage users.")

    takes_args = (parameters.Str(
        'criteria',
        required=False,
        doc=_(u'A string searched in all relevant object attributes'),
    ), )
    takes_options = (
        parameters.Str(
            'uid',
            required=False,
            cli_name='login',
            label=_(u'User login'),
            default_from=DefaultFrom(lambda givenname, sn: givenname[0] + sn,
                                     'principal'),
            no_convert=True,
        ),
        parameters.Str(
            'givenname',
            required=False,
            cli_name='first',
            label=_(u'First name'),
        ),
        parameters.Str(
            'sn',
            required=False,
            cli_name='last',
            label=_(u'Last name'),
        ),
        parameters.Str(
            'cn',
            required=False,
            label=_(u'Full name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'displayname',
            required=False,
            label=_(u'Display name'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'initials',
            required=False,
            label=_(u'Initials'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%c%c' % (givenname[0], sn[0]),
                'principal'),
        ),
        parameters.Str(
            'homedirectory',
            required=False,
            cli_name='homedir',
            label=_(u'Home directory'),
        ),
        parameters.Str(
            'gecos',
            required=False,
            label=_(u'GECOS'),
            default_from=DefaultFrom(
                lambda givenname, sn: '%s %s' % (givenname, sn), 'principal'),
        ),
        parameters.Str(
            'loginshell',
            required=False,
            cli_name='shell',
            label=_(u'Login shell'),
        ),
        parameters.Str(
            'krbprincipalname',
            required=False,
            cli_name='principal',
            label=_(u'Kerberos principal'),
            default_from=DefaultFrom(
                lambda uid: '%s@%s' % (uid.lower(), api.env.realm),
                'principal'),
            no_convert=True,
        ),
        parameters.DateTime(
            'krbprincipalexpiration',
            required=False,
            cli_name='principal_expiration',
            label=_(u'Kerberos principal expiration'),
        ),
        parameters.Str(
            'mail',
            required=False,
            multivalue=True,
            cli_name='email',
            label=_(u'Email address'),
        ),
        parameters.Password(
            'userpassword',
            required=False,
            cli_name='password',
            label=_(u'Password'),
            doc=_(u'Prompt to set the user password'),
            exclude=('webui', ),
            confirm=True,
        ),
        parameters.Int(
            'uidnumber',
            required=False,
            cli_name='uid',
            label=_(u'UID'),
            doc=_(u'User ID Number (system will assign one if not provided)'),
        ),
        parameters.Int(
            'gidnumber',
            required=False,
            label=_(u'GID'),
            doc=_(u'Group ID Number'),
        ),
        parameters.Str(
            'street',
            required=False,
            label=_(u'Street address'),
        ),
        parameters.Str(
            'l',
            required=False,
            cli_name='city',
            label=_(u'City'),
        ),
        parameters.Str(
            'st',
            required=False,
            cli_name='state',
            label=_(u'State/Province'),
        ),
        parameters.Str(
            'postalcode',
            required=False,
            label=_(u'ZIP'),
        ),
        parameters.Str(
            'telephonenumber',
            required=False,
            multivalue=True,
            cli_name='phone',
            label=_(u'Telephone Number'),
        ),
        parameters.Str(
            'mobile',
            required=False,
            multivalue=True,
            label=_(u'Mobile Telephone Number'),
        ),
        parameters.Str(
            'pager',
            required=False,
            multivalue=True,
            label=_(u'Pager Number'),
        ),
        parameters.Str(
            'facsimiletelephonenumber',
            required=False,
            multivalue=True,
            cli_name='fax',
            label=_(u'Fax Number'),
        ),
        parameters.Str(
            'ou',
            required=False,
            cli_name='orgunit',
            label=_(u'Org. Unit'),
        ),
        parameters.Str(
            'title',
            required=False,
            label=_(u'Job Title'),
        ),
        parameters.Str(
            'manager',
            required=False,
            label=_(u'Manager'),
        ),
        parameters.Str(
            'carlicense',
            required=False,
            multivalue=True,
            label=_(u'Car License'),
        ),
        parameters.Str(
            'ipauserauthtype',
            required=False,
            multivalue=True,
            cli_name='user_auth_type',
            cli_metavar="['password', 'radius', 'otp']",
            label=_(u'User authentication types'),
            doc=_(u'Types of supported user authentication'),
        ),
        parameters.Str(
            'userclass',
            required=False,
            multivalue=True,
            cli_name='class',
            label=_(u'Class'),
            doc=
            _(u'User category (semantics placed on this attribute are for local interpretation)'
              ),
        ),
        parameters.Str(
            'ipatokenradiusconfiglink',
            required=False,
            cli_name='radius',
            label=_(u'RADIUS proxy configuration'),
        ),
        parameters.Str(
            'ipatokenradiususername',
            required=False,
            cli_name='radius_username',
            label=_(u'RADIUS proxy username'),
        ),
        parameters.Str(
            'departmentnumber',
            required=False,
            multivalue=True,
            label=_(u'Department Number'),
        ),
        parameters.Str(
            'employeenumber',
            required=False,
            label=_(u'Employee Number'),
        ),
        parameters.Str(
            'employeetype',
            required=False,
            label=_(u'Employee Type'),
        ),
        parameters.Str(
            'preferredlanguage',
            required=False,
            label=_(u'Preferred Language'),
        ),
        parameters.Bytes(
            'usercertificate',
            required=False,
            multivalue=True,
            cli_name='certificate',
            label=_(u'Certificate'),
            doc=_(u'Base-64 encoded server certificate'),
        ),
        parameters.Int(
            'timelimit',
            required=False,
            label=_(u'Time Limit'),
            doc=_(u'Time limit of search in seconds (0 is unlimited)'),
        ),
        parameters.Int(
            'sizelimit',
            required=False,
            label=_(u'Size Limit'),
            doc=_(u'Maximum number of entries returned (0 is unlimited)'),
        ),
        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.Flag(
            'pkey_only',
            required=False,
            label=_(u'Primary key only'),
            doc=_(
                u'Results should contain primary key attribute only ("login")'
            ),
            default=False,
            autofill=True,
        ),
        parameters.Str(
            'in_group',
            required=False,
            multivalue=True,
            cli_name='in_groups',
            label=_(u'group'),
            doc=_(u'Search for stage users with these member of groups.'),
        ),
        parameters.Str(
            'not_in_group',
            required=False,
            multivalue=True,
            cli_name='not_in_groups',
            label=_(u'group'),
            doc=_(u'Search for stage users without these member of groups.'),
        ),
        parameters.Str(
            'in_netgroup',
            required=False,
            multivalue=True,
            cli_name='in_netgroups',
            label=_(u'netgroup'),
            doc=_(u'Search for stage users with these member of netgroups.'),
        ),
        parameters.Str(
            'not_in_netgroup',
            required=False,
            multivalue=True,
            cli_name='not_in_netgroups',
            label=_(u'netgroup'),
            doc=_(
                u'Search for stage users without these member of netgroups.'),
        ),
        parameters.Str(
            'in_role',
            required=False,
            multivalue=True,
            cli_name='in_roles',
            label=_(u'role'),
            doc=_(u'Search for stage users with these member of roles.'),
        ),
        parameters.Str(
            'not_in_role',
            required=False,
            multivalue=True,
            cli_name='not_in_roles',
            label=_(u'role'),
            doc=_(u'Search for stage users without these member of roles.'),
        ),
        parameters.Str(
            'in_hbacrule',
            required=False,
            multivalue=True,
            cli_name='in_hbacrules',
            label=_(u'HBAC rule'),
            doc=_(u'Search for stage users with these member of HBAC rules.'),
        ),
        parameters.Str(
            'not_in_hbacrule',
            required=False,
            multivalue=True,
            cli_name='not_in_hbacrules',
            label=_(u'HBAC rule'),
            doc=_(
                u'Search for stage users without these member of HBAC rules.'),
        ),
        parameters.Str(
            'in_sudorule',
            required=False,
            multivalue=True,
            cli_name='in_sudorules',
            label=_(u'sudo rule'),
            doc=_(u'Search for stage users with these member of sudo rules.'),
        ),
        parameters.Str(
            'not_in_sudorule',
            required=False,
            multivalue=True,
            cli_name='not_in_sudorules',
            label=_(u'sudo rule'),
            doc=_(
                u'Search for stage users without these member of sudo rules.'),
        ),
    )
    has_output = (
        output.Output(
            'summary',
            (unicode, type(None)),
            doc=_(u'User-friendly description of action performed'),
        ),
        output.ListOfEntries('result', ),
        output.Output(
            'count',
            int,
            doc=_(u'Number of entries returned'),
        ),
        output.Output(
            'truncated',
            bool,
            doc=_(u'True if not all results were returned'),
        ),
    )