アプリケーションの設計
例:入力変換式を使用する
この式は、パスワードフィールドの入力変換式です。ユーザーがパスワードを入力すると、IBM(R) Lotus Domino(R) はそのユーザーを [Domino ディレクトリ] で検索し、ユーザーの [HTTPPassword] フィールドを読み取ります。次に、ユーザーがフィールドに入力した値と [HTTPPassword] フィールドを比較します。値が一致した場合は、「You passed」というプロンプトが表示されます。値が一致しない場合は、「You entered an incorrect password」というプロンプトが表示されます。
x:=@DbLookup("";"Server/Acme":"names.nsf";"($Users)";@Username;"HTTPPassword");
REM "This compares the value above to the value the user entered after running it through the @Password hash function and prompts the user whether they typed in a valid password or not.";
@if(@isError(x);@Prompt([OK];"Error";"Error");@Password(Password) = x;@Prompt([OK];"You passed";"You passed");@Prompt([ok];"Password failure";"You entered an incorrect password"));
REM "This deletes the password field.";
@Unavailable
例:QuerySave イベントを使用する
このスクリプトは、パスワードフィールドにパスワードが格納されているかどうかを判断します。格納されている場合は、文書の作成者の名前を取得し、名前の省略形を [PublicEncryptionKeys] フィールドに入れます。これにより、パスワードフィールドが作成者のパブリックキーで効果的に暗号化されます。 Domino ディレクトリへの検索を行うことなく、キーを取得します。キーはユーザーの ID ファイルから取得されます。
Dim doc As NotesDocument
Dim db As NotesDatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set uidoc=Source
Set doc=source.Document
If doc.GetItemValue("Password")(0) <> "" Then
Set PkName = New NotesName(doc.GetItemValue("Author")(0))
Call doc.ReplaceItemValue("PublicEncryptionKeys", PkName.Abbreviated )
End If
例 2:QuerySave イベントを使用する
このスクリプトは、1 つ以上のパスワードフィールドにパスワードが格納されているかどうかを判断します。フィールドの 1 つにパスワードが格納されている場合、スクリプトは [Author] フィールドと [OtherEditors] フィールド (値のグループが含まれている場合もある) から値を取得し、[OtherEditors] フィールドを展開します。これにより、名前が取得され、名前の省略形が [PublicEncryptionKeys] フィールドに格納されます。これにより、2 つのフィールドにあるすべての一意なエントリについて、パスワードフィールドがパブリックキーで効果的に暗号化されます。また、唯一の値が現在のユーザーである場合を除き、Domino ディレクトリへの検索を通じて、リストされた各ユーザーについてキーが取得されます。検索する名前が複数ある場合は、Domino ディレクトリからパブリックキーが取得されます。検索するキーが作成者キーだけの場合は、ユーザーの ID ファイルから取得されます。
Dim s As New NotesSession
Set db = s.CurrentDatabase
Dim uidoc As notesuidocument
Set uidoc=source
Set doc = uidoc.document
If (doc.GetItemValue("Password1")(0) <> "") Or (doc.GetItemValue("Password2")(0) <> "") Then
Call doc.ReplaceItemValue("PublicEncryptionKeys",_ Evaluate(|@Name([Abbreviate];@Unique(Author:OtherEditors))|,doc))
関連項目