derricksmith / phpsaml

GLPI Plugin - SAML integration using the Onelogin SAML Library
MIT License
32 stars 24 forks source link

JIT is not applying Authorizations assignment rules #97

Closed DonutsNL closed 3 months ago

DonutsNL commented 2 years ago

Currently the JIT is ignoring the Authorizations assignment rules and will create the user using glpi default rules in the root entity with the default profile.

Ldap rules are just that, designed for ldap sync.

DonutsNL commented 2 years ago

applyRightRules require some ldap specifics. Going to do some tests to see if this method is usable.

derricksmith commented 2 years ago

Thanks for your work on this one!

Ketchup31 commented 2 years ago

Also interested by this feature. Thank you for the great job and support !!!

DonutsNL commented 2 years ago

There is some documentation but its not up to date. https://glpi-developer-documentation.readthedocs.io/en/master/devapi/rules.html

Am in the process of applying these rules and backwards engineer a bit 😅

Ketchup31 commented 2 years ago

Ok .. We believe in you :crossed_fingers: Thank you

DonutsNL commented 2 years ago

Update: Its kinda frustrating.

I have the rules interface working but its not matching the criteria correctly and is not updating the user object as a result.

@derricksmith is it oké to upload the sources for the rules engine. I think i can use some help in getting the created rules to match. Testing the rule in the interface works as expected. The update will introduce a rules conf option that allowes rules to be created in a saml sub_type.

image image

derricksmith commented 1 year ago

I'm not super familiar with the rules workflow. Can you create a PR so I can see what you want to add?

derricksmith commented 1 year ago

I created a branch called Rules Engine. If its easier for you, just send the files over to derricksmith01@msn.com and I'll upload to the branch.

DonutsNL commented 1 year ago

created a pull request with the changes made : https://github.com/derricksmith/phpsaml/pull/116

Its possible to create PHPSaml rules in the GLPI interface. image image

I created a testscript in the branch to test these rules. It reports that the rule is matched correctly and it is applying the rules. image

The problem is that the rules are in fact not applied (when validating). image

No error is generated. I was about to start tracing the database for update statements and see what (if anything) is happening.

DonutsNL commented 1 year ago

As i expected, its is not performing the update action. Im not sure why. image

DonutsNL commented 1 year ago

A hook is performed on the plugin's ruleright.class.php method executeActions($output, $params, array $input = []) { }, it seems that we need to implement the updates our self's.

DonutsNL commented 1 year ago

@derricksmith, I am sure I am missing something important 😅

The rules that need to be applied are getting lost during the 'doHook()' thats being called in the rule.php->process method. See debug trace screenshots below.

Any ideas?

image Arguments are not passed by reference here.

image image image Not a work-around for this specific implementation, the return values are not captured by the calling method and are lost. see next screen. Not sure where the PLUGIN_HOOKS are populated and why the expected values seem to be missing from the array

image

LaurDaniel commented 11 months ago

Hi @DonutsNL, Did you find a solution on this? Thanks!