Changeset 5017
- Timestamp:
- 2003-07-24T04:04:00+12:00 (21 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/comtypes.cpp
r4974 r5017 67 67 httpprefix.clear(); 68 68 receptionist.clear(); 69 auth_collection.clear(); // turned off by default 70 auth_group.clear(); // turned off by default 71 allow_acls= false; // turned off by default 72 allowallexcept.clear(); // turned off by default 73 denyallexcept.clear(); // turned off by default 74 69 70 // Setting some authentication parameters use with 71 // various parts of the code. 72 73 auth_collection.clear(); // turned off by default, individual collection authentication 74 auth_group.clear(); // turned off by default, authentication by groups method 75 allow_acls= false; // turned off by default, our ACL switch either on or off in collect.cfg 76 allowallexcept.clear(); // turned off by default, our allow-all-except <grouplist> 77 denyallexcept.clear(); // turned off by default, out deny-all-except <grouplist> 78 79 75 80 } 76 81 -
trunk/gsdl/src/recpt/receptionist.cpp
r4974 r5017 208 208 // it contains. The configuration should take place after everything 209 209 // has been added but before the initialisation. 210 210 211 void receptionist::configure (const text_t &key, const text_tarray &cfgline) { 211 212 // configure the receptionist 212 213 214 215 213 216 if (cfgline.size() >= 1) { 214 217 cgiarginfo *info = NULL; … … 272 275 } 273 276 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 274 283 else if (key == "SiteFormat") { 275 284 if (cfgline[0] == "HomePageType") { … … 1080 1089 1081 1090 bool 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 1111 1128 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 1120 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 } 1125 1142 col_here ++; 1126 1143 } -
trunk/gsdl/src/recpt/receptionist.h
r4905 r5017 76 76 77 77 struct recptconf { 78 text_t gsdlhome;79 text_t gdbmhome; // will equal gsdlhome if not set80 text_t collection; // will equal "" in 'general' mode81 text_t collectdir; // will equal gsdlhome in 'general' mode82 colinfo_tmap collectinfo;83 text_t httpprefix;84 text_t httpimg; // will equal /images if not set85 text_t gwcgi;86 text_tset macrofiles;87 text_t saveconf;88 bool usecookies; // true if we want cookies set89 bool logcgiargs; // true if we want to log cgi arguments90 91 ldformat_t LogDateFormat;92 93 text_t maintainer; // email address of maintainer94 text_t MailServer; // SMTP mail server to use when sending event messages by email78 text_t gsdlhome; 79 text_t gdbmhome; // will equal gsdlhome if not set 80 text_t collection; // will equal "" in 'general' mode 81 text_t collectdir; // will equal gsdlhome in 'general' mode 82 colinfo_tmap collectinfo; 83 text_t httpprefix; 84 text_t httpimg; // will equal /images if not set 85 text_t gwcgi; 86 text_tset macrofiles; 87 text_t saveconf; 88 bool usecookies; // true if we want cookies set 89 bool logcgiargs; // true if we want to log cgi arguments 90 91 ldformat_t LogDateFormat; 92 93 text_t maintainer; // email address of maintainer 94 text_t MailServer; // SMTP mail server to use when sending event messages by email 95 95 // defaults to mail.maintainer-domain 96 events_t LogEvents; 97 events_t EmailEvents; 98 bool EmailUserEvents; 99 100 text_t HomePageType; 101 int HomePageCols; 102 103 text_tmap pageparams; 104 text_t macroprecedence; 105 106 languageinfo_tmap languages; 107 108 // encodings is just a simple mapping from encoding longnames to 109 // shortnames. It's useful for now for creating the pulldown menu of 110 // encodings on the preferences page but isn't intended to be permanent. 111 text_tmap encodings; 112 113 void clear (); 114 recptconf () {clear();} 96 events_t LogEvents; 97 events_t EmailEvents; 98 bool EmailUserEvents; 99 100 bool site_auth; // Complete site authentication, useful to lockout site for example. 101 text_t site_group; // Similar to the auth_groups functionality, infact exactly the same 102 103 text_t HomePageType; 104 int HomePageCols; 105 106 text_tmap pageparams; 107 text_t macroprecedence; 108 109 languageinfo_tmap languages; 110 111 // encodings is just a simple mapping from encoding longnames to 112 // shortnames. It's useful for now for creating the pulldown menu of 113 // encodings on the preferences page but isn't intended to be permanent. 114 text_tmap encodings; 115 116 void clear (); 117 recptconf () {clear();} 115 118 }; 116 119 117 120 class receptionist : public configurable { 118 121 protected: 119 recptconf configinfo; 120 121 cgiargsinfoclass argsinfo; 122 actionmapclass actions; 123 browsermapclass browsers; 124 recptprotolistclass protocols; 125 displayclass disp; 126 convertinfoclass converters; 127 ColInfoResponse_t collectinfo; 128 129 // prepare_page sets up page parameters, sets display macros 130 // and opens the page ready for output 131 virtual void prepare_page (action *a, cgiargsclass &args, 132 outconvertclass &outconvert, 122 123 recptconf configinfo; 124 125 cgiargsinfoclass argsinfo; 126 actionmapclass actions; 127 browsermapclass browsers; 128 recptprotolistclass protocols; 129 displayclass disp; 130 convertinfoclass converters; 131 ColInfoResponse_t collectinfo; 132 133 // prepare_page sets up page parameters, sets display macros 134 // and opens the page ready for output 135 virtual void prepare_page (action *a, cgiargsclass &args, 136 outconvertclass &outconvert, 133 137 ostream &logout); 134 135 virtual void translate_OIDs (cgiargsclass &args, recptproto *collectproto,136 137 138 bool get_cookie (text_t &cookie, text_tmap &fcgienv);139 bool get_cookie (text_tmap &fcgienv);140 141 // get the default encoding for the given language - if it fails for any142 // reason, return ""143 text_t get_default_encoding (const text_t &language);144 145 virtual void define_general_macros (cgiargsclass &args, outconvertclass &outconvert,146 ostream &logout);147 148 bool append_logstr (const text_t &filename, const text_t &logstr,149 ostream &logout);150 151 virtual void configure_encoding (const text_tarray &cfgline);152 153 public:154 receptionist ();155 virtual ~receptionist() {}156 157 // add_action makes another action available to the receptionist158 // the action remains the property of the calling code and that159 // code should destroy the action after the recptionist has been160 // destroyed.161 void add_action (action *theaction);162 actionmapclass *get_actionmap_ptr () {return &actions;}163 164 // add_browser makes another browser available to the receptionist165 // the browser remains the property of the calling code and that166 // code should destroy it after the recptionist has been167 // destroyed.168 void add_browser (browserclass *thebrowser);169 browsermapclass *get_browsermap_ptr () {return &browsers;}170 void setdefaultbrowser (const text_t &browsername);171 172 // add_protocol makes another protocol available to the receptionist173 // without any protocols, no collections will be available. The174 // protocols remain the property of the calling code.175 void add_protocol (recptproto *theprotocol) {protocols.addrecptproto(theprotocol);}176 recptprotolistclass *get_recptprotolist_ptr () {return &protocols;}177 178 // add_converter makes another converter available to the receptionist.179 // Converters are needed to display pages using different encodings.180 // The converters remain the property of the calling code.181 void add_converter (const text_t &name, inconvertclass *inconverter,182 rzwsoutconvertclass *outconverter) {183 converters.add_converter(name, inconverter, outconverter);}184 convertinfoclass *get_convertinfo_ptr () {return &converters;}185 186 187 // configure should be called for each line in the138 139 virtual void translate_OIDs (cgiargsclass &args, recptproto *collectproto, 140 ostream &logout); 141 142 bool get_cookie (text_t &cookie, text_tmap &fcgienv); 143 bool get_cookie (text_tmap &fcgienv); 144 145 // get the default encoding for the given language - if it fails for any 146 // reason, return "" 147 text_t get_default_encoding (const text_t &language); 148 149 virtual void define_general_macros (cgiargsclass &args, outconvertclass &outconvert, 150 ostream &logout); 151 152 bool append_logstr (const text_t &filename, const text_t &logstr, 153 ostream &logout); 154 155 virtual void configure_encoding (const text_tarray &cfgline); 156 157 public: 158 receptionist (); 159 virtual ~receptionist() {} 160 161 // add_action makes another action available to the receptionist 162 // the action remains the property of the calling code and that 163 // code should destroy the action after the recptionist has been 164 // destroyed. 165 void add_action (action *theaction); 166 actionmapclass *get_actionmap_ptr () {return &actions;} 167 168 // add_browser makes another browser available to the receptionist 169 // the browser remains the property of the calling code and that 170 // code should destroy it after the recptionist has been 171 // destroyed. 172 void add_browser (browserclass *thebrowser); 173 browsermapclass *get_browsermap_ptr () {return &browsers;} 174 void setdefaultbrowser (const text_t &browsername); 175 176 // add_protocol makes another protocol available to the receptionist 177 // without any protocols, no collections will be available. The 178 // protocols remain the property of the calling code. 179 void add_protocol (recptproto *theprotocol) {protocols.addrecptproto(theprotocol);} 180 recptprotolistclass *get_recptprotolist_ptr () {return &protocols;} 181 182 // add_converter makes another converter available to the receptionist. 183 // Converters are needed to display pages using different encodings. 184 // The converters remain the property of the calling code. 185 void add_converter (const text_t &name, inconvertclass *inconverter, 186 rzwsoutconvertclass *outconverter) { 187 converters.add_converter(name, inconverter, outconverter);} 188 convertinfoclass *get_convertinfo_ptr () {return &converters;} 189 190 191 // configure should be called for each line in the 188 192 // configuration files to configure the receptionist and everything 189 193 // it contains. The configuration should take place after everything
Note:
See TracChangeset
for help on using the changeset viewer.