Beispiel #1
0
    def execute(self, *args, **kw):
        dn = self.obj.get_dn(*args, **kw)
        entry = self.obj.backend.get_entry(dn,
                                           ['objectclass', 'serverhostname'])

        if 'mailsenderentity' not in entry['objectclass']:
            entry['objectclass'].append('mailsenderentity')
        else:
            raise errors.AlreadyActive()

        if 'primarymail' not in kw:
            config = self.obj.backend.get_ipa_config()
            entry['primarymail'] = normalize_and_validate_email(
                entry['serverhostname'], config)
        else:
            entry['primarymail'] = kw['primarymail']

        if 'sendalias' in kw:
            entry['sendalias'] = list(kw['sendalias'])

        entry['cansendexternally'] = kw['cansendexternally']

        self.obj.backend.update_entry(entry)

        return dict(
            result=True,
            value=pkey_to_value(args[0], kw),
        )
Beispiel #2
0
    def execute(self, *args, **kw):
        dn = self.obj.get_dn(*args, **kw)
        entry = self.obj.backend.get_entry(
            dn, ['objectclass', 'primarymail', 'cansendexternally'])

        if 'mailsenderentity' in entry['objectclass']:
            try:
                del entry['primarymail']
            except KeyError:
                pass

            try:
                del entry['cansendexternally']
            except KeyError:
                pass

            while 'mailsenderentity' in entry['objectclass']:
                entry['objectclass'].remove('mailsenderentity')
        else:
            raise errors.AlreadyInactive()

        self.obj.backend.update_entry(entry)

        return dict(
            result=True,
            value=pkey_to_value(args[0], kw),
        )
Beispiel #3
0
    def execute(self, cn, **options):
        ca_enabled_check()

        ca_id = self.api.Command.ca_show(cn)["result"]["ipacaid"][0]
        with self.api.Backend.ra_lightweight_ca as ca_api:
            self.perform_action(ca_api, ca_id)

        return dict(result=True, value=pkey_to_value(cn, options))
Beispiel #4
0
    def execute(self, cn, **options):
        ca_enabled_check()

        ca_id = self.api.Command.ca_show(cn)['result']['ipacaid'][0]
        with self.api.Backend.ra_lightweight_ca as ca_api:
            self.perform_action(ca_api, ca_id)

        return dict(
            result=True,
            value=pkey_to_value(cn, options),
        )
Beispiel #5
0
    def execute(self, *args, **kw):
        dn = self.obj.get_dn(*args, **kw)
        entry = self.obj.backend.get_entry(dn, ['objectclass'])

        if 'mailenabledgroup' not in entry['objectclass']:
            entry['objectclass'].append('mailenabledgroup')
        else:
            raise errors.AlreadyActive()

        entry['alias'] = list(kw['alias'])

        self.obj.backend.update_entry(entry)

        return dict(
            result=True,
            value=pkey_to_value(args[0], kw),
        )
Beispiel #6
0
    def execute(self, cn, **options):
        ca_enabled_check(self.api)

        ca_obj = self.api.Command.ca_show(cn)['result']

        # ensure operator has permission to modify CAs
        if not self.api.Backend.ldap2.can_write(ca_obj['dn'], 'description'):
            raise errors.ACIError(
                info=_("Insufficient privilege to modify a CA."))

        with self.api.Backend.ra_lightweight_ca as ca_api:
            self.perform_action(ca_api, ca_obj['ipacaid'][0])

        return dict(
            result=True,
            value=pkey_to_value(cn, options),
        )
Beispiel #7
0
    def execute(self, cn, **options):
        ca_enabled_check(self.api)

        ca_obj = self.api.Command.ca_show(cn)['result']

        # ensure operator has permission to modify CAs
        if not self.api.Backend.ldap2.can_write(ca_obj['dn'], 'description'):
            raise errors.ACIError(info=_(
                "Insufficient privilege to modify a CA."))

        with self.api.Backend.ra_lightweight_ca as ca_api:
            self.perform_action(ca_api, ca_obj['ipacaid'][0])

        return dict(
            result=True,
            value=pkey_to_value(cn, options),
        )
Beispiel #8
0
    def execute(self, cn, **options):
        ldap = self.obj.backend

        dn = self.obj.get_dn(cn)
        try:
            entry_attrs = ldap.get_entry(dn, ["ipaenabledflag"])
        except errors.NotFound:
            raise self.obj.handle_not_found(cn)

        entry_attrs["ipaenabledflag"] = [self.ipaenabledflag]

        try:
            ldap.update_entry(entry_attrs)
        except errors.EmptyModlist:
            pass

        return dict(result=True, value=pkey_to_value(cn, options),)
    def execute(self, *args, **kw):
        dn = self.obj.get_dn(*args, **kw)
        entry = self.obj.backend.get_entry(dn, ['objectclass', 'alias'])

        if 'mailenabledgroup' in [o.lower() for o in entry['objectclass']]:
            try:
                del entry['alias']
            except KeyError:
                pass

            entry['objectclass'].remove('mailenabledgroup')
        else:
            raise errors.AlreadyInactive()

        self.obj.backend.update_entry(entry)

        return dict(
            result=True,
            value=pkey_to_value(args[0], kw),
        )