weblogics / Codeigniter-Ion-Auth-ACL

Add's ACL to Ion Auth
GNU General Public License v2.0
29 stars 19 forks source link

Add Permission #3

Closed Brhmts closed 7 years ago

Brhmts commented 7 years ago

Hi Steve , First Thank you for your effort with this usefull library .

When we add a permission

perm_key => any key perm_name => class\method
value=> false or true

How should fill the add permission form?

trying solve data logic .. Could you give an example to save permission ? for example user group id =1 cant save users , users/create

steve-goodwin commented 7 years ago

Hi @Brhmts,

You can add permissions in one of two ways, firstly you can add a permission to a group which can be done like this:

Add Permission To A Group

This will allow or deny a specific permission against a group, users who inherit this group will also inherit all permissions as well.

This takes three parameters:

Usage:

$this->ion_auth_acl->add_permission_to_group($group_id, $permission_id, $value);

Add Permission To A User

This will allow or deny a specific permission against a user regardless of whether the group permission is set to allow or deny.

This takes three parameters:

Usage:

$this->ion_auth_acl->add_permission_to_user($user_id, $permission_id, $value);

Removing permissions from groups and users

If you want to do the reverse of what's above then follow the following, these should be pretty self-explanatory:

Remove permission from group

$this->ion_auth_acl->remove_permission_from_group($group_id, $permission_id);

Remove permission from user

$this->ion_auth_acl->remove_permission_from_user($user_id, $permission_id);

If you need any further help then just give me a shout