- Timestamp:
- 2023-09-29T20:52:00+13:00 (9 months ago)
- Location:
- main/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r37677 r38256 252 252 Configuration.template_config_xml = Configuration.TEMPLATE_CONFIG_PREFIX + Configuration.CONFIG_WEBSWING_XML; 253 253 Configuration.config_xml = Configuration.CONFIG_WEBSWING_XML; 254 255 256 if(go.userJSessionID != null) { 257 webswingAuthenticator = new WebswingAuthenticator(go.username, go.usergroups, go.userJSessionID); 258 } 254 259 } 255 260 else { … … 291 296 } 292 297 // we need to authenticate the user 293 webswingAuthenticator = new WebswingAuthenticator(); 298 //if(webswingAuthenticator == null || webswingAuthenticator.getUserName() == null) { 299 if(webswingAuthenticator == null) { 300 webswingAuthenticator = new WebswingAuthenticator(); 301 } 294 302 if (!webswingAuthenticator.authenticate(library_url_string)) { 295 303 System.err.println("Authentication error, quitting GLI"); 296 304 System.exit(0); 297 305 } 298 306 299 307 String username = webswingAuthenticator.getUsername(); 300 308 … … 2115 2123 static protected String username; 2116 2124 static protected HashSet<String> groups; 2125 static protected String userJSessionID; 2126 static protected String rawgroups; 2117 2127 2118 2128 protected void displayError(String error_message) { … … 2124 2134 } 2125 2135 2136 public WebswingAuthenticator() {} 2137 2138 public WebswingAuthenticator(String username, String usergroups, String sessionID) { 2139 this.username = username; 2140 this.rawgroups = usergroups; 2141 this.userJSessionID = sessionID; 2142 } 2143 2126 2144 public String getUsername() { 2127 2145 return username; … … 2130 2148 2131 2149 public boolean authenticate(String library_url_string) { 2150 if(username == null) { 2132 2151 PasswordAuthentication pa = getPasswordAuthentication(); 2133 2152 if (pa == null) { … … 2171 2190 return false; 2172 2191 } 2192 } else { 2193 result = rawgroups; 2194 } 2173 2195 groups = new HashSet<String>(); 2174 2196 String[] contents = result.split(","); … … 2182 2204 System.err.println("User not in any collection editing groups"); 2183 2205 displayError(Dictionary.get("WebswingAuthenticationError.NoPermissions")); 2184 return false; // user has no editing priv eleges2206 return false; // user has no editing privileges 2185 2207 } 2186 2208 return true; -
main/trunk/gli/src/org/greenstone/gatherer/GetOpt.java
r37188 r38256 59 59 60 60 protected FedoraInfo fedora_info = null; 61 62 public String userJSessionID = null; 63 public String username = null; 64 public String usergroups = null; 61 65 62 66 public GetOpt(String[] args) … … 224 228 no_load = false; 225 229 } 230 // If logged in userdata specified: -username <user> -groups <grps> -uid JSESSIONID 231 else if(argument_name.equals(StaticStrings.USERNAME_ARGUMENT)) { 232 username = argument_value; 233 } 234 else if(argument_name.equals(StaticStrings.USERGROUPS_ARGUMENT)) { 235 usergroups = argument_value; 236 } 237 else if(argument_name.equals(StaticStrings.USERID_ARGUMENT)) { 238 userJSessionID = argument_value; 239 } 226 240 // Parse the file path of the local library server 227 241 else if (argument_name.equals(StaticStrings.LOCAL_LIBRARY_ARGUMENT)) { -
main/trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
r37677 r38256 288 288 static final public String USE_METADATA_FILES_ARGUMENT = "use_metadata_files"; 289 289 static final public String USE_REMOTE_GREENSTONE_ARGUMENT = "-use_remote_greenstone"; 290 static final public String WEBSWING_ARGUMENT = "-webswing"; 290 static final public String USERNAME_ARGUMENT = "-username"; 291 static final public String USERGROUPS_ARGUMENT = "-groups"; 292 static final public String USERID_ARGUMENT = "-uid"; 293 static final public String WEBSWING_ARGUMENT = "-webswing"; 291 294 static final public String URL_SEPARATOR_CHARACTER = "/"; 292 295 static final public String VALUE_ATTRIBUTE = "value"; -
main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js
r38238 r38256 616 616 } 617 617 618 619 gs.funcions.getLoggedInUser = function() 620 { 621 var baseURL = gs.xsltParams.library_name + "?a=g&rt=r&ro=1&s=CurrentUser&"; 622 } 623 618 624 // Prepare the payload (data package) to transmit to metadataserver.pl over AJAX. 619 625 // These next 2 functions prepare both the URL version of the payload and the data object version -
main/trunk/greenstone3/web/interfaces/default/transform/javascript-global-setup.xsl
r37805 r38256 161 161 </script> 162 162 </xsl:if> 163 <!-- check if we have a JSessionID and fill in any user details we haven't captured in JS vars yet as well as JSessionID --> 164 <xsl:if test="/page/pageRequest/userContext/@uid"> 165 <script type="text/javascript"> 166 <xsl:text disable-output-escaping="yes"> 167 if (typeof gs.userInformation === "undefined") { 168 gs.userInformation={}; 169 gs.userInformation.username = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@username"/><xsl:text disable-output-escaping="yes">"; 170 gs.userInformation.groups = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@groups"/><xsl:text disable-output-escaping="yes">"; 171 } 172 gs.userInformation.uid = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@uid"/><xsl:text disable-output-escaping="yes">"; 173 </xsl:text> 174 </script> 175 </xsl:if> 163 176 </xsl:template> 164 177 … … 167 180 <script type="text/javascript" src="interfaces/{$interface_name}/js/GSMetadata.js"><xsl:text> </xsl:text></script> 168 181 <script type="text/javascript" src="interfaces/{$interface_name}/js/utility_scripts.js"><xsl:text> </xsl:text></script> 169 170 182 </xsl:template> 171 183 </xsl:stylesheet> -
main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-gli.xsl
r37417 r38256 132 132 webswingInstance0.options.args = "-load " + gs.cgiParams.c + "/gli.col"; 133 133 } 134 if(gs.userInformation.uid) { 135 webswingInstance0.options.args = " -username " + gs.userInformation.username; 136 webswingInstance0.options.args = " -groups " + gs.userInformation.groups.replace(/\s/g, ''); 137 webswingInstance0.options.args = " -uid " + gs.userInformation.uid; 138 } 134 139 function getParam(name) { 135 140 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
Note:
See TracChangeset
for help on using the changeset viewer.