Update: still working on this (component is already over 900 lines,
including documentation, which is about 70% of the code).
When the component runs for the first time it will set up PhpGacl database
schema (so there's no need to do anything other than just include phpGacl on
your vendors directory, and then adding PhpGacl as a component to your
controller), and create AXO groups/AXO objects for each controller/action
(see at the bottom of this message)
Let me give you a quick view on how you programmatically manipulate your ACL
data:
// Add groups
$this->PhpGacl->saveGroup(1, 'my group #1 with ID 1');
$this->PhpGacl->saveGroup(2, 'my group #1 with ID 2');
// Modify group
$this->PhpGacl->saveGroup(2, 'my group #1 with ID 2 with new name');
// Get groups
$groups = $this->PhpGacl->getGroups();
/*
This gets you a threaded array like:
Array
(
[0] => Array
(
[id] => authenticated
[name] => Authenticated
)
[1] => Array
(
[id] => 2
[name] => my group #1
)
[2] => Array
(
[id] => 3
[name] => my group #2
[children] => Array
(
[0] => Array
(
[id] => 5
[name] => my group #2.1
)
)
)
[3] => Array
(
[id] => 4
[name] => my group #3
)
)
*/
// Add user:
$this->PhpGacl->saveUser(1, 'mariano.iglesias');
// Modify user:
$this->PhpGacl->saveUser(1, 'mariano.iglesias (new)');
// Assign groups to user:
$this->PhpGacl->assign(1, array(1, 2));
// Get user groups:
$this->PhpGacl->getUserGroups(1);
/*
* This gets you an array like:
*
* Array
* (
* [0] => 1,
* [1] => 2,
* [2] => authenticated
* )
*/
// Change user group assignments:
$this->PhpGacl->assign(1, array(2, 'authenticated'));
/*
* After which the previous assigned group #1 will be un-assigned, #2
* will remain assigned, and 'authenticated' will be added to the assignment
*/
// Delete group (and related data):
$this->PhpGacl->delGroup(3);
/*
* By default if the group has children, they will be added as children
* of this group's parent. But if you call it like:
*
* $this->PhpGacl->delGroup(3, false);
*
* Then the children will also be deleted.
*
* Naturally deleting a group means that assignments with this group are
* also removed
*/
// Delete user (and related data):
$this->PhpGacl->delUser(1);
// Add controller and its actions as AXO objects:
$this->PhpGacl->saveController('Posts');
/*
* It creates an AXO group called Posts, and assigned to them
* one AXO object per action.
*
* If the controller was already added, only new actions are
* added
*/
Next step I'm working on is the assignment of rules between group ->
controller/action, and user -> controller/action.
After that wrap phpGACL check, set up a few things, and then release the
first version (without the plugin to manipulate data via GUI)
-MI
---------------------------------------------------------------------------
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
blog: http://www.MarianoIglesias.com.ar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---