1

私のアプリケーションは 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>
4

1 に答える 1

3

.metadataファイルはスキンオブジェクトにのみ適用されます。ブラウザビューの場合、ビューのZCML構成でアクセス許可を指定する必要があります。

<browser:page
    for="*"
    name="somepagename"
    template="pagetemplate.pt"
    permission="zope.View"
    />

権限を指定します。コンテキストは、どのロールにどの権限があるかを定義します。

于 2013-02-12T20:49:26.663 に答える