プライマリ・コンテンツに移動
Oracle® Fusion Middleware Oracle Internet Directory管理者ガイド
11g リリース1(11.1.1)
B55919-08
  目次へ移動
目次

前
 
次
 

17 計算属性の管理

この章では、計算属性について説明し、LDAPコマンド行ツールを使用してOrclComputedAttribute属性を構成し、計算属性を管理する方法について説明します。

この章の内容は次のとおりです。

17.1 計算属性の概要

11gリリース1 (11.1.1.7.0)以降のOracle Internet Directoryサーバーでは、1つ以上のルールに基づいて構成可能な属性およびその値を動的に計算するためのメカニズムとしてOrclComputedAttribute属性を提供しています。したがって、ディレクトリ・ストア内で属性を永続化しなくても、実際に必要なときに属性を計算できます。計算属性は、テストから本番デプロイメントへの移行で役立ちます。

OrclComputedAttribute属性は、DSA構成エントリの構成属性です。

cn=dsaconfig,cn=configsets,cn=oracle internet directory

OrclComputedAttributeは、複数値属性であるため、複数の属性とその個々の値を動的に計算できます。

OrclComputedAttribute値は、ルールで定義される次の項目または次の項目の組合せから導出できます。

  • RFC 4516で定義された標準LDAP URI

  • 事前に決定された文字列

  • 属性値

  • 属性値の関数

  • 11gリリース1 (11.1.1.9.0)以降では、2つ以上のエントリから属性を取得するため、connectBy句を含めることができます。この機能では、PRIOR式を含むSQLのCONNECT BY条件という基礎となるデータベース機能を使用します。

    たとえば、組織でconnectBy句を使用して、実際には従業員のレコードにマネージャのデータを永続化することなく、従業員レコードに従業員のマネージャの情報(メールや電話番号などの連絡先情報)を含めることができます。

次に、OrclComputedAttributeを使用する場合の考慮事項をいくつか示します。

  • 計算属性の名前は、スキーマで定義する必要があります。

  • 計算属性には、値の復帰を抑止するアクセス制御ポリシーが存在する場合があります。

  • 計算属性は、ルックアップおよび検索操作のためにのみ取得されます。結果エントリに構成済計算属性がある場合、Oracle Internet Directoryサーバーでは属性計算がスキップされます。

  • エントリ内の既存値を削除または置換する更新操作が可能です。

17.2 計算属性の構成

ldapmodify、Oracle Directory Services Manager (ODSM)、サード・パーティLDAPブラウザなどのLDAPツールを使用してOrclComputedAttributeを構成できます。

この項では、次の内容を説明します。

17.2.1 計算属性に使用されるルールおよび構文

計算属性のルールでは、次の構文を使用して属性値を計算します。

OrclComputedAttribute;ComputedAttrName;dn;Filter: ldapURI 

OrclComputedAttribute;ComputedAttrName;dn;Filter: "anyString"

OrclComputedAttribute;ComputedAttrName;dn;Filter: AttributeName

OrclComputedAttribute;ComputedAttrName;dn;Filter: Func(attrName)

OrclComputedAttribute;ComputedAttrName;dn;Filter: connectBy(dnAttr,Direction,Level,[computed-attribute-rules],ldapFilter)

表17-1で、こうしたルールで使用される要素について説明します。

これらのルールの組合せを使用して値を計算する場合、第17.2.1.1項「計算属性のルールでの特殊文字の使用」を参照してください。

表17-1 計算属性のルールで使用される構文要素

要素 説明

ComputedAttrName

エントリで返される属性の名前。計算属性の名前は、スキーマで定義する必要があります。またこの属性は、値の計算後にACL評価の対象になります。

dn

識別名。属性は、このDNの子エントリについて計算されます。

Filter

フィルタ値。属性は、このフィルタ値に属するエントリについて計算されます。

ldapURI

RFC 4516に記載された構文に準拠する次のようなURI。

ldap:///baseDN?ReqdAttribute??scope?filter

ReqdAttributeは、必須属性の単一の属性名です。

ldapURI構成に空白文字が含まれる場合、RFC 4516に記載されているように、空白を%20としてエンコードする必要があります。

"anyString"

含める文字列。二重引用符で囲む必要があります。

AttributeName

属性値を示す属性名を使用する必要があります。

Func(attr)

値に対して実行する関数の名前。次のファンクションを使用できます。

lower(attrName)

upper(attrName)

substr(attrName,pos,len)

replace(attrName,"str")

trunc(attrName, "c")

NVL(attr, "StringVal")

注意: NVL関数では、attr属性がエントリから欠落している場合、Oracle Internet Directoryサーバーによって、デフォルトの文字列値StringValを使用して計算属性が生成されます。

connectBy

connectBy句では次の構文を使用します。

connectBy(dnAttr,Direction,Level,[computed-attribute-rules],ldapFilter)
  • dnAttrは、ターゲット・エントリの属性の識別名構文です。例: managerownerまたはuniquemember。これは必須パラメータです。

  • Directionは、結果を返すディレクトリの方向です。

    0 - 下位方向

    1 - 上位方向

    これは必須パラメータです。

  • Levelは、結果を返すディレクトリの下位方向または上位方向の再帰レベルの数です。これは必須パラメータです。

  • computed-attribute-rulesは、connectBy句の結果としてフェッチされる各エントリに適用されます。これらのルールは、大カッコ[]で囲まれています。これはオプション・パラメータです。

  • ldapFilterでは、フィルタ条件がターゲット・エントリで一致する場合にのみ、計算属性が生成されます。これはオプション・パラメータです。


17.2.1.1 計算属性のルールでの特殊文字の使用

計算属性のルールで特殊文字を使用する場合の考慮事項は、次のとおりです。

  • 複数のルールを指定する場合、各ルールを区切るために空白文字を使用する必要があります。

  • ルールまたは文字列を追加または連結するには、プラス記号(+)を使用します。

  • 第1のルール評価の結果により値を決定するには、OR演算子(|)を使用します。

  • アスタリスク(*)はワイルドカード文字であり、ldapURI内でのみ使用できます。この演算子がURIのDN部分で表示される場合、*はエントリのDNを評価する有効範囲から導出されたものです。

17.3 LDAPコマンド行ツールを使用した計算属性の例

この項では、計算属性の次の例を示します。

17.3.1 属性値の大文字での返却

次の例では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のスキーマ定義を定義する必要があります。

17.3.2 属性値の部分文字列の返却

次の例では、属性値の部分文字列を計算し、位置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)

17.3.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")

17.3.4 URIベースの構成の指定

次の例では、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=*

17.3.5 様々なルールの組合せの使用

空白文字によって区切られた様々なルールを+(プラス記号)を使用して連結します。

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, " ")

17.3.6 OR(|)演算子の使用

エントリに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

各項目の意味は次のとおりです。

  • definition-1は複合的なルールでもかまいません。

  • definition-2からdefinition-nは、ハードコード化された文字列や属性値などの簡単なルールのみであることが必要です。これらの定義で、関数式または式ルールの組合せを使用することはできません。

たとえば、次のルールでは、エントリに対するuidが存在しない場合に、その結果はエントリ内の属性cnの発生数にかかわりなく、計算値"cn="になります。

orclcomputedattr;myattr;cn=employees;(objectclass=inetorgperson): "uid=" + uid | "cn=" + cn

17.3.7 connectByインタフェースの使用

次の例では、ターゲット・エントリの属性(manager)からの値が割り当てられ、ディレクトリの下位方向の最大10レベルでそのマネージャのレポートのAllReports計算属性が生成されます。マネージャのDNは次のとおりです。

dn: uid=Manager,ou=people,dc=us,dc=example,dc=com

dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory
changetype: modify
add: orclcomputedattribute;AllReports;dc=com;objectclass=person
orclcomputedattribute;AllReports;dc=com;objectclass=person:connectby(manager,0,10)

各計算属性には、個々の従業員のuidが含まれます。次に例を示します。

AllReports=uid=employee1,ou=people,dc=us,dc=example,dc=com
...
AllReports=uid=employee6,ou=people,dc=us,dc=example,dc=com

次の例では、ディレクトリの上位方向の最大15レベルで各従業員のAllManagers計算属性が生成されます。DNは次のとおりです。

dn: uid=manager,ou=people,dc=us,dc=example,dc=com
dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory
changetype: modify
add: orclcomputedattribute;AllManagers;dc=com;objectclass=person
orclcomputedattribute;AllManagers;dc=com;objectclass=person: connectBy(manager,1,15, [ "EmpNum " + employeenumber + " " + upper(orclnormdn) ])

各計算属性には、個々のマネージャのemployeenumberと、エントリの正規化された識別名(orclnormdn属性)が大文字で含まれます。次に例を示します。

AllManagers=EmpNum1 UID=NAME1,OU=PEOPLE,DC=US,DC=EXAMPLE,DC=COM
...
AllManagers=EmpNum5 UID=NAME5,OU=PEOPLE,DC=US,DC=EXAMPLE,DC=COM

次の例は、前述の例にフィルタ(objectclass=inetorgperson)が追加されています。

dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory
changetype: modify
add: orclcomputedattribute;AllManagers;dc=com;objectclass=person
orclcomputedattribute;AllManagers;dc=com;objectclass=person:connectBy(manager,1,15, [ "EmpNum " + employeenumber + " " + upper(orclnormdn) ],
(objectclass=inetorgperson))

17.3.8 connectByを使用した階層グループの作成

次の例は、再帰(階層)グループのconnectBy句を示しています。

dn: cn=dsaconfig,cn=configsets,cn=oracle internet directory
changetype: modify
add: orclcomputedattribute;uniquemember;dc=com;objectclass=groupOfUniquenames
orclcomputedattribute;uniquemember;dc=com;objectclass=groupOfUniquenames:connectBy(uniquemember,1,25, [uniquemember])

次の例は、Oracle Internet Directoryサーバーによって計算された静的グループと階層グループを示しています。マネージャの直属の部下を含む2つの静的グループ・エントリが追加されています。

グループ・エントリに静的な一意のメンバーが格納されている場合、この例によって、uniquemember属性のディレクトリの上位方向にネストされた結果が返されます。次に例を示します。

dn: cn=manager1_org,cn=groups,dc=us,dc=example,dc=com
objectclass: groupofuniquenames
objectclass: top
cn: manager1_org
uniquemember: uid=manager1,ou=People,dc=us,dc=example,dc=com
uniquemember: uid=emp1,ou=People,dc=us,dc=example,dc=com
uniquemember: uid=emp2,ou=People,dc=us,dc=example,dc=com
uniquemember: uid=emp3,ou=People,dc=us,dc=example,dc=com
uniquemember: uid=emp4,ou=People,dc=us,dc=example,dc=com
uniquemember: cn=emp2_org,cn=groups,dc=us,dc=example,dc=com

および

dn: cn=emp2_org,
cn=groups,dc=us,dc=example,dc=com
objectclass: groupofuniquenames
objectclass: top
cn: emp2_org
uniquemember: uid=emp5,ou=People,dc=us,dc=example,dc=com
uniquemember: uid=emp6,ou=People,dc=us,dc=example,dc=com

エントリ"cn=manager1_org,cn=groups,dc=us,dc=example,dc=com"が検索されると、Oracle Internet Serverサーバーによってuniquemember属性が再帰的に自動計算されます。次に例を示します。

cn=manager1,cn=groups,dc=us,dc=example,dc=com
uniquemember=cn=emp2_org,cn=groups,dc=us,dc=example,dc=com
uniquemember=uid=manager1,ou=people,dc=us,dc=example,dc=com
uniquemember=uid=emp1,ou=people,dc=us,dc=example,dc=com
uniquemember=uid=emp2,ou=people,dc=us,dc=example,dc=com
uniquemember=uid=emp3,ou=people,dc=us,dc=example,dc=com
uniquemember=uid=emp4,ou=people,dc=us,dc=example,dc=com
uniquemember=uid=emp5,ou=people,dc=us,dc=example,dc=com
uniquemember=uid=emp6,ou=people,dc=us,dc=example,dc=com