-
Bug
-
Resolution: Fixed
-
3.0.0
-
None
-
PHP Environment: 5.1.1
Database: Mysql 5.0.18
If acl_set_role is used to populate a roles settings after acl_add_option has been used to add the rights inserted into that role, the SQL Statements generated are similar to this:
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) VALUES (24, 0, 0)
As it can be seen, the auth_option_id is wrong, if you are setting more than one right and you are setting it to ACL_YES, auth_admin will try to insert more than one row at a time with the exact same Values:
(25, 0, 1), (25, 0, 1) ... which of course leads to an error "Duplicate Entry...".
This error is the result of acl_add_option not updating the auth_admin Objects option_ids attribute adding the new options, so that acl_set_role is not able to access the new options and therefore inserting 0 for the auth_option_id.
It should be possible to resolve this problem by simply updating the auth class with a call to the constructor at the very end of acl_add_option after deleting the options attribute which will reinitialize the attribute with all values:
Find:
$db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
|
|
|
$cache->destroy('_acl_options');
|
$this->acl_clear_prefetch();
|
After add:
$this->option_ids = array();
|
$this->auth_admin();
|

