作成者カテゴリ返答の対象
公開
びぃ〜
02/24/2000 03:54 PM
リッチテキストの内容のコピー
Re:リッチテキストの内容のコピー

なるほど、読者権限では確かにだめですね
一般ユーザーが読者という事はDefaultが読者という事でよろしいですか?
他の編集できるユーザーは編集者としてACLに1人づつ追加してあるという事で話を進めます。

まず、Defaultを編集者にします。
編集できるユーザーに[編集者]というロールを追加します。
postopenの最後を

Set db = s.currentdatabase
Dim acl As notesacl 'ここから↓
Dim ent As notesaclentry
Dim eflg
Set acl = db.acl
Set ent = acl.getentry(s.username)
eflg = False
If Not(ent Is Nothing) Then
Forall r In ent.roles
If r = "[編集者]" Then
eflg = True
Exit Forall
End If
End Forall
End If  'ここまでを追加する↑

Set ndoc = db.getdocumentbyid(NID)
Set nuidoc = ws.editdocument(eflg,ndoc)

End Sub

と書き換えます。

QueryModeChangeに

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If source.editmode Then Exit Sub
Dim s As New notessession
Dim db As notesdatabase
Dim acl As notesacl
Dim ent As notesaclentry
Dim eflg

Set db = s.currentdatabase
Set acl = db.acl
Set ent = acl.getentry(s.username)
eflg = False
If Not(ent Is Nothing) Then
Forall r In ent.roles
If r = "[編集者]" Then
eflg = True
Exit Forall
End If
End Forall
End If

continue = eflg
End Sub

とかきます。
以上です。

こうすると[編集者]ロールを持っていないユーザーは編集モードにならないため、見た目読者になります。
ですが、新規作成はできてしまうので、これも同じように制御してみてください。
役に立たなかったらごめんなさい。

今回のように強制的に保存が走るものは、QeryCloseでは扱いにくいです。
ユーザーは変更をしたけど「やっぱりやめた」と、保存をしないで閉じる場合もあるからです。
そのため、保存が必要な処理はセーブ時かオープン時にやるの良いかと思います。
その点、Postopenイベントを使おうとしたのはすごいと思います。
勉強になりました。

リッチテキストはいろいろできますが、扱いが難しいですよね
私もよく泣きをみます。


[Previous Main Document]
リッチテキストの内容のコピー (Ota)
. . ↓これの追加です (びぃ〜)
. . . . びぃ〜さん、ありがとうございます。でも。。。 (Ota)
. . . . . . Re:リッチテキストの内容のコピー (びぃ〜) * 現在地 *
. . . . . . . . Re:リッチテキストの内容のコピー(なんとかできました) (Ota)
. . Re:リッチテキストの内容のコピー (びぃ〜)
[Next Main Document]