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

New hook to notify plugins of user profile changes ('auth_profile_update_data') #2654

Closed
YongBoLiu opened this issue Apr 29, 2019 · 0 comments
Labels
enhancement General tag for an enhancement
Milestone

Comments

@YongBoLiu
Copy link
Contributor

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

We need a hook for plugins to update customize profile data, as we did for clear/reset in api_auth_clear_user_settings()/api_auth_clear_user_setting().

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add a hook, such as auth_profile_update_data, to update plugin's profile data. Then other plugins can update their profile data to their own DB table.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

The code change like below,

diff -u -N rtm/cacti/auth_profile.php rtm/cacti/auth_profile.php
--- rtm/cacti/auth_profile.php	2019-02-28 10:52:54.000000028 +0800
+++ rtm/cacti/auth_profile.php	2019-04-29 10:03:18.000000424 +0800
@@ -51,7 +51,12 @@
 		$name  = get_nfilter_request_var('name');
 		$value = get_nfilter_request_var('value');
 
-		api_auth_update_user_setting($name, $value);
+		$current_tab = get_nfilter_request_var('tab');
+		if ($current_tab == 'general') {
+			api_auth_update_user_setting($name, $value);
+		} else {
+			api_plugin_hook_function('auth_profile_update_data', $current_tab);
+		}
 
 		break;
 	default:
@netniV netniV changed the title A hook of 'update_data' in auth_profile.php is needed New feature to notify plugins of user profile changes ('auth_profile_update_data' ) Apr 29, 2019
@netniV netniV added the enhancement General tag for an enhancement label Apr 29, 2019
@netniV netniV added this to the v1.2.4 milestone Apr 29, 2019
@netniV netniV changed the title New feature to notify plugins of user profile changes ('auth_profile_update_data' ) New hook to notify plugins of user profile changes ('auth_profile_update_data' ) Apr 29, 2019
@netniV netniV changed the title New hook to notify plugins of user profile changes ('auth_profile_update_data' ) New hook to notify plugins of user profile changes ('auth_profile_update_data') Apr 29, 2019
@netniV netniV closed this as completed in 9c21511 Apr 29, 2019
ddb4github pushed a commit to ddb4github/documentation that referenced this issue Apr 18, 2020
  Cacti/cacti#2153: retire utilities.php for hook 'user_admin_tab'
  Cacti/cacti#2153: Remove hook 'user_admin_tab' add 'utilities_tab' hook in utilities.php
  Cacti/cacti#3392: Add 4 device_xxxx hooks to 'develop' branch
  Cacti/cacti#2654: Add hook 'auth_profile_update_data'
  Other 5 auth_profile_xxx hooks around 1.2.0-beta3
  Incorrect retired version of 'poller_command_args'
TheWitness pushed a commit to Cacti/documentation that referenced this issue Apr 18, 2020
Cacti/cacti#2153: retire utilities.php for hook 'user_admin_tab'
  Cacti/cacti#2153: Remove hook 'user_admin_tab' add 'utilities_tab' hook in utilities.php
  Cacti/cacti#3392: Add 4 device_xxxx hooks to 'develop' branch
  Cacti/cacti#2654: Add hook 'auth_profile_update_data'
  Other 5 auth_profile_xxx hooks around 1.2.0-beta3
  Incorrect retired version of 'poller_command_args'

Co-authored-by: Jing Chen <three_chenjing@sohu.com>
@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
enhancement General tag for an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants