*** empty log message ***
This commit is contained in:
45
venice-data/xmlrpc/session-metadata.xml
Normal file
45
venice-data/xmlrpc/session-metadata.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
(the "License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Venice Web Communities System.
|
||||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
-->
|
||||
<metadata-file>
|
||||
<metadata method="venice:session.destroy">
|
||||
<signature>
|
||||
<param>string</param>
|
||||
<return>boolean</return>
|
||||
</signature>
|
||||
<doc><![CDATA[
|
||||
Ends a Venice session.
|
||||
Parameter: The session identifier
|
||||
Returns: Boolean TRUE value on success
|
||||
]]></doc>
|
||||
</metadata>
|
||||
<metadata method="venice:session.login">
|
||||
<signature>
|
||||
<param>string</param>
|
||||
<param>string</param>
|
||||
<param>string</param>
|
||||
<return>boolean</return>
|
||||
</signature>
|
||||
<doc><![CDATA[
|
||||
Logs into a Venice session. Please note that you must create a new session with the venice:session.create
|
||||
method before you log into it.
|
||||
Parameters: The session identifier, user name, and password
|
||||
Returns: Boolean TRUE value on success
|
||||
]]></doc>
|
||||
</metadata>
|
||||
</metadata-file>
|
||||
97
venice-data/xmlrpc/session.js
Normal file
97
venice-data/xmlrpc/session.js
Normal file
@@ -0,0 +1,97 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importPackage(Packages.com.silverwrist.dynamo.xmlrpc);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importPackage(Packages.com.silverwrist.venice.session);
|
||||
importPackage(Packages.com.silverwrist.venice.xmlrpc);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
req_help = bsf.lookupBean("request_help"); // get request helper
|
||||
session = req_help.getSession(); // get session
|
||||
method = req.queryString + ""; // get method name
|
||||
|
||||
if (method=="venice:session.destroy")
|
||||
{ // destroy - takes one parameter, the session ID
|
||||
if (req.getParameters().size()!=1)
|
||||
dynamo.scriptReturn(new XmlRpcParameterError("parameter count mismatch");
|
||||
session.invalidate(); // invalidate the session
|
||||
dynamo.scriptReturn(Boolean.TRUE);
|
||||
|
||||
} // end if
|
||||
|
||||
if (method=="venice:session.login")
|
||||
{ // login - parameters are session ID, user name, and password
|
||||
if (req.getParameters().size()!=3)
|
||||
dynamo.scriptReturn(new XmlRpcParameterError("parameter count mismatch");
|
||||
username = req_help.getParameterString("1");
|
||||
password = req_help.getParameterString("2");
|
||||
|
||||
// Check to make sure the user isn't already logged in.
|
||||
old_user = vlib.getUser(session);
|
||||
if (!(old_user.isAnonymous()))
|
||||
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.IS_LOGGEDIN,"session already logged in"));
|
||||
|
||||
// Perform the login.
|
||||
new_user = vlib.lookupUser(req,username);
|
||||
if (new_user!=null)
|
||||
{ // the user is present - we can do this
|
||||
if (new_user.isAnonymous())
|
||||
{ // anonymous user account - can't log in
|
||||
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Anonymous user");
|
||||
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_NOLOGIN,"account cannot be logged into"));
|
||||
|
||||
} // end if
|
||||
|
||||
if (new_user.isLocked())
|
||||
{ // account is locked - we can't log in
|
||||
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Locked Account");
|
||||
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_LOCKED,"account locked: " + username));
|
||||
|
||||
} // end if
|
||||
|
||||
if (new_user.authenticate(UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",password))
|
||||
{ // authentication successful - set this user into the session and return
|
||||
logger.debug("User \"" + new_user.name + "\" logged in successfully");
|
||||
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,new_user);
|
||||
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.ok");
|
||||
new_user.setLastAccessDate(new_user,new java.util.Date());
|
||||
dynamo.exec("/util/setup_user.js");
|
||||
dynamo.scriptReturn(Boolean.TRUE);
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // authentication failed
|
||||
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad password");
|
||||
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_NOAUTH,"authentication failed: " + username));
|
||||
|
||||
} // end else
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // the user is not found
|
||||
audit.write(req,null,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad username",username);
|
||||
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_NOTFOUND,"no such user: " + username));
|
||||
|
||||
} // end else
|
||||
|
||||
} // end if
|
||||
|
||||
// if get here, we don't grok the method name - return failure
|
||||
dynamo.scriptOutput(new XmlRpcMethodNotFound(method));
|
||||
33
venice-data/xmlrpc/siteinfo-metadata.xml
Normal file
33
venice-data/xmlrpc/siteinfo-metadata.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
(the "License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Venice Web Communities System.
|
||||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
-->
|
||||
<metadata-file>
|
||||
<metadata method="venice:siteinfo">
|
||||
<signature>
|
||||
<return>struct</return>
|
||||
</signature>
|
||||
<doc><![CDATA[
|
||||
Returns a structure with various members that describe this server, including:
|
||||
'dynamoVersion' - The DYNAMO Framework revision number.
|
||||
'veniceVersion' - The Venice version number.
|
||||
'siteName' - The name of this site.
|
||||
'siteURL' - The URL to this site.
|
||||
'siteContact' - The E-mail address of the contact person for this site (the site's administrator).
|
||||
]]></doc>
|
||||
</metadata>
|
||||
</metadata-file>
|
||||
53
venice-data/xmlrpc/siteinfo.js
Normal file
53
venice-data/xmlrpc/siteinfo.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(java.util);
|
||||
importClass(Packages.com.silverwrist.dynamo.DynamoVersion);
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.security);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importPackage(Packages.com.silverwrist.dynamo.xmlrpc);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceVersion);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
req_help = bsf.lookupBean("request_help"); // get request helper
|
||||
method = req.queryString + ""; // get method name
|
||||
|
||||
if (method=="venice:siteinfo")
|
||||
{ // return a structure with site information
|
||||
rc = new Hashtable();
|
||||
rc.put("dynamoVersion",DynamoVersion.VERSION);
|
||||
rc.put("veniceVersion",VeniceVersion.VERSION);
|
||||
|
||||
// get globals to stuff into return structure
|
||||
globals = vcast.getGlobalPropertiesStore(req);
|
||||
rc.put("siteName",globals.getObject(VeniceNamespaces.FRAME_LAF_NAMESPACE,"site.title"));
|
||||
rc.put("siteURL",globals.getObject(VeniceNamespaces.FRAME_LAF_NAMESPACE,"site.url"));
|
||||
|
||||
// get contact info for this server - the Administrator's E-mail address
|
||||
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
|
||||
"srm"));
|
||||
rc.put("siteContact",srm.getAdminUser().getEMailAddress());
|
||||
|
||||
// all done!
|
||||
dynamo.scriptReturn(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
// if get here, we don't grok the method name - return failure
|
||||
dynamo.scriptOutput(new XmlRpcMethodNotFound(method));
|
||||
Reference in New Issue
Block a user