Ignore:
Timestamp:
2013-05-03T18:25:10+12:00 (11 years ago)
Author:
ak19
Message:

This commit contains bugfixes for authentication within metadata-server.pl and related perl code, and is committed separately before changes in gsajaxapi.js start to make use of it. Another important change is that for adding user comments, a user need not be in the collection's group, so checking the group shouldn't be performed. The bugfixes are to get the authentication to work and are in addition to an earlier commit that corrected the name of the authentication_enable variable in baseaction.pm. The bugfixes are: users.gdb instead of users.db, metadata-server.pl needs to call gsdlCGI's encrypt_password otherwise the password check will fail because it won't match with what's in the db. Also, the calls to authenticate_user had to be through the self variable, since its a method not a function and failed to work correctly otherwise.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm

    r27261 r27295  
    250250    # Authenticate user if it is enabled
    251251    if ($baseaction::authentication_enabled) {
    252     # Ensure the user is allowed to edit this collection
    253     &authenticate_user($gsdl_cgi, $username, $collect);
     252    # Ensure the user is allowed to edit this collection   
     253    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    254254    }
    255255
     
    309309    # Authenticate user if it is enabled
    310310    if ($baseaction::authentication_enabled) {
    311         # Ensure the user is allowed to edit this collection
    312         &authenticate_user($gsdl_cgi, $username, $collect);
     311        # Ensure the user is allowed to edit this collection
     312        $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    313313    }
    314314
     
    444444    # Authenticate user if it is enabled
    445445    if ($baseaction::authentication_enabled) {
    446         # Ensure the user is allowed to edit this collection
    447         &authenticate_user($gsdl_cgi, $username, $collect);
     446        # Ensure the user is allowed to edit this collection       
     447        $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    448448    }
    449449
     
    614614 
    615615    if ($baseaction::authentication_enabled) {
    616     # Ensure the user is allowed to edit this collection
    617     &authenticate_user($gsdl_cgi, $username, $collect);
     616    # Ensure the user is allowed to edit this collection   
     617    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    618618    }
    619619
     
    847847
    848848    if ($baseaction::authentication_enabled) {
    849     # Ensure the user is allowed to edit this collection
    850     &authenticate_user($gsdl_cgi, $username, $collect);
     849    # Ensure the user is allowed to edit this collection   
     850    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    851851    }
    852852
     
    889889   
    890890    if ($baseaction::authentication_enabled) {
    891     # Ensure the user is allowed to edit this collection
    892     #&authenticate_user($gsdl_cgi, $username, $collect);
    893     $self->authenticate_user($username, $collect);
     891    # Ensure the user is allowed to edit this collection   
     892    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    894893    }
    895894   
     
    963962    if ($baseaction::authentication_enabled) {
    964963    # Ensure the user is allowed to edit this collection
    965     &authenticate_user($gsdl_cgi, $username, $collect);
     964    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    966965    }
    967966
     
    10791078
    10801079    if ($baseaction::authentication_enabled) {
    1081     # Ensure the user is allowed to edit this collection
    1082     &authenticate_user($gsdl_cgi, $username, $collect);
     1080    # Ensure the user is allowed to edit this collection   
     1081    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    10831082    }
    10841083
     
    11921191
    11931192    if ($baseaction::authentication_enabled) {
    1194     # Ensure the user is allowed to edit this collection
    1195     &authenticate_user($gsdl_cgi, $username, $collect);
     1193    # Ensure the user is allowed to edit this collection   
     1194    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    11961195    }
    11971196
     
    16851684
    16861685    if ($baseaction::authentication_enabled) {
    1687     # Ensure the user is allowed to edit this collection
    1688     &authenticate_user($gsdl_cgi, $username, $collect);
     1686    # Ensure the user is allowed to edit this collection   
     1687    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    16891688    }
    16901689
     
    17821781    if ($baseaction::authentication_enabled)
    17831782    {
    1784         # Ensure the user is allowed to edit this collection
    1785         &authenticate_user($gsdl_cgi, $username, $collect);
     1783        # Ensure the user is allowed to edit this collection       
     1784        $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    17861785    }
    17871786
     
    22202219   
    22212220    if ($baseaction::authentication_enabled) {
    2222         # Ensure the user is allowed to edit this collection
    2223         $self->authenticate_user($username, $collect);
     2221    # Ensure the user is allowed to edit this collection
     2222    $self->authenticate_user($username, $collect);
    22242223    }
    22252224
     
    22442243
    22452244    if ($baseaction::authentication_enabled) {
    2246     # Ensure the user is allowed to edit this collection
    2247     &authenticate_user($gsdl_cgi, $username, $collect);
     2245    # Ensure the user is allowed to edit this collection   
     2246    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    22482247    }
    22492248
     
    25272526   
    25282527    if ($baseaction::authentication_enabled) {
    2529         # Ensure the user is allowed to edit this collection
    2530         &authenticate_user($gsdl_cgi, $username, $collect);
     2528        # Ensure the user is allowed to edit this collection       
     2529        $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    25312530    }
    25322531
     
    26952694   
    26962695    if ($baseaction::authentication_enabled) {
    2697     # Ensure the user is allowed to edit this collection
    2698     &authenticate_user($gsdl_cgi, $username, $collect);
     2696    # Ensure the user is allowed to edit this collection   
     2697    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    26992698    }
    27002699
     
    27222721
    27232722    if ($baseaction::authentication_enabled) {
    2724     # Ensure the user is allowed to edit this collection
    2725     &authenticate_user($gsdl_cgi, $username, $collect);
     2723    # Ensure the user is allowed to edit this collection   
     2724    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    27262725    }
    27272726
     
    28422841   
    28432842    if ($baseaction::authentication_enabled) {
    2844     # Ensure the user is allowed to edit this collection
    2845     &authenticate_user($gsdl_cgi, $username, $collect);
     2843    # Ensure the user is allowed to edit this collection   
     2844    $self->authenticate_user($username, $collect); #&authenticate_user($gsdl_cgi, $username, $collect);
    28462845    }
    28472846
Note: See TracChangeset for help on using the changeset viewer.