<!-- #include file="RetrieveIStore.csp" -->
function AddUser(IStore, AccountName, UserName, Description, NamedUser, PasswordNeverExpires, MustChangePassword, CannotChangePassword, Password)
// Retrieve the Plugin Manager.
var PluginMgr = IStore.PluginManager;
var UserPlugin = PluginMgr.PluginInfo("CrystalEnterprise.User");
// Create a new InfoObjects collection.
var NewInfoObjects = IStore.NewInfoObjectCollection();
// Add the User plugin to the collection.
NewInfoObjects.Add (UserPlugin);
// Retrieve the newly created user object.
var InfoObjs = NewInfoObjects.Item(1);
// Retrieve the user object's plugin interface.
var NewUser = InfoObjs.PluginInterface("");
// Set the user object's InfoObject properties.
InfoObjs.Description = Description;
// Set the user object's plugin
NewUser.Connection = NamedUser;
NewUser.PasswordExpires = PasswordNeverExpires;
NewUser.ChangePasswordAtNextLogon = MustChangePassword;
NewUser.AllowChangePassword = CannotChangePassword;
NewUser.NewPassword = Password;
IStore.Commit (NewInfoObjects);
function CheckPassword(Password, ConfirmedPassword)
if (Password == ConfirmedPassword) return true; else return false;
var UserID = Request.QueryString.Item ("UserID");
Response.Redirect("Start.csp");
var AccountName=String(Request.Form.Item("AccountName"));
var UserName=String(Request.Form.Item("FullName"));
var Description=String(Request.Form.Item("Description"));
var NamedUser=Number(Request.Form.Item("UserType"));
// Note: The value of PasswordNeverExpires is assigned to the PasswordExpires property;
// if True, then the password expires; if False, then it never expires.
var PasswordNeverExpires=Request.Form.Item("PasswordNeverExpires");
if (PasswordNeverExpires=="on") PasswordNeverExpires = false;
else PasswordNeverExpires = true;
var MustChangePassword=Request.Form.Item("UserMustChangePassword");
if (MustChangePassword=="on") MustChangePassword = true;
else MustChangePassword = false;
// Note: The value of CannotChangePassword is assigned to the AllowChangePassword property;
// if True, then the password can be changed; if False, then it cannot be changed.
var CannotChangePassword=Request.Form.Item("UserCantChangePassword");
if (CannotChangePassword=="on") CannotChangePassword = false;
else CannotChangePassword = true;
var Password=String(Request.Form.Item("Password"));
var ConfirmedPassword = String(Request.Form.Item("ConfirmPassword"));
if (CheckPassword(Password,ConfirmedPassword))
AddUser(IStore, AccountName, UserName, Description, NamedUser, PasswordNeverExpires, MustChangePassword, CannotChangePassword, Password);
Response.Write ("The passwords don't match.<BR>");
Response.Write ("Finished adding user.");
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |