コード例 #1
0
ファイル: directory.py プロジェクト: ThHirsch/openchange
    def unapply(cls, cur, **kwargs):
        # Do nothing by now
        from openchange.provision import get_local_samdb

        names = kwargs['names']
        db = get_local_samdb(names, kwargs['lp'], kwargs['creds'])

        # Set postmaster proxyAddress attribute as secondary entry
        modify_postmaster_ldif_template = """
dn: {user_dn}
changetype: modify
delete: proxyAddresses
proxyAddresses: smtp:postmaster@{mail_domain}
-
add: proxyAddresses
proxyAddresses: SMTP:postmaster@{mail_domain}
"""

        ldb_filter = "(proxyAddresses=*)"
        res = db.search(base=names.domaindn, scope=ldb.SCOPE_SUBTREE, expression=ldb_filter)
        for element in res:
            if 'proxyAddresses' in element:
                for entry in element['proxyAddresses']:
                    if entry.startswith('smtp:postmaster@'):
                        mail_domain = entry[len('smtp:postmaster@'):]
                        dn = element.dn.get_linearized()
                        ldif = modify_postmaster_ldif_template.format(user_dn=dn,
                                                                      mail_domain=mail_domain)
                        try:
                            db.modify_ldif(ldif)
                        except Exception, ex:
                            sys.stderr.write("Error unmigrating user %s: %s\n" % (dn, ex))
コード例 #2
0
    def unapply(cls, cur, **kwargs):
        # Do nothing by now
        from openchange.provision import get_local_samdb

        names = kwargs['names']
        db = get_local_samdb(names, kwargs['lp'], kwargs['creds'])

        # Set postmaster proxyAddress attribute as secondary entry
        modify_postmaster_ldif_template = """
dn: {user_dn}
changetype: modify
delete: proxyAddresses
proxyAddresses: smtp:postmaster@{mail_domain}
-
add: proxyAddresses
proxyAddresses: SMTP:postmaster@{mail_domain}
"""

        ldb_filter = "(proxyAddresses=*)"
        res = db.search(base=names.domaindn,
                        scope=ldb.SCOPE_SUBTREE,
                        expression=ldb_filter)
        for element in res:
            if 'proxyAddresses' in element:
                for entry in element['proxyAddresses']:
                    if entry.startswith('smtp:postmaster@'):
                        mail_domain = entry[len('smtp:postmaster@'):]
                        dn = element.dn.get_linearized()
                        ldif = modify_postmaster_ldif_template.format(
                            user_dn=dn, mail_domain=mail_domain)
                        try:
                            db.modify_ldif(ldif)
                        except Exception, ex:
                            sys.stderr.write(
                                "Error unmigrating user %s: %s\n" % (dn, ex))
コード例 #3
0
ファイル: directory.py プロジェクト: ThHirsch/openchange
    def unapply(cls, cur, **kwargs):
        from openchange.provision import get_local_samdb
        lp = kwargs['lp']
        creds = kwargs['creds']
        names = kwargs['names']
        db = get_local_samdb(names, lp, creds)
        delete_activesync_template = """
dn: {dn}
changetype: delete
delete: msExchOmaAdminWirelessEnable
"""
        recipients = cls._get_all_enabled_users(db, names.domaindn)
        for element in recipients:
            if not 'msExchOmaAdminWirelessEnable' in element:
                continue
            dn = element.dn.get_linearized()
            ldif = delete_activesync_template.format(dn=dn)
            try:
                db.modify_ldif(ldif)
            except Exception, ex:
                msg = "Error reverting migration in recipient %s: %s\n" % (dn, ex)
                sys.stderr.write(msg)
コード例 #4
0
    def unapply(cls, cur, **kwargs):
        from openchange.provision import get_local_samdb
        lp = kwargs['lp']
        creds = kwargs['creds']
        names = kwargs['names']
        db = get_local_samdb(names, lp, creds)
        delete_activesync_template = """
dn: {dn}
changetype: delete
delete: msExchOmaAdminWirelessEnable
"""
        recipients = cls._get_all_enabled_users(db, names.domaindn)
        for element in recipients:
            if not 'msExchOmaAdminWirelessEnable' in element:
                continue
            dn = element.dn.get_linearized()
            ldif = delete_activesync_template.format(dn=dn)
            try:
                db.modify_ldif(ldif)
            except Exception, ex:
                msg = "Error reverting migration in recipient %s: %s\n" % (dn,
                                                                           ex)
                sys.stderr.write(msg)
