Ignore:
Timestamp:
2003-07-24T04:04:00+12:00 (21 years ago)
Author:
sjboddie
Message:

Added site configuration directives site_auth and site_groups for site wide
authentication using the existing groups and password authentication structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/receptionist.cpp

    r4974 r5017  
    208208// it contains. The configuration should take place after everything
    209209// has been added but before the initialisation.
     210
    210211void receptionist::configure (const text_t &key, const text_tarray &cfgline) {
    211212  // configure the receptionist
    212213
     214   
     215   
    213216  if (cfgline.size() >= 1) {
    214217    cgiarginfo *info = NULL;
     
    272275    }
    273276
     277    // Read in the value for the site_auth directive either true or false
     278    else if (key == "site_auth") configinfo.site_auth = (cfgline[0] == "true");
     279
     280    else if (key == "site_group")
     281       joinchar(cfgline,',',configinfo.site_group);
     282       
    274283    else if (key == "SiteFormat") {
    275284       if (cfgline[0] == "HomePageType") {
     
    10801089
    10811090bool receptionist::check_mainargs (cgiargsclass &args, ostream &logout) {
    1082   // if this receptionist is running in collection dependant mode
    1083   // then it should always set the collection argument to the
    1084   // collection
    1085   if (!configinfo.collection.empty()) args["c"] = configinfo.collection;
    1086 
    1087   // if current collection uses ccscols make sure
    1088   // "ccs" argument is set and make "cc" default to
    1089   // all collections in "ccs"
    1090   if (args["a"] != "config" && !args["c"].empty()) {
    1091 
    1092     text_t &arg_c = args["c"];
    1093     recptproto *collectproto = protocols.getrecptproto (arg_c, logout);
    1094     if (collectproto == NULL) {
    1095       // oops, this collection isn't valid
    1096       outconvertclass text_t2ascii;
    1097       logout << text_t2ascii << "ERROR: Invalid collection: " << arg_c << "\n";
    1098       args["c"].clear();
    1099 
    1100     } else {
    1101 
    1102        ColInfoResponse_t *cinfo = get_collectinfo_ptr (collectproto, arg_c, logout);
    1103 
    1104        if(cinfo->auth_collection == "collection")
    1105       {
    1106          args["uan"] = "1";
    1107          args["ug"] = cinfo->auth_group;
    1108       }
    1109        
    1110        
     1091   
     1092   if(configinfo.site_auth)
     1093      {
     1094     args["uan"] = "1";
     1095     args["ug"] = configinfo.site_group;
     1096      }
     1097   
     1098   
     1099   // if this receptionist is running in collection dependant mode
     1100   // then it should always set the collection argument to the
     1101   // collection
     1102   if (!configinfo.collection.empty()) args["c"] = configinfo.collection;
     1103   
     1104   // if current collection uses ccscols make sure
     1105   // "ccs" argument is set and make "cc" default to
     1106   // all collections in "ccs"
     1107   if (args["a"] != "config" && !args["c"].empty()) {
     1108     
     1109      text_t &arg_c = args["c"];
     1110      recptproto *collectproto = protocols.getrecptproto (arg_c, logout);
     1111      if (collectproto == NULL) {
     1112     // oops, this collection isn't valid
     1113     outconvertclass text_t2ascii;
     1114     logout << text_t2ascii << "ERROR: Invalid collection: " << arg_c << "\n";
     1115     args["c"].clear();
     1116     
     1117      } else {
     1118     
     1119     ColInfoResponse_t *cinfo = get_collectinfo_ptr (collectproto, arg_c, logout);
     1120     
     1121     if(cinfo->auth_collection == "collection")
     1122        {
     1123           args["uan"] = "1";
     1124           args["ug"] = cinfo->auth_group;
     1125        }
     1126     
     1127     
    11111128      if (cinfo != NULL) {
    1112     if (!cinfo->ccsCols.empty()) {
    1113       args["ccs"] = 1;
    1114       if (args["cc"].empty()) {
    1115         text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
    1116         text_tarray::const_iterator col_end = cinfo->ccsCols.end();
    1117         bool first = true;
    1118         while (col_here != col_end) {
    1119           // make sure it's a valid collection
    1120           if (protocols.getrecptproto (*col_here, logout) != NULL) {
    1121         if (!first) args["cc"].push_back (',');
    1122         args["cc"] += *col_here;
    1123         first = false;
    1124           }
     1129     if (!cinfo->ccsCols.empty()) {
     1130        args["ccs"] = 1;
     1131        if (args["cc"].empty()) {
     1132           text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
     1133           text_tarray::const_iterator col_end = cinfo->ccsCols.end();
     1134           bool first = true;
     1135           while (col_here != col_end) {
     1136          // make sure it's a valid collection
     1137          if (protocols.getrecptproto (*col_here, logout) != NULL) {
     1138             if (!first) args["cc"].push_back (',');
     1139             args["cc"] += *col_here;
     1140             first = false;
     1141          }
    11251142          col_here ++;
    11261143        }
Note: See TracChangeset for help on using the changeset viewer.