Compare commits

...

7 Commits

Author SHA1 Message Date
Justin Clark-Casey (justincc) 50254bf3d6 Move default inventory creation from InventoryService to UserAccountService
Giving default avatar appearance parts default IDs doesn't work because each user has to have a random ID.
To do this, appearance must be set up on user account creation, not at initial login (so that we can use the random IDs created).
To do this, default inventory creation has to move from the inventory service up to the user account service.
Temporarily, a hole is punched through to allow a standalone to call UserAccountService.CreateUserAccount(), in order to avoid more duplication of code and remove what had already been copy/pasted
2011-01-28 20:44:49 +00:00
Justin Clark-Casey (justincc) f7104dda44 Merge branch 'master' into viewer-2-initial-appearance 2011-01-28 18:22:39 +00:00
Justin Clark-Casey (justincc) a1aed3a443 give default items much more sensible permissions and owner/creatorship 2011-01-08 02:16:19 +00:00
Justin Clark-Casey (justincc) 45f658890b Get a new avatar to wear the 'default' eyes by default.
This now means that new avatars start off with all the body parts and clothing required to have an appearance in viewer 2.
However, clothing and body part creation is hardcoded, this stuff needs to be made optional.
Or even better, integrated with the existing 'default' avatar creation stuff hanging off the XMLRPC functions.
Also, some sanity tweaking is required (e.g. creator is currently the zero ID)
2011-01-08 01:46:52 +00:00
Justin Clark-Casey (justincc) 298cf1ae67 Add default shirt and pants
Curiously, all items are now starting off worn except the eyes.  Hmm.
2011-01-08 01:23:56 +00:00
Justin Clark-Casey (justincc) 6626834c6b add default eyes
Unlike other body parts, there doesn't appear to be a fixed uuid for this.  Maybe these uuids are just a holdover from viewer 1
2011-01-08 00:57:07 +00:00
Justin Clark-Casey (justincc) d075b1e52f Create default skin, shape and hair items in inventory for viewer 2
With the addition of eyes, and once all four items are worn, a naked avatar appears.
This is interim code just to get things going.
2011-01-08 00:19:38 +00:00
14 changed files with 274 additions and 271 deletions

View File

@ -82,6 +82,11 @@ namespace OpenSim.Framework
public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120");
// No obvious external default appears for eyes, so these are specific to OpenSim!
// Does this matter?
public static readonly UUID DEFAULT_EYES_ITEM = new UUID("3a8d1e5c-998a-4c81-bdfb-89cd301e795e");
public static readonly UUID DEFAULT_EYES_ASSET = new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77");
// public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); // public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
// public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); // public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
@ -240,6 +245,9 @@ namespace OpenSim.Framework
// Pants // Pants
defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET); defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET);
// Eyes
defaultWearables[EYES].Add(DEFAULT_EYES_ITEM, DEFAULT_EYES_ASSET);
// // Alpha // // Alpha
// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); // defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);

View File

@ -140,6 +140,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
#region IUserAccountService #region IUserAccountService
public UserAccount CreateUserAccount(UserAccount account, string password)
{
account = m_UserService.CreateUserAccount(account, password);
m_Cache.Cache(account.PrincipalID, account);
return account;
}
public UserAccount GetUserAccount(UUID scopeID, UUID userID) public UserAccount GetUserAccount(UUID scopeID, UUID userID)
{ {
bool inCache = false; bool inCache = false;

View File

@ -117,6 +117,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
#region Overwritten methods from IUserAccountService #region Overwritten methods from IUserAccountService
public override UserAccount CreateUserAccount(UserAccount account, string password)
{
// This remote connector refuses to serve this method
return null;
}
public override UserAccount GetUserAccount(UUID scopeID, UUID userID) public override UserAccount GetUserAccount(UUID scopeID, UUID userID)
{ {
bool inCache = false; bool inCache = false;

View File

@ -1082,11 +1082,6 @@ namespace OpenSim.Region.Framework.Scenes
m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
// Shoving this in here for now, because we have the needed
// interfaces at this point
//
// TODO: Find a better place for this
//
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{ {
MainConsole.Instance.Output("The current estate has no owner set."); MainConsole.Instance.Output("The current estate has no owner set.");
@ -1109,58 +1104,15 @@ namespace OpenSim.Region.Framework.Scenes
account.ServiceURLs["AssetServerURI"] = string.Empty; account.ServiceURLs["AssetServerURI"] = string.Empty;
} }
if (UserAccountService.StoreUserAccount(account)) string password = MainConsole.Instance.PasswdPrompt("Password");
{ string email = MainConsole.Instance.CmdPrompt("Email", "");
string password = MainConsole.Instance.PasswdPrompt("Password"); account.Email = email;
string email = MainConsole.Instance.CmdPrompt("Email", "");
account.Email = email; UserAccountService.CreateUserAccount(account, password);
UserAccountService.StoreUserAccount(account);
bool success = false;
success = AuthenticationService.SetPassword(account.PrincipalID, password);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
first, last);
GridRegion home = null;
if (GridService != null)
{
List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
if (defaultRegions != null && defaultRegions.Count >= 1)
home = defaultRegions[0];
if (GridUserService != null && home != null)
GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
else
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
first, last);
}
else
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
first, last);
if (InventoryService != null)
success = InventoryService.CreateUserInventory(account.PrincipalID);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
first, last);
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
m_regInfo.EstateSettings.Save();
}
else
m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
}
else
{
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
m_regInfo.EstateSettings.Save();
} }
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
m_regInfo.EstateSettings.Save();
} }
} }

View File

@ -191,6 +191,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
return accounts; return accounts;
} }
public UserAccount CreateUserAccount(UserAccount data, string password)
{
return null;
}
public bool StoreUserAccount(UserAccount data) public bool StoreUserAccount(UserAccount data)
{ {
// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); // m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);

View File

@ -187,6 +187,11 @@ namespace OpenSim.Services.Connectors
return accounts; return accounts;
} }
public virtual UserAccount CreateUserAccount(UserAccount data, string password)
{
return null;
}
public virtual bool StoreUserAccount(UserAccount data) public virtual bool StoreUserAccount(UserAccount data)
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();

View File

@ -74,6 +74,11 @@ namespace OpenSim.Services.HypergridService
return account; return account;
} }
public UserAccount CreateUserAccount(UserAccount data, string password)
{
return null;
}
#region IUserAccountService #region IUserAccountService
public UserAccount GetUserAccount(UUID scopeID, UUID userID) public UserAccount GetUserAccount(UUID scopeID, UUID userID)
{ {

View File

@ -139,6 +139,14 @@ namespace OpenSim.Services.Interfaces
public interface IUserAccountService public interface IUserAccountService
{ {
/// <summary>
/// Temporarily punch a hole through to account creation so that the scene can create a user account for an
/// estate manager.
/// </summary>
/// <param name="account"></param>
/// <returns></returns>
UserAccount CreateUserAccount(UserAccount account, string password);
UserAccount GetUserAccount(UUID scopeID, UUID userID); UserAccount GetUserAccount(UUID scopeID, UUID userID);
UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName);
UserAccount GetUserAccount(UUID scopeID, string Email); UserAccount GetUserAccount(UUID scopeID, string Email);

View File

@ -122,17 +122,13 @@ namespace OpenSim.Services.InventoryService
"[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have " "[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have "
+ "a root inventory folder with id {1}", + "a root inventory folder with id {1}",
user, existingRootFolder.ID); user, existingRootFolder.ID);
return false;
} }
else else
{ {
UsersInventory inven = new UsersInventory();
inven.CreateNewInventorySet(user);
AddNewInventorySet(inven);
return true; return true;
} }
return false;
} }
// See IInventoryServices // See IInventoryServices
@ -503,14 +499,6 @@ namespace OpenSim.Services.InventoryService
return true; return true;
} }
private void AddNewInventorySet(UsersInventory inventory)
{
foreach (InventoryFolderBase folder in inventory.Folders.Values)
{
AddFolder(folder);
}
}
public InventoryItemBase GetInventoryItem(UUID itemID) public InventoryItemBase GetInventoryItem(UUID itemID)
{ {
InventoryItemBase item = m_Database.getInventoryItem(itemID); InventoryItemBase item = m_Database.getInventoryItem(itemID);
@ -542,155 +530,5 @@ namespace OpenSim.Services.InventoryService
return perms; return perms;
} }
/// <summary>
/// Used to create a new user inventory.
/// </summary>
private class UsersInventory
{
public Dictionary<UUID, InventoryFolderBase> Folders = new Dictionary<UUID, InventoryFolderBase>();
public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>();
public virtual void CreateNewInventorySet(UUID user)
{
InventoryFolderBase folder = new InventoryFolderBase();
folder.ParentID = UUID.Zero;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "My Inventory";
folder.Type = (short)AssetType.Folder;
folder.Version = 1;
Folders.Add(folder.ID, folder);
UUID rootFolder = folder.ID;
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Animations";
folder.Type = (short)AssetType.Animation;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Body Parts";
folder.Type = (short)AssetType.Bodypart;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Calling Cards";
folder.Type = (short)AssetType.CallingCard;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Clothing";
folder.Type = (short)AssetType.Clothing;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Gestures";
folder.Type = (short)AssetType.Gesture;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Landmarks";
folder.Type = (short)AssetType.Landmark;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Lost And Found";
folder.Type = (short)AssetType.LostAndFoundFolder;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Notecards";
folder.Type = (short)AssetType.Notecard;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Objects";
folder.Type = (short)AssetType.Object;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Photo Album";
folder.Type = (short)AssetType.SnapshotFolder;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Scripts";
folder.Type = (short)AssetType.LSLText;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Sounds";
folder.Type = (short)AssetType.Sound;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Textures";
folder.Type = (short)AssetType.Texture;
folder.Version = 1;
Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase();
folder.ParentID = rootFolder;
folder.Owner = user;
folder.ID = UUID.Random();
folder.Name = "Trash";
folder.Type = (short)AssetType.TrashFolder;
folder.Version = 1;
Folders.Add(folder.ID, folder);
}
}
} }
} }

View File

@ -56,7 +56,11 @@ namespace OpenSim.Services.InventoryService
get { return m_LibraryRootFolder; } get { return m_LibraryRootFolder; }
} }
private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); public static UUID LibOwner
{
get { return s_libOwner; }
}
protected static UUID s_libOwner = new UUID("11111111-1111-0000-0000-000100bba000");
/// <summary> /// <summary>
/// Holds the root library folder and all its descendents. This is really only used during inventory /// Holds the root library folder and all its descendents. This is really only used during inventory
@ -81,7 +85,7 @@ namespace OpenSim.Services.InventoryService
m_log.Debug("[LIBRARY]: Starting library service..."); m_log.Debug("[LIBRARY]: Starting library service...");
m_LibraryRootFolder = new InventoryFolderImpl(); m_LibraryRootFolder = new InventoryFolderImpl();
m_LibraryRootFolder.Owner = libOwner; m_LibraryRootFolder.Owner = LibOwner;
m_LibraryRootFolder.ID = new UUID("00000112-000f-0000-0000-000100bba000"); m_LibraryRootFolder.ID = new UUID("00000112-000f-0000-0000-000100bba000");
m_LibraryRootFolder.Name = pLibName; m_LibraryRootFolder.Name = pLibName;
m_LibraryRootFolder.ParentID = UUID.Zero; m_LibraryRootFolder.ParentID = UUID.Zero;
@ -97,8 +101,8 @@ namespace OpenSim.Services.InventoryService
int assetType, int invType, UUID parentFolderID) int assetType, int invType, UUID parentFolderID)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.Owner = libOwner; item.Owner = LibOwner;
item.CreatorId = libOwner.ToString(); item.CreatorId = LibOwner.ToString();
item.ID = inventoryID; item.ID = inventoryID;
item.AssetID = assetID; item.AssetID = assetID;
item.Description = description; item.Description = description;
@ -157,7 +161,7 @@ namespace OpenSim.Services.InventoryService
folderInfo.ParentID = new UUID(config.GetString("parentFolderID", m_LibraryRootFolder.ID.ToString())); folderInfo.ParentID = new UUID(config.GetString("parentFolderID", m_LibraryRootFolder.ID.ToString()));
folderInfo.Type = (short)config.GetInt("type", 8); folderInfo.Type = (short)config.GetInt("type", 8);
folderInfo.Owner = libOwner; folderInfo.Owner = LibOwner;
folderInfo.Version = 1; folderInfo.Version = 1;
if (libraryFolders.ContainsKey(folderInfo.ParentID)) if (libraryFolders.ContainsKey(folderInfo.ParentID))
@ -184,8 +188,8 @@ namespace OpenSim.Services.InventoryService
private void ReadItemFromConfig(IConfig config, string path) private void ReadItemFromConfig(IConfig config, string path)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.Owner = libOwner; item.Owner = LibOwner;
item.CreatorId = libOwner.ToString(); item.CreatorId = LibOwner.ToString();
item.ID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString())); item.ID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString()));
item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString()));
item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString())); item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString()));

View File

@ -105,37 +105,6 @@ namespace OpenSim.Services.InventoryService
result = true; result = true;
} }
XInventoryFolder[] sysFolders = GetSystemFolders(principalID);
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.LostAndFoundFolder, "Lost And Found");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Notecard, "Notecards");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Object, "Objects");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.SnapshotFolder, "Photo Album");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.LSLText, "Scripts");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Sound, "Sounds");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Texture, "Textures");
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; }))
CreateFolder(principalID, rootFolder.ID, (int)AssetType.TrashFolder, "Trash");
return result; return result;
} }

View File

@ -30,8 +30,9 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Data; using OpenSim.Data;
using OpenSim.Services.Interfaces; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse; using OpenMetaverse;
@ -49,6 +50,8 @@ namespace OpenSim.Services.UserAccountService
protected IGridUserService m_GridUserService; protected IGridUserService m_GridUserService;
protected IInventoryService m_InventoryService; protected IInventoryService m_InventoryService;
protected static UUID s_libOwner = new UUID("11111111-1111-0000-0000-000100bba000");
public UserAccountService(IConfigSource config) public UserAccountService(IConfigSource config)
: base(config) : base(config)
{ {
@ -87,9 +90,7 @@ namespace OpenSim.Services.UserAccountService
"reset user password [<first> [<last> [<password>]]]", "reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword); "Reset a user password", HandleResetUserPassword);
} }
} }
} }
#region IUserAccountService #region IUserAccountService
@ -352,6 +353,12 @@ namespace OpenSim.Services.UserAccountService
#endregion #endregion
public UserAccount CreateUserAccount(UserAccount data, string password)
{
CreateUser(data.FirstName, data.LastName, password, data.Email);
return data;
}
/// <summary> /// <summary>
/// Create a user /// Create a user
/// </summary> /// </summary>
@ -399,19 +406,34 @@ namespace OpenSim.Services.UserAccountService
firstName, lastName); firstName, lastName);
} }
else else
{
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
firstName, lastName); firstName, lastName);
if (m_InventoryService != null)
{
success = m_InventoryService.CreateUserInventory(account.PrincipalID);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
firstName, lastName);
} }
Console.WriteLine("here");
if (m_InventoryService != null)
{
Console.WriteLine("here2");
if (m_InventoryService.CreateUserInventory(account.PrincipalID))
{
Console.WriteLine("here3");
CreateDefaultInventory(account.PrincipalID);
}
else
{
Console.WriteLine("here4");
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
firstName, lastName);
}
Console.WriteLine("here5");
}
Console.WriteLine("here6");
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
} else { }
else
{
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName); m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName);
} }
} }
@ -420,5 +442,144 @@ namespace OpenSim.Services.UserAccountService
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
} }
} }
protected void CreateDefaultInventory(UUID principalID)
{
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Creating default inventory for {0}", principalID);
InventoryFolderBase rootFolder = m_InventoryService.GetRootFolder(principalID);
// XInventoryFolder[] sysFolders = GetSystemFolders(principalID);
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations");
InventoryFolderBase bodypartFolder = CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards");
InventoryFolderBase clothingFolder = CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.LostAndFoundFolder, "Lost And Found");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Notecard, "Notecards");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Object, "Objects");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.SnapshotFolder, "Photo Album");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.LSLText, "Scripts");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Sound, "Sounds");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Texture, "Textures");
CreateFolder(principalID, rootFolder.ID, (int)AssetType.TrashFolder, "Trash");
// Default minimum body parts for viewer 2 appearance
InventoryItemBase defaultShape = new InventoryItemBase();
defaultShape.Name = "Default shape";
defaultShape.Description = "Default shape description";
defaultShape.AssetType = (int)AssetType.Bodypart;
defaultShape.InvType = (int)InventoryType.Wearable;
defaultShape.Flags = (uint)WearableType.Shape;
defaultShape.ID = AvatarWearable.DEFAULT_BODY_ITEM;
defaultShape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
defaultShape.Folder = bodypartFolder.ID;
defaultShape.CreatorId = s_libOwner.ToString();
defaultShape.Owner = principalID;
defaultShape.BasePermissions = (uint)PermissionMask.All;
defaultShape.CurrentPermissions = (uint)PermissionMask.All;
defaultShape.EveryOnePermissions = (uint)PermissionMask.None;
defaultShape.NextPermissions = (uint)PermissionMask.All;
m_InventoryService.AddItem(defaultShape);
InventoryItemBase defaultSkin = new InventoryItemBase();
defaultSkin.Name = "Default skin";
defaultSkin.Description = "Default skin description";
defaultSkin.AssetType = (int)AssetType.Bodypart;
defaultSkin.InvType = (int)InventoryType.Wearable;
defaultSkin.Flags = (uint)WearableType.Skin;
defaultSkin.ID = AvatarWearable.DEFAULT_SKIN_ITEM;
defaultSkin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET;
defaultSkin.Folder = bodypartFolder.ID;
defaultSkin.CreatorId = s_libOwner.ToString();
defaultSkin.Owner = principalID;
defaultSkin.BasePermissions = (uint)PermissionMask.All;
defaultSkin.CurrentPermissions = (uint)PermissionMask.All;
defaultSkin.EveryOnePermissions = (uint)PermissionMask.None;
defaultSkin.NextPermissions = (uint)PermissionMask.All;
m_InventoryService.AddItem(defaultSkin);
InventoryItemBase defaultHair = new InventoryItemBase();
defaultHair.Name = "Default hair";
defaultHair.Description = "Default hair description";
defaultHair.AssetType = (int)AssetType.Bodypart;
defaultHair.InvType = (int)InventoryType.Wearable;
defaultHair.Flags = (uint)WearableType.Hair;
defaultHair.ID = AvatarWearable.DEFAULT_HAIR_ITEM;
defaultHair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET;
defaultHair.Folder = bodypartFolder.ID;
defaultHair.CreatorId = s_libOwner.ToString();
defaultHair.Owner = principalID;
defaultHair.BasePermissions = (uint)PermissionMask.All;
defaultHair.CurrentPermissions = (uint)PermissionMask.All;
defaultHair.EveryOnePermissions = (uint)PermissionMask.None;
defaultHair.NextPermissions = (uint)PermissionMask.All;
m_InventoryService.AddItem(defaultHair);
InventoryItemBase defaultEyes = new InventoryItemBase();
defaultEyes.Name = "Default eyes";
defaultEyes.Description = "Default eyes description";
defaultEyes.AssetType = (int)AssetType.Bodypart;
defaultEyes.InvType = (int)InventoryType.Wearable;
defaultEyes.Flags = (uint)WearableType.Eyes;
defaultEyes.ID = AvatarWearable.DEFAULT_EYES_ITEM;
defaultEyes.AssetID = AvatarWearable.DEFAULT_EYES_ASSET;
defaultEyes.Folder = bodypartFolder.ID;
defaultEyes.CreatorId = s_libOwner.ToString();
defaultEyes.Owner = principalID;
defaultEyes.BasePermissions = (uint)PermissionMask.All;
defaultEyes.CurrentPermissions = (uint)PermissionMask.All;
defaultEyes.EveryOnePermissions = (uint)PermissionMask.None;
defaultEyes.NextPermissions = (uint)PermissionMask.All;
m_InventoryService.AddItem(defaultEyes);
// Default minimum clothes for viewer 2 non-naked appearance
InventoryItemBase defaultShirt = new InventoryItemBase();
defaultShirt.Name = "Default shirt";
defaultShirt.Description = "Default shirt description";
defaultShirt.AssetType = (int)AssetType.Clothing;
defaultShirt.InvType = (int)InventoryType.Wearable;
defaultShirt.Flags = (uint)WearableType.Shirt;
defaultShirt.ID = AvatarWearable.DEFAULT_SHIRT_ITEM;
defaultShirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET;
defaultShirt.Folder = clothingFolder.ID;
defaultShirt.CreatorId = s_libOwner.ToString();
defaultShirt.Owner = principalID;
defaultShirt.BasePermissions = (uint)PermissionMask.All;
defaultShirt.CurrentPermissions = (uint)PermissionMask.All;
defaultShirt.EveryOnePermissions = (uint)PermissionMask.None;
defaultShirt.NextPermissions = (uint)PermissionMask.All;
m_InventoryService.AddItem(defaultShirt);
InventoryItemBase defaultPants = new InventoryItemBase();
defaultPants.Name = "Default pants";
defaultPants.Description = "Default pants description";
defaultPants.AssetType = (int)AssetType.Clothing;
defaultPants.InvType = (int)InventoryType.Wearable;
defaultPants.Flags = (uint)WearableType.Pants;
defaultPants.ID = AvatarWearable.DEFAULT_PANTS_ITEM;
defaultPants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET;
defaultPants.Folder = clothingFolder.ID;
defaultPants.CreatorId = s_libOwner.ToString();
defaultPants.Owner = principalID;
defaultPants.BasePermissions = (uint)PermissionMask.All;
defaultPants.CurrentPermissions = (uint)PermissionMask.All;
defaultPants.EveryOnePermissions = (uint)PermissionMask.None;
defaultPants.NextPermissions = (uint)PermissionMask.All;
m_InventoryService.AddItem(defaultPants);
}
protected InventoryFolderBase CreateFolder(UUID principalID, UUID parentID, int type, string name)
{
InventoryFolderBase folder
= new InventoryFolderBase(UUID.Random(), name, principalID, (short)type, parentID, 1);
if (m_InventoryService.AddFolder(folder))
return folder;
else
return null;
}
} }
} }

