Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primary admin account not always given access to a plugin when that plugin is enabled #2319

Closed
ddb4github opened this issue Jan 17, 2019 · 2 comments
Labels
bug Undesired behaviour

Comments

@ddb4github
Copy link
Contributor

Cacti define 'Primary Admin' by settings --> authentication --> 'admin_user'
But hardcode 'admin' user when the '$admin' param is true in function api_plugin_register_realm. Prefer diff as:

--- lib/plugins.php      2019-01-03 17:48:19.000000000 +0800
+++ lib/plugins.php       2019-01-17 23:32:17.627607316 +0800
@@ -760,9 +760,7 @@

                        $realm_id = $realm_id + 100;

-                       $user_ids[] = db_fetch_cell("SELECT id
-                               FROM user_auth
-                               WHERE username = 'admin'", false);
+                       $user_ids[] = read_config_option('admin_user');

                        if (isset($_SESSION['sess_user_id'])) {
                                $user_ids[] = $_SESSION['sess_user_id'];
@netniV
Copy link
Member

netniV commented Jan 17, 2019

I think I agree with that. If you want to create a PR then we can submit that change for you.

@netniV netniV added the bug Undesired behaviour label Jan 17, 2019
@netniV netniV changed the title api_plugin_register_realm grant wrong admin account when the latest param is true Plugins access granted to wrong admin account when enabled Jan 17, 2019
@netniV netniV changed the title Plugins access granted to wrong admin account when enabled Wrong admin account given access to a plugin when that plugin is enabled Jan 17, 2019
@netniV netniV changed the title Wrong admin account given access to a plugin when that plugin is enabled Primary admin account not always given access to a plugin when that plugin is enabled Jan 17, 2019
netniV added a commit that referenced this issue Jan 17, 2019
Primary admin account not always given access to a plugin when that plugin is enabled as previously it was hardcoded to 'admin'
@netniV
Copy link
Member

netniV commented Jan 17, 2019

I have now done this as it was a one liner. But it is also good to have the changes as a pull request if you can so you can be identified as the source of the change for future references 👍

@netniV netniV closed this as completed Jan 17, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour
Projects
None yet
Development

No branches or pull requests

2 participants