Skip to content

Commit

Permalink
adding routing hints to readme
Browse files Browse the repository at this point in the history
setting display field
missing import for AppController
  • Loading branch information
mohamnag committed Jan 22, 2014
1 parent 38b2796 commit 077b750
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
Empty file added Console/Command/empty
Empty file.
2 changes: 2 additions & 0 deletions Controller/CakeUserAppController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

App::uses('AppController', 'Controller');

class CakeUserAppController extends AppController {

public $actsAs = array('Containable');
Expand Down
8 changes: 7 additions & 1 deletion Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
*/
class User extends CakeUserAppModel {

/**
* Display field
*
* @var string
*/
public $displayField = 'username';
public $belongsTo = array(
'UserGroup' => array(
'className' => 'CakeUser.UserGroup',
),
);
public $actsAs = array('Acl' => array(
'type' => 'requester',
'type' => 'requester',
));

public function parentNode() {
Expand Down
7 changes: 7 additions & 0 deletions Model/UserGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class UserGroup extends CakeUserAppModel {

const DEFAULT_GROUP_ID = 1;

/**
* Display field
*
* @var string
*/
public $displayField = 'title';
public $belongsTo = array(
'ParentUserGroup' => array(
'className' => 'CakeUser.UserGroup',
Expand Down Expand Up @@ -100,4 +106,5 @@ public function __construct($id = false, $table = null, $ds = null) {
),
);
}

}
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public $components = array(
'Acl',
'Auth' => array(
'loginAction' => array(
'plugin' => 'cake_user',
'controller' => 'users',
'plugin' => 'CakeUser',
'controller' => 'cake_user_users',
'action' => 'login'
),
'authenticate' => array(
Expand All @@ -50,7 +50,7 @@ Import the sql file from ```app/Plugin/CakeUser/Config/Schema/cakeuser.sql``` in
Change config in ```app/Plugin/CakeUser/Config/bootstrap.php``` where necessary.

### Register first user
We assume the first user who is registered is the administrator. To prevent further problems, just after installing the plugin, naviagte to ```http://yourserveraddress.com/cake_user/users/register```, fill the form and register your first user.
We assume the first user who is registered is the administrator. To prevent further problems, just after installing the plugin, naviagte to ```http://yourserveraddress.com/cake_user/cake_user_users/register```, fill the form and register your first user.

The schema file contains some pre-filled user groups. The first group is a neutral group which will be also assigned to all new registrations, keep that in mind.

Expand All @@ -67,8 +67,8 @@ public $components = array(
'Acl',
'Auth' => array(
'loginAction' => array(
'plugin' => 'cake_user',
'controller' => 'users',
'plugin' => 'CakeUser',
'controller' => 'cake_user_users',
'action' => 'login'
),
'authenticate' => array(
Expand Down Expand Up @@ -97,5 +97,12 @@ At this point you may need to grant your administrator access to all of the ```c

At this point you are setup and ready, navigate to any address on your site and login using the administrator (first user) you just registered and you should be able to see the page.

## Change the route
In order to access the plugin's actions with a custom path add following to your ```routes.php``` file:
```php
Router::connect('/members/:action/*', array('plugin' => 'CakeUser', 'controller' => 'cake_user_users'));
Router::connect('/members/*', array('plugin' => 'CakeUser', 'controller' => 'cake_user_users'));
```

## License
This plugin ins licensed under MIT license.

0 comments on commit 077b750

Please sign in to comment.