PHP code example of anroots / db-acl

1. Go to this page and download the library: Download anroots/db-acl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anroots / db-acl example snippets


// ...
public function save_customer() {
	$current_user = Auth::instance()->get_user();

	if (!$current_user->can(Permission::EDIT_CUSTOMERS)) {
		throw new Authorization_Exception();
	}

	// Save the Customer ORM model
	$this->save();
}
// ...


class Model_Permission extends ACL_Model_Permission {
	const EDIT_USERS = 1;
	const ADD_NEW_POST = 2;
}

$user->can(Model_Permission::EDIT_USERS);
javascript
{
	".4.0",
		"composer/installers": "*",
		"anroots/db-acl":"1.*"
	}
}