私のアプリケーションは Zope 2.12.19 と Python 2.6.5 で動作します。
pagetemplate.pt
アクセス制限が定義されたページテンプレートファイルがありpagetemplate.pt.metadata
ます。これらのアクセス制限は、Zope 製品のページを除くすべての Web ページに適用され、正しく機能します。
ファイルの内容は次の.metadata
とおりです。
[default]
title=
[security]
View=0:Authenticated,Manager,Owner,User
Access contents information=0:Authenticated,Manager,Owner,User
たとえば、システム内のすべてのユーザーを一覧表示する Zope 製品があり、これは上記のページ テンプレートを使用します。ユーザーはログインせずに匿名でこのページにアクセスできます。これは、メタデータ ファイルが読み取られていないことを意味します。
しかし、製品以外の他のページにアクセスするには、アプリケーションはユーザーにログインを強制します。製品の.metadata
ファイル読み取りに問題はありますか?
参考までに - 私は ZODB を使用していません... 代わりに、すべて (ソース コード) はファイル システム上にあります。
の内容configure.zcml
は以下。
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="AMSPermissions">
<!-- the users manage page -->
<browser:page
for="OFS.interfaces.IFolder"
name="manage-users"
template="standard_template.pt"
class=".users.UsersView"
permission="zope2.View"
/>
<!-- permissions checker -->
<browser:page
for="OFS.interfaces.IFolder"
name="perm_check"
class=".permissions.PermissionsCheckerView"
permission="zope2.View"
allowed_interface=".interfaces.IPermissionsCheckerView"
/>
</configure>.
また、以下は製品のサンプル コードです。
<html metal:use-macro="context/standard_template/macros/page">
<metal:block fill-slot="heading">Users Overview</metal:block>
<metal:block fill-slot="body" tal:define="users view/get_users">
---------Some code--------
</metal:block>
</html>