この章では、計算属性を管理する方法について説明します。 内容は次のとおりです。
Oracle Internet Directoryサーバーでは、1つ以上のルールに基づいて構成可能な属性およびその値を動的に計算するためのメカニズムとしてOrclComputedAttribute
属性を提供しています。したがって、ディレクトリ・ストア内で属性を永続化しなくても、実際に必要なときに属性を計算できます。計算属性は、テストから本番デプロイメントへの移行で役立ちます。
OrclComputedAttribute
属性は、DSA構成エントリの構成属性です。
cn=dsaconfig,cn=configsets,cn=oracle internet directory
.
OrclComputedAttribute
は多値属性であるため、複数の属性とその値を動的に計算できます。
OrclComputedAttribute
値は、ルールで定義される次の項目または次の項目の組合せから導出できます。
RFC 4516で定義された標準LDAP URI
事前に決定された文字列
属性値
属性値の関数
次に、OrclComputedAttribute
を使用する場合の考慮事項をいくつか示します。
計算属性の名前は、スキーマで定義する必要があります。
計算属性には、値の復帰を抑止するアクセス制御ポリシーが存在する場合があります。
計算属性は、ルックアップおよび検索操作のためにのみ取得されます。結果エントリに構成済計算属性がある場合、Oracle Internet Directoryサーバーでは属性計算がスキップされます。
エントリ内の既存値を削除または置換する更新操作が可能です。
ldapmodify
、Oracle Directory Services Manager、サード・パーティLDAPブラウザなどのLDAPツールを使用してOrclComputedAttribute
を構成できます。
この項では、次の内容を説明します。
この項では、属性値の計算に使用されるルールの構文について説明します。
値の計算でこうしたルールの組合せを使用できる場合は、表17-1の「特殊文字」を参照してください。
こうしたルールでは、次の構文を使用します。
OrclComputedAttribute;ComputedAttrName;dn;Filter: ldapURI OrclComputedAttribute;ComputedAttrName;dn;Filter: "anyString" OrclComputedAttribute;ComputedAttrName;dn;Filter: AttributeName OrclComputedAttribute;ComputedAttrName;dn;Filter: Func(attrName)
表17-1で、こうしたルールで使用される要素について説明します。
表17-1 計算属性のルールで使用される構文要素
要素 | 説明 |
---|---|
ComputedAttrName |
エントリで返される属性の名前。計算属性の名前は、スキーマで定義する必要があります。またこの属性は、値の計算後にACL評価の対象になります。 |
dn |
識別名。属性は、このDNの子エントリについて計算されます。 |
Filter |
フィルタ値。属性は、このフィルタ値に属するエントリについて計算されます。 |
ldapURI |
RFC 4516に記載された構文に準拠する次のようなURI。 ldap:///baseDN?ReqdAttribute??scope?filter ReqdAttributeは、必須属性の単一の属性名です。 ldapURI構成に空白文字が含まれる場合、RFC 4516に記載されているように、空白を |
"anyString" |
含める文字列。二重引用符で囲む必要があります。 |
AttributeName |
属性値を示す属性名を使用する必要があります。 |
|
値に対して実行する関数の名前。リリース11g(11.1.1.7.0)では、次の関数が使用可能です。 lower(attrName) upper(attrName) substr(attrName,pos,len) replace(attrName,"str") trunc(attrName, "c") |
特殊文字 |
ルールとともに使用できる特殊文字は次のとおりです。
|
この項では、計算属性の使用例を示します。
次の例ではcn
属性を大文字として計算し、upperattr
として属性を返します。
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;upperattr;dc=acme,dc=com;objectclass=person orclcomputedattribute;upperattr;ou=EuroSInet Suite,o=IMC,c=US;objectclass=person: upper(cn)
upperattr
のスキーマ定義を定義する必要があります。
次の例では、属性値の部分文字列を計算し、位置1から次の3文字のdescription値としての値を含む属性substrattrを返します。
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;substrattr;dc=acme,dc=com;objectclass=person orclcomputedattribute;substrattr;dc=acme,dc=com;objectclass=person: substr(description, 1,3)
次の例では、newTitle
の属性値を計算して置換します。
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;newTitle;cn=john doe,dc=acme,dc=com;objectclass=person orclcomputedattribute;newTitle;ou=EuroSInet Suite,o=IMC,c=US;objectclass=person: replace(title, "Clerk", "Manager")
次の例では、dc=acme,dc=com
の下にある各エントリにcommonTelephoneNumber
を追加します。
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;commonTelephoneNumber;dc=acme,dc=com;objectclass=person orclcomputedattribute;commonTelephoneNumber;dc=acme,dc=com,c=US;objectclass=person: "Common PhoneNumber is " + ldap:///cn=common%20attributes,dc=com?telephonenumber??base?objectclass=*
空白文字によって区切られた様々なルールを+(プラス記号)を使用して連結します。
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;combinationAttribute;ou=EuroSInet Suite,o=IMC,c=US;objectclass=person orclcomputedattribute;combinationAttribute;dc=acme,dc=com;objectclass=person: "telephone number from common entry:" + ldap:///cn=common Entry,?telephonenumber??base?objectclass=* + " appending replace of title attr with clerk/manager " + replace(title, "Clerk", "Manager")
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;combinationAttr2;dc=acme,dc=com;objectclass=person orclcomputedattribute;combinationAttr2;dc=acme,dc=com;objectclass=person: "Telephone number from common entry " + ldap:///cn=commonEntry,dc=acme,dc=com?telephonenumber??base?objectclass=* + " appending truncate of description for space char " + trunc(description, " ")
エントリにtelephoneNumber
属性がある場合はcontactNumber
属性をtelephoneNumber
として追加し、それ以外の場合は値6505067000をコピーします。
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory changetype: modify add: orclcomputedattribute;contactNumber;cn=employees,dc=acme,dc=com; (objectclass=person) orclcomputedattribute;contactNumber;cn=employees,dc=acme,dc=com; (objectclass=person): telephonenumber | 6505067000
注意: OR演算子(|)については、計算属性定義では次の構文がサポートされます。
definition-1 | definition-2 | ... definition-n
各項目の意味は次のとおりです。
たとえば、次のルールでは、エントリに対するuidが存在しない場合に、その結果はエントリ内の属性cnの発生数にかかわりなく、計算値"cn="になります。 orclcomputedattr;myattr;cn=employees;(objectclass=inetorgperson): "uid=" + uid | "cn=" + cn |