Home » Authentication » LiveUser » Bug #4311
DB schema doesn't allow groups to have multiple rights
Details
| Submitted | 2005-05-10 10:45 UTC |
|---|---|
| From | scragz at hotmail dot com |
| Status | Bogus |
| Package | LiveUser |
| PHP Version | 4.3.10 |
| OS | SuSE 9.3 |
| Roadmaps | (Not assigned) |
Comments
[2005-05-10 10:45 UTC] scragz at hotmail dot com
Description:
------------
Previously, with the SQL generation scripts, the liveuser_grouprights table had a unique index on group_id and right_id *together*. Now, with the MDB schema, it gets two separate unique indexes.
This prevents one from giving a single group multiple rights because each group_id can only be in the table once.
Reproduce code:
---------------
$right_ids[] = $admin->perm->addRight(
array(
'area_id' => $areas_id,
'right_define_name' => 'TEST_RIGHT_1'
)
);
$right_ids[] = $admin->perm->addRight(
array(
'area_id' => $areas_id,
'right_define_name' => 'TEST_RIGHT_2'
)
);
foreach ($right_ids as $right_id) {
$admin->perm->grantGroupRight(
array(
'group_id' => $group_id,
'right_id' => $right_id
)
);
}
Expected result:
----------------
Group rights are added.
Actual result:
--------------
MDB2 Error: constraint violation
[2005-05-10 10:54 UTC] scragz at hotmail dot com
Similar multiple indexes are being created on the following tables as well:
liveuser_area_admin_areas
liveuser_group_subgroups
liveuser_groupusers
liveuser_right_implied
liveuser_userrights
I'm attempting to upgrade from 0.13.3 and I figured it would be best to generate the tables from scratch.
[2005-05-10 12:47 UTC] smith at backendmedia dot com
Arnaud had similar issues as well at one point. IIRC he ended up reinstalling his PEAR dir and then things suddenly magically worked ...
[2005-05-10 20:30 UTC] scragz at hotmail dot com
Okay, this bug is sort of bogus. I was using the install.php and stuff from CVS because the one in the 0.15.1 depends on some things in MDB2 that were removed in 2.0.0beta4. The one in CVS looks like it was updated to work with the new MDB2_Schema stuff, but it doesn't create the indexes correctly. So, I guess consider this a heads-up that the CVS version is broken (which is expected).
[2005-05-10 20:32 UTC] smith at backendmedia dot com
hmm LiveUser cvs is not supposed to be broken atm, if you have any pointers that will be appreciated. I need to get things fixed up in the next few days for a talk anyways.
[2005-05-10 23:33 UTC] scragz at hotmail dot com
Basically, the index part towards the end of LiveUser_Misc_Schema_Install::generatePermSchema() is outputting:
<index>
<name>group_id</name>
<unique>1</unique>
<field>
<name>group_id</name>
</field>
</index>
<index>
<name>right_id</name>
<unique>1</unique>
<field>
<name>right_id</name>
</field>
</index>
instead of:
<index>
<name>group_right_rel</name>
<unique>1</unique>
<field>
<name>group_id</name>
</field>
<field>
<name>right_id</name>
</field>
</index>
Just using the perm_mdb_schema.xml that comes with it instead of generating them _should_ work, but I had some problems with that as well. I don't really have time right now to figure out all that is going on there any better to give a real fix.
[2005-05-11 00:30 UTC] scragz at hotmail dot com
You know what? I just realized that in all my screwing around since the install.php in 0.15.1 didn't work with the latest MDB2, I ended up with the install.php and MDB2/MDB2_Schema from CVS but the rest of LiveUser from 0.15.1.
Bogosity confirmed. Sorry for the hassle.