aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Simulation/EstateDataService.cs7
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs14
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs159
3 files changed, 165 insertions, 15 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
index 7184ba1..cdcdecf 100644
--- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
+++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -90,6 +90,11 @@ namespace OpenSim.Services.Connectors
90 { 90 {
91 return m_database.LoadEstateSettings(estateID); 91 return m_database.LoadEstateSettings(estateID);
92 } 92 }
93
94 public EstateSettings CreateNewEstate()
95 {
96 return m_database.CreateNewEstate();
97 }
93 98
94 public List<EstateSettings> LoadEstateSettingsAll() 99 public List<EstateSettings> LoadEstateSettingsAll()
95 { 100 {
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index eeab67a..1648b51 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -40,9 +40,9 @@ namespace OpenSim.Services.InventoryService
40{ 40{
41 public class XInventoryService : ServiceBase, IInventoryService 41 public class XInventoryService : ServiceBase, IInventoryService
42 { 42 {
43 //private static readonly ILog m_log = 43// private static readonly ILog m_log =
44 // LogManager.GetLogger( 44// LogManager.GetLogger(
45 // MethodBase.GetCurrentMethod().DeclaringType); 45// MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected IXInventoryData m_Database; 47 protected IXInventoryData m_Database;
48 protected bool m_AllowDelete = true; 48 protected bool m_AllowDelete = true;
@@ -385,18 +385,22 @@ namespace OpenSim.Services.InventoryService
385 385
386 public virtual bool AddItem(InventoryItemBase item) 386 public virtual bool AddItem(InventoryItemBase item)
387 { 387 {
388 //m_log.DebugFormat( 388// m_log.DebugFormat(
389 // "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner); 389// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner);
390 390
391 return m_Database.StoreItem(ConvertFromOpenSim(item)); 391 return m_Database.StoreItem(ConvertFromOpenSim(item));
392 } 392 }
393 393
394 public virtual bool UpdateItem(InventoryItemBase item) 394 public virtual bool UpdateItem(InventoryItemBase item)
395 { 395 {
396// throw new Exception("urrgh");
396 if (!m_AllowDelete) 397 if (!m_AllowDelete)
397 if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder) 398 if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder)
398 return false; 399 return false;
399 400
401// m_log.InfoFormat(
402// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
403
400 return m_Database.StoreItem(ConvertFromOpenSim(item)); 404 return m_Database.StoreItem(ConvertFromOpenSim(item));
401 } 405 }
402 406
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 7a46165..4c6122d 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -28,15 +28,15 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net;
31using Nini.Config; 32using Nini.Config;
33using OpenMetaverse;
32using OpenSim.Data; 34using OpenSim.Data;
35using OpenSim.Framework;
33using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
34using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
35using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
36 39
37using OpenMetaverse;
38using log4net;
39
40namespace OpenSim.Services.UserAccountService 40namespace OpenSim.Services.UserAccountService
41{ 41{
42 public class UserAccountService : UserAccountServiceBase, IUserAccountService 42 public class UserAccountService : UserAccountServiceBase, IUserAccountService
@@ -44,10 +44,16 @@ namespace OpenSim.Services.UserAccountService
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 private static UserAccountService m_RootInstance; 45 private static UserAccountService m_RootInstance;
46 46
47 /// <summary>
48 /// Should we create default entries (minimum body parts/clothing, avatar wearable entries) for a new avatar?
49 /// </summary>
50 private bool m_CreateDefaultAvatarEntries;
51
47 protected IGridService m_GridService; 52 protected IGridService m_GridService;
48 protected IAuthenticationService m_AuthenticationService; 53 protected IAuthenticationService m_AuthenticationService;
49 protected IGridUserService m_GridUserService; 54 protected IGridUserService m_GridUserService;
50 protected IInventoryService m_InventoryService; 55 protected IInventoryService m_InventoryService;
56 protected IAvatarService m_AvatarService;
51 57
52 public UserAccountService(IConfigSource config) 58 public UserAccountService(IConfigSource config)
53 : base(config) 59 : base(config)
@@ -77,6 +83,12 @@ namespace OpenSim.Services.UserAccountService
77 if (invServiceDll != string.Empty) 83 if (invServiceDll != string.Empty)
78 m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config }); 84 m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config });
79 85
86 string avatarServiceDll = userConfig.GetString("AvatarService", string.Empty);
87 if (avatarServiceDll != string.Empty)
88 m_AvatarService = LoadPlugin<IAvatarService>(avatarServiceDll, new Object[] { config });
89
90 m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);
91
80 if (MainConsole.Instance != null) 92 if (MainConsole.Instance != null)
81 { 93 {
82 MainConsole.Instance.Commands.AddCommand("UserService", false, 94 MainConsole.Instance.Commands.AddCommand("UserService", false,
@@ -102,9 +114,7 @@ namespace OpenSim.Services.UserAccountService
102 "show account <first> <last>", 114 "show account <first> <last>",
103 "Show account details for the given user", HandleShowAccount); 115 "Show account details for the given user", HandleShowAccount);
104 } 116 }
105
106 } 117 }
107
108 } 118 }
109 119
110 #region IUserAccountService 120 #region IUserAccountService
@@ -349,7 +359,7 @@ namespace OpenSim.Services.UserAccountService
349 email = MainConsole.Instance.CmdPrompt("Email", ""); 359 email = MainConsole.Instance.CmdPrompt("Email", "");
350 else email = cmdparams[5]; 360 else email = cmdparams[5];
351 361
352 CreateUser(firstName, lastName, password, email); 362 CreateUser(UUID.Zero, firstName, lastName, password, email);
353 } 363 }
354 364
355 protected void HandleShowAccount(string module, string[] cmdparams) 365 protected void HandleShowAccount(string module, string[] cmdparams)
@@ -461,11 +471,12 @@ namespace OpenSim.Services.UserAccountService
461 /// <summary> 471 /// <summary>
462 /// Create a user 472 /// Create a user
463 /// </summary> 473 /// </summary>
474 /// <param name="scopeID">Allows hosting of multiple grids in a single database. Normally left as UUID.Zero</param>
464 /// <param name="firstName"></param> 475 /// <param name="firstName"></param>
465 /// <param name="lastName"></param> 476 /// <param name="lastName"></param>
466 /// <param name="password"></param> 477 /// <param name="password"></param>
467 /// <param name="email"></param> 478 /// <param name="email"></param>
468 private void CreateUser(string firstName, string lastName, string password, string email) 479 public UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email)
469 { 480 {
470 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 481 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
471 if (null == account) 482 if (null == account)
@@ -512,12 +523,20 @@ namespace OpenSim.Services.UserAccountService
512 { 523 {
513 success = m_InventoryService.CreateUserInventory(account.PrincipalID); 524 success = m_InventoryService.CreateUserInventory(account.PrincipalID);
514 if (!success) 525 if (!success)
526 {
515 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", 527 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
516 firstName, lastName); 528 firstName, lastName);
529 }
530 else if (m_CreateDefaultAvatarEntries)
531 {
532 CreateDefaultAppearanceEntries(account.PrincipalID);
533 }
517 } 534 }
518 535
519 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); 536 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
520 } else { 537 }
538 else
539 {
521 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName); 540 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName);
522 } 541 }
523 } 542 }
@@ -525,6 +544,128 @@ namespace OpenSim.Services.UserAccountService
525 { 544 {
526 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); 545 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
527 } 546 }
547
548 return account;
549 }
550
551 private void CreateDefaultAppearanceEntries(UUID principalID)
552 {
553 m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID);
554
555 InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Bodypart);
556
557 InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID);
558 eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
559 eyes.Name = "Default Eyes";
560 eyes.CreatorId = principalID.ToString();
561 eyes.AssetType = (int)AssetType.Bodypart;
562 eyes.InvType = (int)InventoryType.Wearable;
563 eyes.Folder = bodyPartsFolder.ID;
564 eyes.BasePermissions = (uint)PermissionMask.All;
565 eyes.CurrentPermissions = (uint)PermissionMask.All;
566 eyes.EveryOnePermissions = (uint)PermissionMask.All;
567 eyes.GroupPermissions = (uint)PermissionMask.All;
568 eyes.NextPermissions = (uint)PermissionMask.All;
569 eyes.Flags = (uint)WearableType.Eyes;
570 m_InventoryService.AddItem(eyes);
571
572 InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID);
573 shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
574 shape.Name = "Default Shape";
575 shape.CreatorId = principalID.ToString();
576 shape.AssetType = (int)AssetType.Bodypart;
577 shape.InvType = (int)InventoryType.Wearable;
578 shape.Folder = bodyPartsFolder.ID;
579 shape.BasePermissions = (uint)PermissionMask.All;
580 shape.CurrentPermissions = (uint)PermissionMask.All;
581 shape.EveryOnePermissions = (uint)PermissionMask.All;
582 shape.GroupPermissions = (uint)PermissionMask.All;
583 shape.NextPermissions = (uint)PermissionMask.All;
584 shape.Flags = (uint)WearableType.Shape;
585 m_InventoryService.AddItem(shape);
586
587 InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID);
588 skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET;
589 skin.Name = "Default Skin";
590 skin.CreatorId = principalID.ToString();
591 skin.AssetType = (int)AssetType.Bodypart;
592 skin.InvType = (int)InventoryType.Wearable;
593 skin.Folder = bodyPartsFolder.ID;
594 skin.BasePermissions = (uint)PermissionMask.All;
595 skin.CurrentPermissions = (uint)PermissionMask.All;
596 skin.EveryOnePermissions = (uint)PermissionMask.All;
597 skin.GroupPermissions = (uint)PermissionMask.All;
598 skin.NextPermissions = (uint)PermissionMask.All;
599 skin.Flags = (uint)WearableType.Skin;
600 m_InventoryService.AddItem(skin);
601
602 InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID);
603 hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET;
604 hair.Name = "Default Hair";
605 hair.CreatorId = principalID.ToString();
606 hair.AssetType = (int)AssetType.Bodypart;
607 hair.InvType = (int)InventoryType.Wearable;
608 hair.Folder = bodyPartsFolder.ID;
609 hair.BasePermissions = (uint)PermissionMask.All;
610 hair.CurrentPermissions = (uint)PermissionMask.All;
611 hair.EveryOnePermissions = (uint)PermissionMask.All;
612 hair.GroupPermissions = (uint)PermissionMask.All;
613 hair.NextPermissions = (uint)PermissionMask.All;
614 hair.Flags = (uint)WearableType.Hair;
615 m_InventoryService.AddItem(hair);
616
617 InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Clothing);
618
619 InventoryItemBase shirt = new InventoryItemBase(UUID.Random(), principalID);
620 shirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET;
621 shirt.Name = "Default Shirt";
622 shirt.CreatorId = principalID.ToString();
623 shirt.AssetType = (int)AssetType.Clothing;
624 shirt.InvType = (int)InventoryType.Wearable;
625 shirt.Folder = clothingFolder.ID;
626 shirt.BasePermissions = (uint)PermissionMask.All;
627 shirt.CurrentPermissions = (uint)PermissionMask.All;
628 shirt.EveryOnePermissions = (uint)PermissionMask.All;
629 shirt.GroupPermissions = (uint)PermissionMask.All;
630 shirt.NextPermissions = (uint)PermissionMask.All;
631 shirt.Flags = (uint)WearableType.Shirt;
632 m_InventoryService.AddItem(shirt);
633
634 InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID);
635 pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET;
636 pants.Name = "Default Pants";
637 pants.CreatorId = principalID.ToString();
638 pants.AssetType = (int)AssetType.Clothing;
639 pants.InvType = (int)InventoryType.Wearable;
640 pants.Folder = clothingFolder.ID;
641 pants.BasePermissions = (uint)PermissionMask.All;
642 pants.CurrentPermissions = (uint)PermissionMask.All;
643 pants.EveryOnePermissions = (uint)PermissionMask.All;
644 pants.GroupPermissions = (uint)PermissionMask.All;
645 pants.NextPermissions = (uint)PermissionMask.All;
646 pants.Flags = (uint)WearableType.Pants;
647 m_InventoryService.AddItem(pants);
648
649 if (m_AvatarService != null)
650 {
651 m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default avatar entries for {0}", principalID);
652
653 AvatarWearable[] wearables = new AvatarWearable[6];
654 wearables[AvatarWearable.EYES] = new AvatarWearable(eyes.ID, eyes.AssetID);
655 wearables[AvatarWearable.BODY] = new AvatarWearable(shape.ID, shape.AssetID);
656 wearables[AvatarWearable.SKIN] = new AvatarWearable(skin.ID, skin.AssetID);
657 wearables[AvatarWearable.HAIR] = new AvatarWearable(hair.ID, hair.AssetID);
658 wearables[AvatarWearable.SHIRT] = new AvatarWearable(shirt.ID, shirt.AssetID);
659 wearables[AvatarWearable.PANTS] = new AvatarWearable(pants.ID, pants.AssetID);
660
661 AvatarAppearance ap = new AvatarAppearance();
662 for (int i = 0; i < 6; i++)
663 {
664 ap.SetWearable(i, wearables[i]);
665 }
666
667 m_AvatarService.SetAppearance(principalID, ap);
668 }
528 } 669 }
529 } 670 }
530} 671} \ No newline at end of file