Customize Velocity Template to allow only a Confluence administrator to delete a Space
プラットフォームについて: Data Center のみ。 - この記事は、 Data Center プラットフォーム。
この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。 Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。
*Fisheye および Crucible は除く
要約
Confluence でのスペースの削除は永続的なアクションであり、アプリケーションには操作を元に戻す機能がないことを意味します。
スペース権限を使用して、スペース管理者のみがスペースを削除できます。
環境によっては、Confluence 管理者がスペースの削除を制御し、スペース管理者からこの権限を取り消す必要がある場合があります。
これはスペース権限の既定の粒度では不可能ですが、Confluence 管理者のみがスペースを削除できるように Confluence をカスタマイズできます。
このカスタマイズは、次の機能リクエストが実装されていない限り有効です: CONFSERVER-1909 - Space Administrators should not be able to Remove a space (スペース管理者はスペースを削除できないようにする必要がある)
このドキュメントは現状のまま提供されるものとします
Confluence はある程度のカスタマイズが可能な柔軟性を持ちますが、アトラシアンのサポート サービスではこの分野の支援は提供されません。したがって、アトラシアンはそれらに対するサポートの提供を保証することはできません。
カスタマイズについて支援が必要な場合は、次のチャンネルのいずれかを確認してください。
ソリューション
Confluence は UI コンポーネントの多くを Velocity に依存しています。
<
confluence-install
>/confluence/spaces/removespace.vm
Velocity テンプレート ファイルの内容は、UI でのスペースの削除機能の外観を制御します。
このファイルの既定の内容を使用する場合、この UI は次のようになります (Confluence 7.9.0)。

このテンプレートを変更し、Confluence 管理者のみがスペースの削除を確認できるようにするには、以下の手順に従います。
Confluence サーバーにアクセスし、
<
confluence-install
>/confluence/spaces
フォルダーに移動します。removespace.vm
のバックアップ コピーを作成します。Original file contents as of Confluence 7.9.0
<html> <head> <title>$action.getText("title.remove.space")</title> </head> #applyDecorator("root") #decoratorParam("helper" $action.helper) #decoratorParam("context" "space-administration") #decoratorParam("mode" "view-space-administration") <body> #applyDecorator ("root") #decoratorParam ("context" "spaceadminpanel") #decoratorParam ("selection" "removespace") #decoratorParam ("title" "$action.getText('title.remove.space')") #decoratorParam ("selectedTab" "admin") #decoratorParam ("selectedSpaceToolsWebItem", "removespace") #decoratorParam("helper" $action.helper) #applyDecorator ("confirm") <p>$action.getText("remove.space.desc")</p> #if( $action.showLargeQueueWarning) #applyDecorator("message" "$action.getText('info.word')") #decoratorParam("type" "info") $action.getText("com.atlassian.confluence.spaces.actions.RemoveSpaceAction.warn.large.indexqueue", [$action.indexQueueSize]) #end #end #applyDecorator ("message" "$action.getText('warning.word')") #decoratorParam("type" "warning") $action.getText('removespace.operation.cannot.be.undone') #end #decoratorParam ("formAction" "doremovespace.action?key=$htmlUtil.urlEncode($space.key)") #decoratorParam ("formName" "removespaceform") $action.getText("alert.remove.space", [$htmlUtil.htmlEncodeAndReplaceSpaces($space.key), $htmlUtil.htmlEncode($space.name)]) #end #end </body> #end </html>
removespace.vm
ファイルを編集し、下の画像のように#applyDecorator ("confirm")
コード ブロックの上に権限検証を追加します。Template with suggested modifications
<html> <head> <title>$action.getText("title.remove.space")</title> </head> #applyDecorator("root") #decoratorParam("helper" $action.helper) #decoratorParam("context" "space-administration") #decoratorParam("mode" "view-space-administration") <body> #applyDecorator ("root") #decoratorParam ("context" "spaceadminpanel") #decoratorParam ("selection" "removespace") #decoratorParam ("title" "$action.getText('title.remove.space')") #decoratorParam ("selectedTab" "admin") #decoratorParam ("selectedSpaceToolsWebItem", "removespace") #decoratorParam("helper" $action.helper) #if( $permissionHelper.isConfluenceAdministrator($authenticatedUser) ) #applyDecorator ("confirm") <p>$action.getText("remove.space.desc")</p> #if( $action.showLargeQueueWarning) #applyDecorator("message" "$action.getText('info.word')") #decoratorParam("type" "info") $action.getText("com.atlassian.confluence.spaces.actions.RemoveSpaceAction.warn.large.indexqueue", [$action.indexQueueSize]) #end #end #applyDecorator ("message" "$action.getText('warning.word')") #decoratorParam("type" "warning") $action.getText('removespace.operation.cannot.be.undone') #end #decoratorParam ("formAction" "doremovespace.action?key=$htmlUtil.urlEncode($space.key)") #decoratorParam ("formName" "removespaceform") $action.getText("alert.remove.space", [$htmlUtil.htmlEncodeAndReplaceSpaces($space.key), $htmlUtil.htmlEncode($space.name)]) #end #else #applyDecorator ("message" "$action.getText('info.word')") #decoratorParam("type" "info") <p>You don't have permission to delete this Space.</br>Please contact your Confluence administrator.</p> #end #end #end </body> #end </html>
ファイルを保存する。
Confluence を Data Center クラスターで実行している場合は、すべてのノードに同じ変更を適用してください。
Then, if a Space Administrator tries to delete a Space, they will be presented with a message that only a Confluence Administrator can see the Delete Space confirmation form (and actually delete it from the UI): "You don't have permission to delete this Space. Please contact your Confluence administrator."
このカスタマイズに関する注意事項:
この変更を適用するために Confluence を再起動する必要はありません。
これは、UI から操作を実行する場合にのみ有効であり、スペース管理者は引き続き REST API を通じてスペースを削除できます。
The
removespace.vm
file will be overwritten with any upgrade, and you will need to reapply this modification after a successful upgrade, making sure it is still valid.
この内容はお役に立ちましたか?