pedrazadixon / cakeapp
CakePHP skeleton app
Requires
- php: >=5.6
- cakephp/acl: ~0.2
- cakephp/cakephp: 3.6.*
- cakephp/migrations: ^2.0.0
- cakephp/plugin-installer: ^1.0
- ivanamat/cakephp3-aclmanager: 1.*
- josegonzalez/dotenv: 3.*
- mobiledetect/mobiledetectlib: 2.*
Requires (Dev)
- cakephp/bake: ^1.1
- cakephp/cakephp-codesniffer: ^3.0
- cakephp/debug_kit: ^3.15.0
- psy/psysh: @stable
Suggests
- dereuromark/cakephp-ide-helper: After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility.
- markstory/asset_compress: An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.
- phpunit/phpunit: Allows automated tests to be run without system-wide install.
README
A skeleton for creating applications with CakePHP 3.x. The skeleton has been preloaded with the Acl, AclManager plugins. Manages groups, roles, users and ACL.
Loaded plugins
- The framework source code can be found here: cakephp/cakephp.
- The Acl plugin source code can be found here: cakephp/acl.
- The AclManager plugin source code can be found here: ivanamat/cakephp3-aclmanager.
Installation
- Download Composer.
- Run
php composer.phar create-project --prefer-dist pedrazadixon/cakeapp app_name
.
If Composer is installed globally, run
composer self-update && composer create-project --prefer-dist pedrazadixon/cakeapp app_name
You should now be able to visit the path to where you installed the app and see the setup traffic lights.
Configuration
MySQL
Import the config/schema/cakephp.sql
file to your database.
APP
Read and edit config/app.php
and setup the 'Datasources' and any other
configuration relevant for your application.
Uncomment $this->Auth->allow();
from initialize function on AppController
. This lets you create Groups, Roles and Users.
public function initialize() {
...
// Only for ACL setup
$this->Auth->allow();
}
Uncumment return true;
from isAuthorized function on AppController
. This allows you to access the Acl Manager plugin.
public function isAuthorized($user) {
// Only for ACL setup
return true;
...
}
Create the first group, the main role and the first user.
- Now go to the Groups area and create your first group.
- Access Roles area and create a new role for the group you created. It is recommended to create the first role with the name 'Root'. The role you have created with id 1 will always have all permissions.
- Create a user with the group and role you just created.
- Log in on
/Users/login
as the user created, go to/AclManager
and click onRestore to default
to create ACOs and AROs automatically.
Comment the uncommented
Comment $this->Auth->allow();
from initialize function and return true;
from isAuthorized function on AppController
.
public function initialize() {
...
// Only for ACL setup
// $this->Auth->allow();
}
public function isAuthorized($user) {
// Only for ACL setup
// return true;
...
}
Enjoy!
Now you can start customizing your permissions and Develop your app. Do not forget to update the ACOs when creating new functions.
Changelog
v1.2
- Updated version requirement to 1.* for latest ivanamat/cakephp3-aclmanager.
- Updated version requirement to ~1.0 for latest cakephp/plugin-installer.
Author
Iván Amat on GitHub
www.ivanamat.es
Modified
Dixon Pedraza - GitHub