I did some testing & noted that since we authenticate through active
directory, our users never seem to hit '/login' from a debug print 'req.
path_info'
I implemented the IRequestFilter & was wondering if this method was too
invasive
def pre_process_request(self, req, handler):
updateScript = self.config.get('updateusersession',
'update_script_location', '');
self.log.debug("updateusersession entered for evaluation for '%s'" %
req.authname);
if (updateScript and updateScript != ''):
updateDisplay = self.config.get('updateusersession',
'update_when_display_is_empty', False);
updateEmail = self.config.get('updateusersession',
'update_when_email_is_empty' , False);
for user, display, email in self.env.get_known_users():
if user != req.authname:
continue;
if (updateDisplay and (display is None or len(display) == 0)
) or (updateEmail and (email is None or len(email) == 0) ):
self.log.debug("updateusersession calling script '%s'
with arguments:'%s' '%s'" % ( updateScript, self.env.path, user ) );
results = subprocess.Popen("%s %s %s" % (updateScript,
self.env.path, user ),
shell=True,stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
results.communicate()
return handler
On Tuesday, September 18, 2018 at 12:02:40 AM UTC-4, RjOllos wrote:
>
>
>
> On Monday, September 17, 2018 at 12:10:37 PM UTC-7, Adam Howell wrote:
>>
>> Is there a way to implement a custom script to kick off when an anonymous
>> user logs in?
>>
>> We have a access request trac for our tracs & it is configured so that
>> any user that can authenticate with active directory, can access this trac.
>>
>> I would like to kick off a script to update the session table when
>> an anonymous user logs in.
>>
>> The intent is to update the session table with information gathered from
>> Active Directory when a user has no entry in the session table.
>>
>
> You might be able to implement IRequestFilter and act on requests to
> /login:
>
> https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestFilter
>
> https://trac.edgewall.org/browser/tags/trac-1.2.3/trac/web/auth.py?marks=129,131#L126
>
> - Ryan
>
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.