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

plugin: improve callback for job.validate #413

Closed
cmoussa1 opened this issue Jan 31, 2024 · 1 comment
Closed

plugin: improve callback for job.validate #413

cmoussa1 opened this issue Jan 31, 2024 · 1 comment
Assignees
Labels
new feature new feature plugin related to the multi-factor priority plugin

Comments

@cmoussa1
Copy link
Member

In this callback, a manual lookup of a user/bank (i.e an association) is performed using a combination of iterators that access the plugin's internal map. This sort of lookup of an association is repeated numerous times throughout the plugin code.

Instead, I think I can create an external function that lives in accounting.cpp that does this lookup, and replace the manual lookups in validate_cb () and similar callbacks with calls to this new external function. This new external function can return an address of the association in the plugin's internal map or NULL on failure, and validate_cb () can either continue on with its job validation using this address, or reject the job on failure (because it can't find the association passed in).

The other small improvement that comes with using this new external function is reading the different validation steps in the callback become a little easier to read, i.e bank_it->second.active == 0 becomes association->active == 0 since we don't have to use an iterator here in the callback.

This callback could also use some improvements to its comments and function description.

@cmoussa1 cmoussa1 added new feature new feature plugin related to the multi-factor priority plugin labels Jan 31, 2024
@cmoussa1 cmoussa1 self-assigned this Jan 31, 2024
@cmoussa1
Copy link
Member Author

cmoussa1 commented Feb 7, 2024

Closed by #415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature new feature plugin related to the multi-factor priority plugin
Projects
None yet
Development

No branches or pull requests

1 participant