コード例 #5
0
ファイル: directory.py プロジェクト: ThHirsch/openchange
    def apply(cls, cur, **kwargs):
        from openchange.provision import force_schemas_update, get_local_samdb

        lp = kwargs['lp']
        creds = kwargs['creds']
        names = kwargs['names']
        setup_path = kwargs['setup_path']

        db = get_local_samdb(names, lp, creds)
        schema_dn = "CN=Schema,CN=Configuration,%s" % names.domaindn

        # Add new schem atributes
        add_schema_attr_ldif = """
#
# ms-Exch-Recipient-Display-Type
#
dn: CN=ms-Exch-Recipient-Display-Type,%(schema_dn)s
objectClass: top
objectClass: attributeSchema
cn: ms-Exch-Recipient-Display-Type
distinguishedName: CN=ms-Exch-Recipient-Display-Type,%(schema_dn)s
instanceType: 4
uSNCreated: 43689
attributeID: 1.2.840.113556.1.4.7000.102.50730
attributeSyntax: 2.5.5.9
isSingleValued: TRUE
mAPIID: 14597
uSNChanged: 43689
showInAdvancedViewOnly: TRUE
adminDisplayName: ms-Exch-Recipient-Display-Type
adminDescription: ms-Exch-Recipient-Display-Type
oMSyntax: 2
searchFlags: 1
lDAPDisplayName: msExchRecipientDisplayType
name: ms-Exch-Recipient-Display-Type
schemaIDGUID:: sKuTuH52IE+RXzhXu8lq/g==
attributeSecurityGUID:: iYopH5jeuEe1zVcq1T0mfg==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,%(schema_dn)s

#
# ms-Exch-Recipient-Type-Details
#
dn: CN=ms-Exch-Recipient-Type-Details,%(schema_dn)s
objectClass: top
objectClass: attributeSchema
cn: ms-Exch-Recipient-Type-Details
distinguishedName: CN=ms-Exch-Recipient-Type-Details,%(schema_dn)s
instanceType: 4
whenCreated: 20140829141013.0Z
whenChanged: 20140829141013.0Z
uSNCreated: 43693
attributeID: 1.2.840.113556.1.4.7000.102.50855
attributeSyntax: 2.5.5.16
isSingleValued: TRUE
uSNChanged: 43693
showInAdvancedViewOnly: TRUE
adminDisplayName: ms-Exch-Recipient-Type-Details
adminDescription: ms-Exch-Recipient-Type-Details
oMSyntax: 65
searchFlags: 1
lDAPDisplayName: msExchRecipientTypeDetails
name: ms-Exch-Recipient-Type-Details
schemaIDGUID:: +KGbBgpUqUK/JqfdNUdTRg==
attributeSecurityGUID:: iYopH5jeuEe1zVcq1T0mfg==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,%(schema_dn)s
"""

        add_schema_attr_ldif = add_schema_attr_ldif % {'schema_dn': schema_dn}
        try:
            db.add_ldif(add_schema_attr_ldif, ['relax:0'])
        except Exception, ex:
            sys.stderr.write("Error adding msExchRecipientTypeDetails and msExchRecipientDisplayType atributes to schema: %s\n" % str(ex))
コード例 #6
0
    def apply(cls, cur, **kwargs):
        from openchange.provision import force_schemas_update, get_local_samdb

        lp = kwargs['lp']
        creds = kwargs['creds']
        names = kwargs['names']
        setup_path = kwargs['setup_path']

        db = get_local_samdb(names, lp, creds)
        schema_dn = "CN=Schema,CN=Configuration,%s" % names.domaindn

        # Add new schem atributes
        add_schema_attr_ldif = """
#
# ms-Exch-Recipient-Display-Type
#
dn: CN=ms-Exch-Recipient-Display-Type,%(schema_dn)s
objectClass: top
objectClass: attributeSchema
cn: ms-Exch-Recipient-Display-Type
distinguishedName: CN=ms-Exch-Recipient-Display-Type,%(schema_dn)s
instanceType: 4
uSNCreated: 43689
attributeID: 1.2.840.113556.1.4.7000.102.50730
attributeSyntax: 2.5.5.9
isSingleValued: TRUE
mAPIID: 14597
uSNChanged: 43689
showInAdvancedViewOnly: TRUE
adminDisplayName: ms-Exch-Recipient-Display-Type
adminDescription: ms-Exch-Recipient-Display-Type
oMSyntax: 2
searchFlags: 1
lDAPDisplayName: msExchRecipientDisplayType
name: ms-Exch-Recipient-Display-Type
schemaIDGUID:: sKuTuH52IE+RXzhXu8lq/g==
attributeSecurityGUID:: iYopH5jeuEe1zVcq1T0mfg==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,%(schema_dn)s

#
# ms-Exch-Recipient-Type-Details
#
dn: CN=ms-Exch-Recipient-Type-Details,%(schema_dn)s
objectClass: top
objectClass: attributeSchema
cn: ms-Exch-Recipient-Type-Details
distinguishedName: CN=ms-Exch-Recipient-Type-Details,%(schema_dn)s
instanceType: 4
whenCreated: 20140829141013.0Z
whenChanged: 20140829141013.0Z
uSNCreated: 43693
attributeID: 1.2.840.113556.1.4.7000.102.50855
attributeSyntax: 2.5.5.16
isSingleValued: TRUE
uSNChanged: 43693
showInAdvancedViewOnly: TRUE
adminDisplayName: ms-Exch-Recipient-Type-Details
adminDescription: ms-Exch-Recipient-Type-Details
oMSyntax: 65
searchFlags: 1
lDAPDisplayName: msExchRecipientTypeDetails
name: ms-Exch-Recipient-Type-Details
schemaIDGUID:: +KGbBgpUqUK/JqfdNUdTRg==
attributeSecurityGUID:: iYopH5jeuEe1zVcq1T0mfg==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,%(schema_dn)s
"""

        add_schema_attr_ldif = add_schema_attr_ldif % {'schema_dn': schema_dn}
        try:
            db.add_ldif(add_schema_attr_ldif, ['relax:0'])
        except Exception, ex:
            sys.stderr.write(
                "Error adding msExchRecipientTypeDetails and msExchRecipientDisplayType atributes to schema: %s\n"
                % str(ex))