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/pastedviewer-2-initial-appearance
parent
f7104dda44
commit
50254bf3d6
|
@ -139,6 +139,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
|||
#endregion
|
||||
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -116,6 +116,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
|||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -1082,11 +1082,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
|
||||
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)
|
||||
{
|
||||
MainConsole.Instance.Output("The current estate has no owner set.");
|
||||
|
@ -1109,58 +1104,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
account.ServiceURLs["AssetServerURI"] = string.Empty;
|
||||
}
|
||||
|
||||
if (UserAccountService.StoreUserAccount(account))
|
||||
{
|
||||
string password = MainConsole.Instance.PasswdPrompt("Password");
|
||||
string email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||
|
||||
account.Email = email;
|
||||
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();
|
||||
string password = MainConsole.Instance.PasswdPrompt("Password");
|
||||
string email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||
account.Email = email;
|
||||
|
||||
UserAccountService.CreateUserAccount(account, password);
|
||||
}
|
||||
|
||||
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
|
||||
m_regInfo.EstateSettings.Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,6 +190,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public UserAccount CreateUserAccount(UserAccount data, string password)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool StoreUserAccount(UserAccount data)
|
||||
{
|
||||
|
|
|
@ -186,6 +186,11 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public virtual UserAccount CreateUserAccount(UserAccount data, string password)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool StoreUserAccount(UserAccount data)
|
||||
{
|
||||
|
|
|
@ -73,6 +73,11 @@ namespace OpenSim.Services.HypergridService
|
|||
|
||||
return account;
|
||||
}
|
||||
|
||||
public UserAccount CreateUserAccount(UserAccount data, string password)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#region IUserAccountService
|
||||
public UserAccount GetUserAccount(UUID scopeID, UUID userID)
|
||||
|
|
|
@ -139,6 +139,14 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
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, string FirstName, string LastName);
|
||||
UserAccount GetUserAccount(UUID scopeID, string Email);
|
||||
|
|
|
@ -122,17 +122,13 @@ namespace OpenSim.Services.InventoryService
|
|||
"[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have "
|
||||
+ "a root inventory folder with id {1}",
|
||||
user, existingRootFolder.ID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UsersInventory inven = new UsersInventory();
|
||||
inven.CreateNewInventorySet(user);
|
||||
AddNewInventorySet(inven);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
|
@ -503,15 +499,6 @@ namespace OpenSim.Services.InventoryService
|
|||
return true;
|
||||
}
|
||||
|
||||
private void AddNewInventorySet(UsersInventory inventory)
|
||||
{
|
||||
foreach (InventoryFolderBase folder in inventory.Folders.Values)
|
||||
AddFolder(folder);
|
||||
|
||||
foreach (InventoryItemBase item in inventory.Items.Values)
|
||||
AddItem(item);
|
||||
}
|
||||
|
||||
public InventoryItemBase GetInventoryItem(UUID itemID)
|
||||
{
|
||||
InventoryItemBase item = m_Database.getInventoryItem(itemID);
|
||||
|
@ -543,167 +530,5 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
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);
|
||||
|
||||
InventoryFolderBase clothingFolder = new InventoryFolderBase();
|
||||
clothingFolder.ParentID = rootFolder;
|
||||
clothingFolder.Owner = user;
|
||||
clothingFolder.ID = UUID.Random();
|
||||
clothingFolder.Name = "Clothing";
|
||||
clothingFolder.Type = (short)AssetType.Clothing;
|
||||
clothingFolder.Version = 1;
|
||||
Folders.Add(clothingFolder.ID, clothingFolder);
|
||||
|
||||
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);
|
||||
|
||||
// Not worth creating default items for this old inventory service since it's only currently used by
|
||||
// tests (and then to test other things, rather than the service itself).
|
||||
// // Default items
|
||||
// InventoryItemBase defaultShape = new InventoryItemBase();
|
||||
// defaultShape.Name = "Default shape";
|
||||
// defaultShape.AssetType = (int)AssetType.Bodypart;
|
||||
// defaultShape.InvType = (int)InventoryType.Wearable;
|
||||
// defaultShape.ID = AvatarWearable.DEFAULT_BODY_ITEM;
|
||||
// defaultShape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
|
||||
// defaultShape.Folder = clothingFolder.ID;
|
||||
// Items.Add(defaultShape.ID, defaultShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -103,145 +103,7 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory"));
|
||||
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");
|
||||
|
||||
InventoryFolderBase bodypartFolder = GetFolderForType(principalID, AssetType.Bodypart);
|
||||
InventoryFolderBase clothingFolder = GetFolderForType(principalID, AssetType.Clothing);
|
||||
|
||||
// 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 = LibraryService.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;
|
||||
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 = LibraryService.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;
|
||||
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 = LibraryService.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;
|
||||
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 = LibraryService.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;
|
||||
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 = LibraryService.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;
|
||||
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 = LibraryService.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;
|
||||
AddItem(defaultPants);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,9 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
@ -49,6 +50,8 @@ namespace OpenSim.Services.UserAccountService
|
|||
protected IGridUserService m_GridUserService;
|
||||
protected IInventoryService m_InventoryService;
|
||||
|
||||
protected static UUID s_libOwner = new UUID("11111111-1111-0000-0000-000100bba000");
|
||||
|
||||
public UserAccountService(IConfigSource config)
|
||||
: base(config)
|
||||
{
|
||||
|
@ -87,9 +90,7 @@ namespace OpenSim.Services.UserAccountService
|
|||
"reset user password [<first> [<last> [<password>]]]",
|
||||
"Reset a user password", HandleResetUserPassword);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region IUserAccountService
|
||||
|
@ -352,6 +353,12 @@ namespace OpenSim.Services.UserAccountService
|
|||
|
||||
#endregion
|
||||
|
||||
public UserAccount CreateUserAccount(UserAccount data, string password)
|
||||
{
|
||||
CreateUser(data.FirstName, data.LastName, password, data.Email);
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a user
|
||||
/// </summary>
|
||||
|
@ -399,19 +406,34 @@ namespace OpenSim.Services.UserAccountService
|
|||
firstName, lastName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
|
||||
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);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue