Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cakephp/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jan 9, 2012
2 parents a02a0ee + 4cf95de commit fcb901b
Show file tree
Hide file tree
Showing 14 changed files with 1,715 additions and 30 deletions.
8 changes: 4 additions & 4 deletions en/core-libraries/components/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ callback of your model::

You don't need to hash passwords before calling ``$this->Auth->login()``.
The various authentication objects will hash passwords individually. If
you are using Digest authentication, use should not use
you are using Digest authentication, you should not use
AuthComponent::password() for generating passwords. See below for how
to generate digest hashes.

Expand Down Expand Up @@ -486,7 +486,7 @@ array::
'Controller'
);

Much like ``Auth->authenticate``, ``Auth->authorize``, allows helps you
Much like ``Auth->authenticate``, ``Auth->authorize``, helps you
keep your code DRY, by using the ``all`` key. This special key allows you
to set settings that are passed to every attached object. The all key
is also exposed as ``AuthComponent::ALL``::
Expand All @@ -501,7 +501,7 @@ is also exposed as ``AuthComponent::ALL``::

In the above example, both the ``Actions`` and ``Controller`` will get the
settings defined for the 'all' key. Any settings passed to a specific
authentication object will override the matching key in the 'all' key.
authorization object will override the matching key in the 'all' key.
The core authorize objects support the following configuration keys.

- ``actionPath`` Used by ``ActionsAuthorize`` to locate controller action
Expand Down Expand Up @@ -607,7 +607,7 @@ Mapping actions when using CrudAuthorize
----------------------------------------

When using CrudAuthorize or any other authorize objects that use action
mappings, it is might be necessary to map additional methods. You can
mappings, it might be necessary to map additional methods. You can
map actions -> CRUD permissions using mapAction(). Calling this on
AuthComponent will delegate to all the of the configured authorize
objects, so you can be sure the settings were applied every where::
Expand Down
2 changes: 1 addition & 1 deletion en/development/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ could do the following::
<?php
// in app/Lib/AppErrorHandler.php
class AppErrorHandler {
public static handleException($error) {
public static function handleException($error) {
if ($error instanceof MissingWidgetException) {
return self::handleMissingWidget($error);
}
Expand Down
3 changes: 1 addition & 2 deletions en/development/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ level ``Session`` key, and a number of options are available:
* ``Session.checkAgent`` - Should the user agent be checked, on each request. If
the useragent does not match the session will be destroyed.

* ``Session.autoRegenerate`` - Auto regeneration used to only be available when
``Security.level`` was set to high. Enabling this setting, turns on automatic
* ``Session.autoRegenerate`` - Enabling this setting, turns on automatic
renewal of sessions, and sessionids that change frequently. Enabling this
value will use the session's ``Config.countdown`` value to keep track of requests.
Once the countdown reaches 0, the session id will be regenerated. This is a
Expand Down
8 changes: 4 additions & 4 deletions en/tutorials-and-examples/blog-auth-example/auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Simple Authentication and Authorization Application
Following our :doc:`/tutorials-and-examples/blog/blog` example, imagine we wanted to
secure the access to certain urls, based on the logged in
user. We also have another requirement, to allow our blog to have multiple authors
so each one of then can create their own posts, edit and delete them at will
so each one of them can create their own posts, edit and delete them at will
disallowing other authors to make any changes on one's posts.

Creating all users' related code
Expand Down Expand Up @@ -56,7 +56,7 @@ validating any user data::
);
}

Let's also create our UsersController, the following contents corresponds to a
Let's also create our UsersController, the following contents correspond to a
basic `baked` UsersController class using the code generation utilities bundled
with CakePHP::

Expand Down Expand Up @@ -154,7 +154,7 @@ Authentication (login and logout)
We're now ready to add our authentication layer. In CakePHP this is handled
by the :php:class:`AuthComponent`, a class responsible for requiring login for certain
actions, handling user sign-in and sign-out, and also authorizing logged in
users to the actions the are allowed to reach.
users to the actions are allowed to reach.

To add this component to your application open your ``app/Controller/AppController.php``
file and add the following lines::
Expand Down Expand Up @@ -190,7 +190,7 @@ site.
Now, we need to be able to register new users, save their username and password,
and more importantly hash their password so it is not stored as plain text in
our database. Let's tell the AuthComponent to let un-authenticated users to access
the users add function and the implement the login and logout action::
the users add function and implement the login and logout action::

<?php
// app/Controller/UsersController.php
Expand Down
6 changes: 3 additions & 3 deletions en/tutorials-and-examples/blog/part-two.rst
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ information is available in ``$this->request->data``. You can use the
:php:func:`pr()` or :php:func:`debug()` functions to print it out if you want to see
what it looks like.

We use the SessionComponents' :php:meth:`SessionComponent::setFlash()`
We use the SessionComponent's :php:meth:`SessionComponent::setFlash()`
method to set a message to a session variable to be displayed on the page after
redirection. In the layout we have
:php:func:`SessionHelper::flash` which displays the
Expand Down Expand Up @@ -372,7 +372,7 @@ the form. If a string is supplied as the first parameter to
along with the closing form tag. Again, refer to
:doc:`/views/helpers` for more on helpers.

Now let's go back and update our ``/app/View/Post/index.ctp``
Now let's go back and update our ``/app/View/Posts/index.ctp``
view to include a new "Add Post" link. Before the ``<table>``, add
the following line::

Expand Down Expand Up @@ -436,7 +436,7 @@ like::
This action first checks that the request is a GET request. If it is, then
we find the Post and hand it to the view. If the user request is not a GET, it
probably contains POST data. We'll use the POST data to update our Post record
with, or kick back and show the user the validation errors).
with, or kick back and show the user the validation errors.

