Can't Add User Permissions

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Can't Add User Permissions

Post by gandalf »

This is not a known problem. Please tell us the cacti release you're using
R.
j0s3
Posts: 12
Joined: Fri Oct 01, 2010 7:17 pm

Re: Can't Add User Permissions

Post by j0s3 »

i have the same problem, recently made an upgrade to 0.8.7g, i cant make any changes whit the users...

Notice: Undefined variable: policy in /var/www/localhost/htdocs/cacti/user_admin.php on line 525
on diferent lines

my cacti log:


05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1064', SQL:"REPLACE INTO user_auth_perms (user_id,item_id,type) VALUES (,28,3)'
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_templates_graph.local_graph_id, graph_templates_graph.title_cache FROM graph_templates_graph LEFT JOIN user_auth_perms ON (graph_templates_graph.local_graph_id = user_auth_perms.item_id AND user_auth_perms.type = 1) WHERE graph_templates_graph.local_graph_id > 0 AND user_auth_perms.user_id = ORDER BY graph_templates_graph.title_cache"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT local_graph_id, title_cache FROM graph_templates_graph WHERE local_graph_id > 0 AND local_graph_id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=1 AND user_auth_perms.user_id=) ORDER BY title_cache"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT host.id, CONCAT('',host.description,' (',host.hostname,')') as name FROM host LEFT JOIN user_auth_perms ON (host.id = user_auth_perms.item_id AND user_auth_perms.type = 3) WHERE user_auth_perms.user_id = ORDER BY host.description,host.hostname"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT id, CONCAT('',description,' (',hostname,')') AS name FROM host WHERE host.id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=3 AND user_auth_perms.user_id=) ORDER BY description,hostname"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_templates.id, graph_templates.name from graph_templates LEFT JOIN user_auth_perms ON (graph_templates.id = user_auth_perms.item_id AND user_auth_perms.type = 4) WHERE user_auth_perms.user_id = ORDER BY graph_templates.name"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT id, name FROM graph_templates WHERE id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=4 AND user_auth_perms.user_id=) ORDER BY name"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_tree.id, graph_tree.name from graph_tree LEFT JOIN user_auth_perms ON (graph_tree.id = user_auth_perms.item_id AND user_auth_perms.type = 2) WHERE user_auth_perms.user_id = ORDER BY graph_tree.name"
05/19/2011 10:40:59 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT id, name FROM graph_tree WHERE id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=2 AND user_auth_perms.user_id= ) ORDER BY name"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_templates_graph.local_graph_id, graph_templates_graph.title_cache FROM graph_templates_graph LEFT JOIN user_auth_perms ON (graph_templates_graph.local_graph_id = user_auth_perms.item_id AND user_auth_perms.type = 1) WHERE graph_templates_graph.local_graph_id > 0 AND user_auth_perms.user_id = ORDER BY graph_templates_graph.title_cache"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT local_graph_id, title_cache FROM graph_templates_graph WHERE local_graph_id > 0 AND local_graph_id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=1 AND user_auth_perms.user_id=) ORDER BY title_cache"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT host.id, CONCAT('',host.description,' (',host.hostname,')') as name FROM host LEFT JOIN user_auth_perms ON (host.id = user_auth_perms.item_id AND user_auth_perms.type = 3) WHERE user_auth_perms.user_id = ORDER BY host.description,host.hostname"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT id, CONCAT('',description,' (',hostname,')') AS name FROM host WHERE host.id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=3 AND user_auth_perms.user_id=) ORDER BY description,hostname"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_templates.id, graph_templates.name from graph_templates LEFT JOIN user_auth_perms ON (graph_templates.id = user_auth_perms.item_id AND user_auth_perms.type = 4) WHERE user_auth_perms.user_id = ORDER BY graph_templates.name"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT id, name FROM graph_templates WHERE id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=4 AND user_auth_perms.user_id=) ORDER BY name"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT graph_tree.id, graph_tree.name from graph_tree LEFT JOIN user_auth_perms ON (graph_tree.id = user_auth_perms.item_id AND user_auth_perms.type = 2) WHERE user_auth_perms.user_id = ORDER BY graph_tree.name"
05/19/2011 10:41:02 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"SELECT id, name FROM graph_tree WHERE id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=2 AND user_auth_perms.user_id= ) ORDER BY name"

tnks 4 your help
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Can't Add User Permissions

Post by gandalf »

Please post the url seen when you try to edit that user. It seems, that the userid is not provided as requested.
R.
clubber
Posts: 3
Joined: Mon May 23, 2011 10:22 am

Re: Can't Add User Permissions

Post by clubber »

Hi,

I'm getting the exact same errors (from error_log):

