Making the button work

These documentation pages are no longer maintained. Please visit the new documentation site.

If you try to click the "Sign the guestbook" button at this point, you'll probably meet a rude page that resembles the following screenshot.

That's right buddy, the object is unavailable! This phenomenon is perfectly normal; and the explanation is fairly simple. When clicked, the "Sign the guestbook" button that we just put in initiates an action within the content management system. eZ publish will attempt to create a new object using the current user, which in this case (since nobody is logged in) is the built-in "Anonymous" user. Not surprisingly, the default security settings do not allow anonymous users to mess around with content. In order to make the button work, we'll simply have to let anonymous users to be able to do two things:

  • Create guestbook entries within the guestbook section
  • Edit the contents of guestbook entries

The following step-by-step guide explains how to enable this functionality.

  1. Make sure that you're logged into the administration interface.
  2. Click on the "User accounts" tab.
    A list of users/groups will appear.
  3. Click on "Roles and policies" (from within the menu on the left hand side).
    A list of roles will appear.
  4. Click on the "Anonymous" user.
    The properties of the Anonymous user will appear.
  5. Click on the "Edit" button.
  6. Click the "New policy" button.
  7. Select "Content" from the "Module" dropdown box.
  8. Click the "Grant access to one function" button.
  9. Select "Create" from the "Function" dropdown box.
  10. Click the "Grant limited access" button.
  11. Set the class to "Guestbook", the section to "Guestbook section" and the ParentClass to "Any".
  12. Click the "OK" button.

At this point, the list of role policies for the anonymous user should look something like this:

The previous list of steps took care of adding "Create" privileges to the anonymous role. In addition, we'll also have to add "edit" privileges to this role. Repeat the previous steps, but this time make sure that you select the "Edit" function (at step two) and that you select "Self" from within the owner list (at step three). The rest of the selections should be the same as in the list of steps presented above.

At this point, the list of role policies for the anonymous user should look something like this:

Comments

typo

6 item: <Click on the "Anonymous" user. The properties of the Anonymous user will appear.>

But must be "ROLE" instead of "USER".

Contents

Building an eZ publish site

Prerequisits
Situation
Creating the TSCM site
Testing the interfaces
Setting up the main layout
Creating sections
The welcome page
The news page
The members page
The guestbook
    Creating the content class
    Adding content
    Creating the template
    Adding an action button
    Making the button work
    The input template
    Testing the guestbook
    Implementing an approval mechanism
    Modifying the entry page
    Creating a workflow
    Connecting the workflow to a trigger...
    Approving entries
    The "runcronjob" script
The links page


Created

19/11/2003
1:47:08 pm
by Balazs Halasy

Last updated

23/11/2004
2:20:06 pm
by Raymond Bosman

Authors

Balazs Halasy
Raymond Bosman



This page is part of the eZ Publish documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.