View Full Version : Error-reAssigning permissions
Prabhakar
26-07-04, 09:08 PM
Hello
I am getting the following error when i re-assigning permissions to a user for projects, firs time i set deny permissions to projects, later some time i realised and tried to change the permission to read-write. the n i got the following error.
cpermission::store failed
Duplicate entry 'projects--1-8' for key 2
pls solve this...
regards,
Prab
cyberhorse
27-07-04, 12:47 AM
did you try to delete it and add it again after that?
Prabhakar
27-07-04, 02:45 PM
No, I did not tried that, but i updated the database table values manually
UPDATE PERMISSIONS SET PERMISSION_VALUE='-1' WHERE permission_id=xx
cyberhorse
27-07-04, 07:52 PM
and did that work?
greg.donald
10-09-04, 02:19 AM
I found the same issue.
INSERT INTO permissions ( permission_id,permission_user,permission_grant_on, permission_item,permission_value ) VALUES ( '0','9','all','-1','-1' ) ;
is the query generated when I try to change a user's permissions. It breaks because of the key
UNIQUE KEY `idx_pgrant_on` (`permission_grant_on`,`permission_item`,`permissi on_user`)
The permissions object is being saved without first removing the existing object with the same unique key constraints.
Anyone have a fix?
greg.donald
10-09-04, 03:06 AM
until a cleaner fix is implemented, I added this to store() in dp.class.php:
if($this->_tbl == 'permissions'){
$sql = "
DELETE FROM permissions
WHERE permission_grant_on = '$this->permission_grant_on'
AND permission_item = '$this->permission_item'
AND permission_user = '$this->permission_user'
";
db_exec($sql);
}
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.