The edit view might look something like this::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ controllers and actions into the Acl. However, we all hate doing
repetitive things like typing in what could be hundreds of actions
in a large application.

For this purpose exists a ver handy plugin available at github, called
For this purpose exists a very handy plugin available at github, called
`AclExtras <https://github.com/markstory/acl_extras/tree/2.0>`_ which can
be downloaded in `The Github Downloads page <https://github.com/markstory/acl_extras/zipball/2.0>`_
are we're going to briefly describe how to use it to generate all our ACO's
be downloaded in `The Github Downloads page <https://github.com/markstory/acl_extras/zipball/2.0>`_.
We're going to briefly describe how to use it to generate all our ACO's

First grab a copy of the plugin and unzipped or clone it using git into
`app/Plugin/AclExtras`. Then activate the plugin in your `app/Config/boostrap.php`
Expand Down Expand Up @@ -40,7 +40,7 @@ Setting up permissions

Creating permissions much like creating ACO's has no magic solution, nor will I
be providing one. To allow ARO's access to ACO's from the shell interface use
the AclShell. For more information on how to use it consult the aclShell help
the AclShell. For more information on how to use it consult the AclShell help
which can be accessed by running::

./Console/cake acl --help
Expand All @@ -63,12 +63,12 @@ function::

<?php

function beforeFilter() {
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('initDB'); // We can remove this line after we're finished
}

function initDB() {
public function initDB() {
$group = $this->User->Group;
//Allow admins to everything
$group->id = 1;
Expand Down Expand Up @@ -116,7 +116,7 @@ in your users and groups controllers. Then add the following to
your posts and widgets controllers::

<?php
function beforeFilter() {
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index', 'view');
}
Expand All @@ -131,7 +131,7 @@ actions in posts and widgets controllers. In

This makes the 'display' action public. This will keep our
PagesController::display() public. This is important as often the
default routing has this action as the home page for you
default routing has this action as the home page for your
application.

Logging in
Expand All @@ -155,7 +155,7 @@ If a user is already logged in, redirect him by adding this to your
UsersController::

<?php
function login() {
public function login() {
if ($this->Session->read('Auth.User')) {
$this->Session->setFlash('You are logged in!');
$this->redirect('/', null, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Acl components. First add a login and logout action to your
``UsersController``::

<?php
function login() {
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
Expand All @@ -128,7 +128,7 @@ Acl components. First add a login and logout action to your
}
}
function logout() {
public function logout() {
//Leave empty for now.
}

Expand Down Expand Up @@ -179,7 +179,7 @@ site controlled with Auth and Acl, we will set them up in
);
public $helpers = array('Html', 'Form', 'Session');
function beforeFilter() {
public function beforeFilter() {
//Configure AuthComponent
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
Expand All @@ -195,7 +195,7 @@ and users. In **both** your ``GroupsController`` and your
``UsersController`` Add the following::

<?php
function beforeFilter() {
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('*');
}
Expand Down Expand Up @@ -245,7 +245,7 @@ our ``User`` model we will add the following::
public $belongsTo = array('Group');
public $actsAs = array('Acl' => array('type' => 'requester'));
function parentNode() {
public function parentNode() {
if (!$this->id && empty($this->data)) {
return null;
}
Expand All @@ -268,7 +268,7 @@ Then in our ``Group`` Model Add the following::
class Group extends Model {
public $actsAs = array('Acl' => array('type' => 'requester'));
function parentNode() {
public function parentNode() {
return null;
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ In case we want simplified per-group only permissions, we need to
implement ``bindNode()`` in ``User`` model::

<?php
function bindNode($user) {
public function bindNode($user) {
return array('model' => 'Group', 'foreign_key' => $user['User']['group_id']);
}

Expand Down
1 change: 1 addition & 0 deletions ja/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
getting-started
cakephp-overview
deployment
tutorials-and-examples
contributing
appendices

Expand Down
17 changes: 17 additions & 0 deletions ja/tutorials-and-examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
チュートリアルと例
##################

このセクションで、典型的なCakePHPアプリケーションのデモンストレーションを行い、全てのピースがどう組み合わさっていくかを学ぶことができます。

その他にも、既存のアプリケーションやコンポーネントについて、非公式のCakePHPプラグイン倉庫 `CakePackages <http://cakepackages.com/>`_ や、 `Bakery <http://bakery.cakephp.org/>`_ を参考にすることもできます。

.. toctree::
:glob:
:maxdepth: 1

tutorials-and-examples/blog/blog
tutorials-and-examples/blog/part-two
tutorials-and-examples/blog-auth-example/auth
tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application
tutorials-and-examples/simple-acl-controlled-application/part-two

Loading

0 comments on commit fcb901b

Please sign in to comment.