View File

@ -34,6 +34,14 @@
<Key Name="assetType" Value="13" /> <Key Name="assetType" Value="13" />
<Key Name="fileName" Value="base_shape.dat"/> <Key Name="fileName" Value="base_shape.dat"/>
</Section> </Section>
<Section Name="Eyes">
<Key Name="assetID" Value="6522e74d-1660-4e7f-b601-6f48c1659a77"/>
<Key Name="name" Value="Eyes"/>
<Key Name="assetType" Value="13"/>
<Key Name="fileName" Value="base_eyes.dat"/>
</Section>
<!-- <!--
<Section Name="Jim Shape"> <Section Name="Jim Shape">
<Key Name="assetID" Value="66c41e39-38f9-f75a-024e-585989bfab74"/> <Key Name="assetID" Value="66c41e39-38f9-f75a-024e-585989bfab74"/>

View File

@ -0,0 +1,26 @@
LLWearable version 22
New Eyes
permissions 0
{
base_mask 7fffffff
owner_mask 7fffffff
group_mask 00000000
everyone_mask 00000000
next_owner_mask 00082000
creator_id 138e881b-35af-4190-b0cf-55f8301e0095
owner_id 138e881b-35af-4190-b0cf-55f8301e0095
last_owner_id 00000000-0000-0000-0000-000000000000
group_id 00000000-0000-0000-0000-000000000000
}
sale_info 0
{
sale_type not
sale_price 10
}
type 3
parameters 2
98 0
99 0
textures 1
3 6522e74d-1660-4e7f-b601-6f48c1659a77