in reply to Re^2: Integrating Perl cgi forms with Drupal site, any advise on unified login issue?
in thread Integrating Perl cgi forms with Drupal site, any advise on unified login issue?

I would be grateful for comments and suggestions.

um, make it a module, a kwalitee module with documentation, that describes what it does , say something along the lines of

# is_user_valid( # is_user_loggedin( # is_user_user( # is_user( is_authenticated_drupal( dbi => $dbi, cookie => $cookie, ); # can_user_do_this( # is_user_allowed_to( is_authenticated_drupal( dbi => $dbi, cookie => $cookie , page => $page, section => $section, something_else => $something, );

But maybe you want to make it a CGI::Session::Auth plugin so you'd suit the interface to boot

But not having done anything DRUPAL, I'm not even sure this is the best way (raw SQL access) -- I can't imagine that drupal doesn't have an official api independent of backend for authorentication/authorization

  • Comment on Re^3: Integrating Perl cgi forms with Drupal site, any advise on unified login issue?
  • Download Code

Replies are listed 'Best First'.
Re^4: Integrating Perl cgi forms with Drupal site, any advise on unified login issue?
by dimuse_dioplut (Initiate) on May 27, 2013 at 08:48 UTC

    Thank you for your answer, maybe one day be a module

    I probably did not quite understand the last about Drupal API.
    It's possible to send POST with username and password and receive an answer with user data ...
    but then I myself have to check my cookie security by my system.
    They need to generate, store, watch out if they are out of date, etc. It's harder, I think?
    Perhaps this is the solution for those cases when the systems are in different servers.
    But then an additional security risk?

      I don't think you get my meaning. Consider
      my $exitcod_zero_means_something = system '/usr/local/bin/drupal_fun_authenticator', '--cookie=cookie', ... ;;;;; ### or sub is_authorized { my ( $authcookie, ... ) = @_; my $wget = join ' ', map { "'$_'" } "--header=cookie:$authcookie", 'https://localhost:3000/hey_drupal_authenticate_by_cookie', ... ;;;;; my $json_auth_str = qx{wget $wget } my $auth = decode_json( $json_auth_str ); return 1 if $auth->{is_authorized}; return 0; }

      drupal, being so popular and what not, surely has such an interface -- I'd go looking for it -- official API is safer than peeking into the database

        Thank you. Yes, it is a interesting, and, I think, right way. But I do not find such modules in Drupal yet.
Re^4: Integrating Perl cgi forms with Drupal site, any advise on unified login issue?
by pmagunia (Initiate) on Sep 05, 2013 at 08:12 UTC
    @dimuse_dioplut Thank you for making the code available to the public in perlmonks- it is proving to be useful for me. Have you created a module yet out of the code you posted?
      Welcome "Have you created a module yet out of the code you posted?" No. It seems it will be not soon. Sorry.