Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
documentation:latest:plugincustom [2019/04/08 15:35]
coudot [Plugin Perl module]
documentation:latest:plugincustom [2019/12/07 21:45] (current)
Line 11: Line 11:
   * ''​forAuthUser'':​ method called for already authenticated users   * ''​forAuthUser'':​ method called for already authenticated users
   * ''​beforeLogout'':​ method called before logout   * ''​beforeLogout'':​ method called before logout
 +
 +If you need to call a method just after any standard method in authentication process, then use ''​afterSub'',​ for example:
 +<code perl>
 +  use constant afterSub => {
 +      getUser => '​mysub',​
 +  }
 +  sub mysub {
 +      my ( $self ,$req ) = @_;
 +      # Do something
 +      return PE_OK;
 +  }
 +</​code>​
 +
 +If you need to call a method instead any standard method in authentication process, then use ''​aroundSub'',​ for example:
 +<code perl>
 +  use constant aroundSub => {
 +      getUser => '​mysub',​
 +  };
 +  sub mysub {
 +      my ( $self, $sub, $req ) = @_;
 +      # Do something before
 +      my $ret = $sub->​($req);​
 +      # Do something after
 +      return $ret;
 +  }
 +</​code>​
  
 The plugin can also define new routes and call actions on them. The plugin can also define new routes and call actions on them.
Line 73: Line 99:
 ;​customPlugins = Lemonldap::​NG::​Portal::​MyPlugin1,​ Lemonldap::​NG::​Portal::​MyPlugin2,​ ... ;​customPlugins = Lemonldap::​NG::​Portal::​MyPlugin1,​ Lemonldap::​NG::​Portal::​MyPlugin2,​ ...
 </​file>​ </​file>​
 +
 +Since 2.0.7, it can also be configured in Manager, in General Parameters > Plugins > Custom Plugins.