[Mon May 23 17:09:51 2011] [error] [client 213.189.3.5] PHP Notice: Undefined index: id in /var/www/html/user_admin.php on line 457, referer: http://213.189.3.170/user_admin.php?action=user_edit
[Mon May 23 17:09:51 2011] [error] [client 213.189.3.5] PHP Notice: Undefined variable: policy in /var/www/html/user_admin.php on line 530, referer: http://213.189.3.170/user_admin.php?action=user_edit
[Mon May 23 17:09:51 2011] [error] [client 213.189.3.5] PHP Notice: Undefined variable: policy in /var/www/html/user_admin.php on line 588, referer: http://213.189.3.170/user_admin.php?action=user_edit
[Mon May 23 17:09:51 2011] [error] [client 213.189.3.5] PHP Notice: Undefined variable: policy in /var/www/html/user_admin.php on line 648, referer: http://213.189.3.170/user_admin.php?action=user_edit
[Mon May 23 17:09:51 2011] [error] [client 213.189.3.5] PHP Notice: Undefined variable: policy in /var/www/html/user_admin.php on line 707, referer: http://213.189.3.170/user_admin.php?action=user_edit

Centos 5.6/apache2/mysql5/php5
Cacti 0.8.7g
PIA 2.8 with aggregate/discovery/fix64bit/manage/monitor/realtime/settings/thold

This installation is 4 days old, on saturday adding users was still working properly, PIA + the plugins were installed friday as well.

Add/edit an user is simply not possible anymore, i've deleted all plugins (no go) and i've added them again (no go as well), just to make sure it was not a problem caused by a plugin. For the rest cacti seems to work just fine except for the user part.
j0s3
Posts: 12
Joined: Fri Oct 01, 2010 7:17 pm

Re: Can't Add User Permissions

Post by j0s3 »

this is my user add errores, all the fields are empty..that its after pressing the add button

tnks..
Attachments
user
user
cacti_user.png (35.83 KiB) Viewed 2494 times
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Can't Add User Permissions

Post by noname »

Try to modify user_admin.php.
At the last part of function user_edit(), replace

Code: Select all

        if (get_request_var_request("tab") == "graph_settings_edit") {
                graph_settings_edit();
        }elseif (get_request_var_request("tab") == "user_realms_edit") {
                user_realms_edit();
        }elseif (get_request_var_request("tab") == "graph_perms_edit") {
                graph_perms_edit();
        }else{
                user_realms_edit();
        }
with this:

Code: Select all

-->     if (empty($_GET["id"])) {
-->             user_realms_edit();
        }elseif (get_request_var_request("tab") == "graph_settings_edit") {
                graph_settings_edit();
        }elseif (get_request_var_request("tab") == "user_realms_edit") {
                user_realms_edit();
        }elseif (get_request_var_request("tab") == "graph_perms_edit") {
                graph_perms_edit();
        }else{
                user_realms_edit();
        }
Or, without modifying, try workaround as follows:
(1) Click existing user in User Management
(2) Click "Realm Permissions" tab (and don't click other tab after this)
(3) Go 'User Management' again, then click 'Add'


Because it should be shown "Realm Permissions" tab when creating new user,
but it seems that Cacti remembers "Which tab was looked at just before in user settings".
And function user_realms_edit() performs null-checking of user's ID, but other functions don't so.

(FYI: In Cacti 0.8.7e, these behavior depends "action" variable)

But -- just a guess -- if you push "Create" button anyway, Cacti will create new user even if you got errors.
Once new user is created, you can select any tab...

// Sorry my English
clubber
Posts: 3
Joined: Mon May 23, 2011 10:22 am

Re: Can't Add User Permissions

Post by clubber »

Hey Noname,

Editting user_admin.php breaks the whole user_admin.php (simply a blank page cause of incorrect variables). The other work arround was already known to me but is useless... since you either have to assign all devices/trees/graphs to an user in order for them to see something in the inventory. That's not an option when you have a lot of devices/graphs.

Perhaps gandalf can shine a light on this issue?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Can't Add User Permissions

Post by noname »

@clubber:

Sorry for inconvenience,
but when I did as mentioned, I got errors as the same as you (and solved).

I tested that at Cacti 0.8.7g + Official Patch + PIA 2.9 + settings/thold/monitor/clog plugins.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Can't Add User Permissions

Post by noname »

It's suggestive information...

http://forums.cacti.net/viewtopic.php?p=212253#p212253
Also using IE9 I see "Notice: Undefined variable: policy in /spazio/siti/cacti/user_admin.php on line 530", not displayed using chrome or ffox.
clubber
Posts: 3
Joined: Mon May 23, 2011 10:22 am

Re: Can't Add User Permissions

Post by clubber »

I've been testing and it seems it does work correctly under firefox but not under IE8/9, which is a bad thing in my eyes.

I have no clue how this can be resolved, but for the time being i know a way to add new user accounts. Thanks noname for pointing out that thread.
j0s3
Posts: 12
Joined: Fri Oct 01, 2010 7:17 pm

Re: Can't Add User Permissions

Post by j0s3 »

thnks clubber! ... works fine on firefox, but thats a temporal solution... :)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests