diff options
author | Diva Canto | 2012-03-27 14:25:36 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-27 14:25:36 -0700 |
commit | 5e073366727b48b6467dd55c819016e450c8598c (patch) | |
tree | 29699e1e5dee4a415b19c1bae07202c08be9497f /OpenSim/Region | |
parent | Amend to previous commit regarding the config name. Bugs bite. (diff) | |
parent | Two new scripting functions osInviteToGroup(userID) and osEjectFromGroup(user... (diff) | |
download | opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.zip opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.tar.gz opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.tar.bz2 opensim-SC-5e073366727b48b6467dd55c819016e450c8598c.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
11 files changed, 301 insertions, 47 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ed3430a..8ec2f20 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -111,6 +111,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
111 | private IAssetService m_assetService; | 111 | private IAssetService m_assetService; |
112 | private bool m_dumpAssetsToFile = false; | 112 | private bool m_dumpAssetsToFile = false; |
113 | private string m_regionName; | 113 | private string m_regionName; |
114 | private int m_levelUpload = 0; | ||
114 | 115 | ||
115 | public BunchOfCaps(Scene scene, Caps caps) | 116 | public BunchOfCaps(Scene scene, Caps caps) |
116 | { | 117 | { |
@@ -121,7 +122,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
121 | { | 122 | { |
122 | IConfig sconfig = config.Configs["Startup"]; | 123 | IConfig sconfig = config.Configs["Startup"]; |
123 | if (sconfig != null) | 124 | if (sconfig != null) |
125 | { | ||
124 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 126 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
127 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); | ||
128 | } | ||
125 | } | 129 | } |
126 | 130 | ||
127 | m_assetService = m_Scene.AssetService; | 131 | m_assetService = m_Scene.AssetService; |
@@ -357,21 +361,37 @@ namespace OpenSim.Region.ClientStack.Linden | |||
357 | llsdRequest.asset_type == "animation" || | 361 | llsdRequest.asset_type == "animation" || |
358 | llsdRequest.asset_type == "sound") | 362 | llsdRequest.asset_type == "sound") |
359 | { | 363 | { |
364 | ScenePresence avatar = null; | ||
360 | IClientAPI client = null; | 365 | IClientAPI client = null; |
361 | IScene scene = null; | 366 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); |
362 | if (GetClient != null) | 367 | |
368 | // check user level | ||
369 | if (avatar != null) | ||
363 | { | 370 | { |
364 | client = GetClient(m_HostCapsObj.AgentID); | 371 | client = avatar.ControllingClient; |
365 | scene = client.Scene; | 372 | |
373 | if (avatar.UserLevel < m_levelUpload) | ||
374 | { | ||
375 | if (client != null) | ||
376 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
366 | 377 | ||
367 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | 378 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
379 | errorResponse.uploader = ""; | ||
380 | errorResponse.state = "error"; | ||
381 | return errorResponse; | ||
382 | } | ||
383 | } | ||
384 | |||
385 | // check funds | ||
386 | if (client != null) | ||
387 | { | ||
388 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); | ||
368 | 389 | ||
369 | if (mm != null) | 390 | if (mm != null) |
370 | { | 391 | { |
371 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) | 392 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) |
372 | { | 393 | { |
373 | if (client != null) | 394 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
374 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
375 | 395 | ||
376 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 396 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
377 | errorResponse.uploader = ""; | 397 | errorResponse.uploader = ""; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 1117f2a..91872c5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |||
@@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
56 | // private IAssetService m_assetService; | 56 | // private IAssetService m_assetService; |
57 | private bool m_dumpAssetsToFile = false; | 57 | private bool m_dumpAssetsToFile = false; |
58 | private bool m_enabled = true; | 58 | private bool m_enabled = true; |
59 | private int m_levelUpload = 0; | ||
59 | 60 | ||
60 | #region IRegionModuleBase Members | 61 | #region IRegionModuleBase Members |
61 | 62 | ||
@@ -72,6 +73,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
72 | return; | 73 | return; |
73 | 74 | ||
74 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); | 75 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); |
76 | m_levelUpload = meshConfig.GetInt("LevelUpload", 0); | ||
75 | } | 77 | } |
76 | 78 | ||
77 | public void AddRegion(Scene pScene) | 79 | public void AddRegion(Scene pScene) |
@@ -137,25 +139,41 @@ namespace OpenSim.Region.ClientStack.Linden | |||
137 | // llsdRequest.asset_type == "animation" || | 139 | // llsdRequest.asset_type == "animation" || |
138 | // llsdRequest.asset_type == "sound") | 140 | // llsdRequest.asset_type == "sound") |
139 | // { | 141 | // { |
142 | // check user level | ||
143 | ScenePresence avatar = null; | ||
140 | IClientAPI client = null; | 144 | IClientAPI client = null; |
145 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
141 | 146 | ||
142 | 147 | if (avatar != null) | |
148 | { | ||
149 | client = avatar.ControllingClient; | ||
150 | |||
151 | if (avatar.UserLevel < m_levelUpload) | ||
152 | { | ||
153 | if (client != null) | ||
154 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
155 | |||
156 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | ||
157 | errorResponse.rsvp = ""; | ||
158 | errorResponse.state = "error"; | ||
159 | return errorResponse; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | // check funds | ||
143 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); | 164 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); |
144 | 165 | ||
145 | if (mm != null) | 166 | if (mm != null) |
146 | { | 167 | { |
147 | if (m_scene.TryGetClient(agentID, out client)) | 168 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) |
148 | { | 169 | { |
149 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) | 170 | if (client != null) |
150 | { | 171 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
151 | if (client != null) | 172 | |
152 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 173 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
153 | 174 | errorResponse.rsvp = ""; | |
154 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 175 | errorResponse.state = "error"; |
155 | errorResponse.rsvp = ""; | 176 | return errorResponse; |
156 | errorResponse.state = "error"; | ||
157 | return errorResponse; | ||
158 | } | ||
159 | } | 177 | } |
160 | } | 178 | } |
161 | // } | 179 | // } |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 95e3aec..874693e 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
47 | 47 | ||
48 | protected Scene m_Scene; | 48 | protected Scene m_Scene; |
49 | private bool m_dumpAssetsToFile = false; | 49 | private bool m_dumpAssetsToFile = false; |
50 | private int m_levelUpload = 0; | ||
50 | 51 | ||
51 | /// <summary> | 52 | /// <summary> |
52 | /// Each agent has its own singleton collection of transactions | 53 | /// Each agent has its own singleton collection of transactions |
@@ -56,8 +57,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
56 | 57 | ||
57 | #region IRegionModule Members | 58 | #region IRegionModule Members |
58 | 59 | ||
59 | public void Initialise(IConfigSource config) | 60 | public void Initialise(IConfigSource source) |
60 | { | 61 | { |
62 | IConfig sconfig = source.Configs["Startup"]; | ||
63 | if (sconfig != null) | ||
64 | { | ||
65 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); | ||
66 | } | ||
61 | } | 67 | } |
62 | 68 | ||
63 | public void AddRegion(Scene scene) | 69 | public void AddRegion(Scene scene) |
@@ -241,7 +247,21 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
241 | (AssetType)type == AssetType.Animation) && | 247 | (AssetType)type == AssetType.Animation) && |
242 | tempFile == false) | 248 | tempFile == false) |
243 | { | 249 | { |
250 | ScenePresence avatar = null; | ||
244 | Scene scene = (Scene)remoteClient.Scene; | 251 | Scene scene = (Scene)remoteClient.Scene; |
252 | scene.TryGetScenePresence(remoteClient.AgentId, out avatar); | ||
253 | |||
254 | // check user level | ||
255 | if (avatar != null) | ||
256 | { | ||
257 | if (avatar.UserLevel < m_levelUpload) | ||
258 | { | ||
259 | remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
260 | return; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | // check funds | ||
245 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | 265 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); |
246 | 266 | ||
247 | if (mm != null) | 267 | if (mm != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2d73594..427a49d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -60,6 +60,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
60 | set { m_MaxTransferDistance = value; } | 60 | set { m_MaxTransferDistance = value; } |
61 | } | 61 | } |
62 | 62 | ||
63 | private int m_levelHGTeleport = 0; | ||
64 | |||
63 | protected bool m_Enabled = false; | 65 | protected bool m_Enabled = false; |
64 | protected Scene m_aScene; | 66 | protected Scene m_aScene; |
65 | protected List<Scene> m_Scenes = new List<Scene>(); | 67 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -101,7 +103,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
101 | { | 103 | { |
102 | IConfig transferConfig = source.Configs["EntityTransfer"]; | 104 | IConfig transferConfig = source.Configs["EntityTransfer"]; |
103 | if (transferConfig != null) | 105 | if (transferConfig != null) |
106 | { | ||
104 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | 107 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); |
108 | m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); | ||
109 | } | ||
105 | 110 | ||
106 | m_agentsInTransit = new List<UUID>(); | 111 | m_agentsInTransit = new List<UUID>(); |
107 | m_Enabled = true; | 112 | m_Enabled = true; |
@@ -227,6 +232,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
227 | return; | 232 | return; |
228 | } | 233 | } |
229 | 234 | ||
235 | // check if HyperGrid teleport is allowed, based on user level | ||
236 | int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID); | ||
237 | |||
238 | if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport)) | ||
239 | { | ||
240 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent."); | ||
241 | sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted"); | ||
242 | return; | ||
243 | } | ||
244 | |||
230 | uint curX = 0, curY = 0; | 245 | uint curX = 0, curY = 0; |
231 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | 246 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); |
232 | int curCellX = (int)(curX / Constants.RegionSize); | 247 | int curCellX = (int)(curX / Constants.RegionSize); |
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 4c501f6..6885327 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs | |||
@@ -93,7 +93,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
93 | void JoinGroupRequest(IClientAPI remoteClient, UUID GroupID); | 93 | void JoinGroupRequest(IClientAPI remoteClient, UUID GroupID); |
94 | void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); | 94 | void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); |
95 | void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); | 95 | void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); |
96 | void EjectGroupMember(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID EjecteeID); | ||
96 | void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); | 97 | void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); |
98 | void InviteGroup(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID InviteeID, UUID RoleID); | ||
97 | void NotifyChange(UUID GroupID); | 99 | void NotifyChange(UUID GroupID); |
98 | } | 100 | } |
99 | } \ No newline at end of file | 101 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c95c151..0b31e0c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1831,8 +1831,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1831 | 1831 | ||
1832 | foreach (SceneObjectGroup group in PrimsFromDB) | 1832 | foreach (SceneObjectGroup group in PrimsFromDB) |
1833 | { | 1833 | { |
1834 | EventManager.TriggerOnSceneObjectLoaded(group); | ||
1835 | AddRestoredSceneObject(group, true, true); | 1834 | AddRestoredSceneObject(group, true, true); |
1835 | EventManager.TriggerOnSceneObjectLoaded(group); | ||
1836 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1836 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1837 | rootPart.Flags &= ~PrimFlags.Scripted; | 1837 | rootPart.Flags &= ~PrimFlags.Scripted; |
1838 | rootPart.TrimPermissions(); | 1838 | rootPart.TrimPermissions(); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index b60cd42..2a15e5d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
84 | private bool m_groupsEnabled = false; | 84 | private bool m_groupsEnabled = false; |
85 | private bool m_groupNoticesEnabled = true; | 85 | private bool m_groupNoticesEnabled = true; |
86 | private bool m_debugEnabled = false; | 86 | private bool m_debugEnabled = false; |
87 | private int m_levelGroupCreate = 0; | ||
87 | 88 | ||
88 | #region IRegionModuleBase Members | 89 | #region IRegionModuleBase Members |
89 | 90 | ||
@@ -115,6 +116,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
115 | 116 | ||
116 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); | 117 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); |
117 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); | 118 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); |
119 | m_levelGroupCreate = groupsConfig.GetInt("LevelGroupCreate", 0); | ||
118 | } | 120 | } |
119 | } | 121 | } |
120 | 122 | ||
@@ -708,13 +710,29 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
708 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); | 710 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); |
709 | return UUID.Zero; | 711 | return UUID.Zero; |
710 | } | 712 | } |
713 | |||
714 | // check user level | ||
715 | ScenePresence avatar = null; | ||
716 | Scene scene = (Scene)remoteClient.Scene; | ||
717 | scene.TryGetScenePresence(remoteClient.AgentId, out avatar); | ||
718 | |||
719 | if (avatar != null) | ||
720 | { | ||
721 | if (avatar.UserLevel < m_levelGroupCreate) | ||
722 | { | ||
723 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); | ||
724 | return UUID.Zero; | ||
725 | } | ||
726 | } | ||
727 | |||
728 | // check funds | ||
711 | // is there is a money module present ? | 729 | // is there is a money module present ? |
712 | IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>(); | 730 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); |
713 | if (money != null) | 731 | if (money != null) |
714 | { | 732 | { |
715 | // do the transaction, that is if the agent has got sufficient funds | 733 | // do the transaction, that is if the agent has got sufficient funds |
716 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { | 734 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { |
717 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group."); | 735 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); |
718 | return UUID.Zero; | 736 | return UUID.Zero; |
719 | } | 737 | } |
720 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation"); | 738 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation"); |
@@ -939,17 +957,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
939 | 957 | ||
940 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) | 958 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) |
941 | { | 959 | { |
942 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 960 | EjectGroupMember(remoteClient, GetRequestingAgentID(remoteClient), groupID, ejecteeID); |
961 | } | ||
943 | 962 | ||
963 | public void EjectGroupMember(IClientAPI remoteClient, UUID agentID, UUID groupID, UUID ejecteeID) | ||
964 | { | ||
965 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
944 | 966 | ||
945 | // Todo: Security check? | 967 | // Todo: Security check? |
946 | m_groupData.RemoveAgentFromGroup(GetRequestingAgentID(remoteClient), ejecteeID, groupID); | 968 | m_groupData.RemoveAgentFromGroup(agentID, ejecteeID, groupID); |
947 | 969 | ||
948 | remoteClient.SendEjectGroupMemberReply(GetRequestingAgentID(remoteClient), groupID, true); | 970 | string agentName; |
971 | RegionInfo regionInfo; | ||
949 | 972 | ||
950 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); | 973 | // remoteClient provided or just agentID? |
974 | if (remoteClient != null) | ||
975 | { | ||
976 | agentName = remoteClient.Name; | ||
977 | regionInfo = remoteClient.Scene.RegionInfo; | ||
978 | remoteClient.SendEjectGroupMemberReply(agentID, groupID, true); | ||
979 | } | ||
980 | else | ||
981 | { | ||
982 | IClientAPI client = GetActiveClient(agentID); | ||
983 | |||
984 | if (client != null) | ||
985 | { | ||
986 | agentName = client.Name; | ||
987 | regionInfo = client.Scene.RegionInfo; | ||
988 | client.SendEjectGroupMemberReply(agentID, groupID, true); | ||
989 | } | ||
990 | else | ||
991 | { | ||
992 | regionInfo = m_sceneList[0].RegionInfo; | ||
993 | UserAccount acc = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, agentID); | ||
951 | 994 | ||
952 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, ejecteeID); | 995 | if (acc != null) |
996 | { | ||
997 | agentName = acc.FirstName + " " + acc.LastName; | ||
998 | } | ||
999 | else | ||
1000 | { | ||
1001 | agentName = "Unknown member"; | ||
1002 | } | ||
1003 | } | ||
1004 | } | ||
1005 | |||
1006 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); | ||
1007 | |||
1008 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, ejecteeID); | ||
953 | if ((groupInfo == null) || (account == null)) | 1009 | if ((groupInfo == null) || (account == null)) |
954 | { | 1010 | { |
955 | return; | 1011 | return; |
@@ -959,23 +1015,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
959 | GridInstantMessage msg = new GridInstantMessage(); | 1015 | GridInstantMessage msg = new GridInstantMessage(); |
960 | 1016 | ||
961 | msg.imSessionID = UUID.Zero.Guid; | 1017 | msg.imSessionID = UUID.Zero.Guid; |
962 | msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; | 1018 | msg.fromAgentID = agentID.Guid; |
963 | // msg.fromAgentID = info.GroupID; | 1019 | // msg.fromAgentID = info.GroupID; |
964 | msg.toAgentID = ejecteeID.Guid; | 1020 | msg.toAgentID = ejecteeID.Guid; |
965 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 1021 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
966 | msg.timestamp = 0; | 1022 | msg.timestamp = 0; |
967 | msg.fromAgentName = remoteClient.Name; | 1023 | msg.fromAgentName = agentName; |
968 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName); | 1024 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); |
969 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | 1025 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; |
970 | msg.fromGroup = false; | 1026 | msg.fromGroup = false; |
971 | msg.offline = (byte)0; | 1027 | msg.offline = (byte)0; |
972 | msg.ParentEstateID = 0; | 1028 | msg.ParentEstateID = 0; |
973 | msg.Position = Vector3.Zero; | 1029 | msg.Position = Vector3.Zero; |
974 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1030 | msg.RegionID = regionInfo.RegionID.Guid; |
975 | msg.binaryBucket = new byte[0]; | 1031 | msg.binaryBucket = new byte[0]; |
976 | OutgoingInstantMessage(msg, ejecteeID); | 1032 | OutgoingInstantMessage(msg, ejecteeID); |
977 | 1033 | ||
978 | |||
979 | // Message to ejector | 1034 | // Message to ejector |
980 | // Interop, received special 210 code for ejecting a group member | 1035 | // Interop, received special 210 code for ejecting a group member |
981 | // this only works within the comms servers domain, and won't work hypergrid | 1036 | // this only works within the comms servers domain, and won't work hypergrid |
@@ -985,26 +1040,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
985 | 1040 | ||
986 | msg = new GridInstantMessage(); | 1041 | msg = new GridInstantMessage(); |
987 | msg.imSessionID = UUID.Zero.Guid; | 1042 | msg.imSessionID = UUID.Zero.Guid; |
988 | msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; | 1043 | msg.fromAgentID = agentID.Guid; |
989 | msg.toAgentID = GetRequestingAgentID(remoteClient).Guid; | 1044 | msg.toAgentID = agentID.Guid; |
990 | msg.timestamp = 0; | 1045 | msg.timestamp = 0; |
991 | msg.fromAgentName = remoteClient.Name; | 1046 | msg.fromAgentName = agentName; |
992 | if (account != null) | 1047 | if (account != null) |
993 | { | 1048 | { |
994 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, account.FirstName + " " + account.LastName); | 1049 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, account.FirstName + " " + account.LastName); |
995 | } | 1050 | } |
996 | else | 1051 | else |
997 | { | 1052 | { |
998 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, "Unknown member"); | 1053 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); |
999 | } | 1054 | } |
1000 | msg.dialog = (byte)210; //interop | 1055 | msg.dialog = (byte)210; //interop |
1001 | msg.fromGroup = false; | 1056 | msg.fromGroup = false; |
1002 | msg.offline = (byte)0; | 1057 | msg.offline = (byte)0; |
1003 | msg.ParentEstateID = 0; | 1058 | msg.ParentEstateID = 0; |
1004 | msg.Position = Vector3.Zero; | 1059 | msg.Position = Vector3.Zero; |
1005 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1060 | msg.RegionID = regionInfo.RegionID.Guid; |
1006 | msg.binaryBucket = new byte[0]; | 1061 | msg.binaryBucket = new byte[0]; |
1007 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); | 1062 | OutgoingInstantMessage(msg, agentID); |
1008 | 1063 | ||
1009 | 1064 | ||
1010 | // SL sends out messages to everyone in the group | 1065 | // SL sends out messages to everyone in the group |
@@ -1014,16 +1069,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1014 | 1069 | ||
1015 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) | 1070 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) |
1016 | { | 1071 | { |
1072 | InviteGroup(remoteClient, GetRequestingAgentID(remoteClient), groupID, invitedAgentID, roleID); | ||
1073 | } | ||
1074 | |||
1075 | public void InviteGroup(IClientAPI remoteClient, UUID agentID, UUID groupID, UUID invitedAgentID, UUID roleID) | ||
1076 | { | ||
1017 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1077 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1018 | 1078 | ||
1079 | string agentName; | ||
1080 | RegionInfo regionInfo; | ||
1081 | |||
1082 | // remoteClient provided or just agentID? | ||
1083 | if (remoteClient != null) | ||
1084 | { | ||
1085 | agentName = remoteClient.Name; | ||
1086 | regionInfo = remoteClient.Scene.RegionInfo; | ||
1087 | } | ||
1088 | else | ||
1089 | { | ||
1090 | IClientAPI client = GetActiveClient(agentID); | ||
1091 | |||
1092 | if (client != null) | ||
1093 | { | ||
1094 | agentName = client.Name; | ||
1095 | regionInfo = client.Scene.RegionInfo; | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | regionInfo = m_sceneList[0].RegionInfo; | ||
1100 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, agentID); | ||
1101 | |||
1102 | if (account != null) | ||
1103 | { | ||
1104 | agentName = account.FirstName + " " + account.LastName; | ||
1105 | } | ||
1106 | else | ||
1107 | { | ||
1108 | agentName = "Unknown member"; | ||
1109 | } | ||
1110 | } | ||
1111 | } | ||
1112 | |||
1019 | // Todo: Security check, probably also want to send some kind of notification | 1113 | // Todo: Security check, probably also want to send some kind of notification |
1020 | UUID InviteID = UUID.Random(); | 1114 | UUID InviteID = UUID.Random(); |
1021 | 1115 | ||
1022 | m_groupData.AddAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID, groupID, roleID, invitedAgentID); | 1116 | m_groupData.AddAgentToGroupInvite(agentID, InviteID, groupID, roleID, invitedAgentID); |
1023 | 1117 | ||
1024 | // Check to see if the invite went through, if it did not then it's possible | 1118 | // Check to see if the invite went through, if it did not then it's possible |
1025 | // the remoteClient did not validate or did not have permission to invite. | 1119 | // the remoteClient did not validate or did not have permission to invite. |
1026 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID); | 1120 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(agentID, InviteID); |
1027 | 1121 | ||
1028 | if (inviteInfo != null) | 1122 | if (inviteInfo != null) |
1029 | { | 1123 | { |
@@ -1035,19 +1129,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1035 | 1129 | ||
1036 | msg.imSessionID = inviteUUID; | 1130 | msg.imSessionID = inviteUUID; |
1037 | 1131 | ||
1038 | // msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; | 1132 | // msg.fromAgentID = agentID.Guid; |
1039 | msg.fromAgentID = groupID.Guid; | 1133 | msg.fromAgentID = groupID.Guid; |
1040 | msg.toAgentID = invitedAgentID.Guid; | 1134 | msg.toAgentID = invitedAgentID.Guid; |
1041 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 1135 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
1042 | msg.timestamp = 0; | 1136 | msg.timestamp = 0; |
1043 | msg.fromAgentName = remoteClient.Name; | 1137 | msg.fromAgentName = agentName; |
1044 | msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", remoteClient.Name); | 1138 | msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", agentName); |
1045 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; | 1139 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; |
1046 | msg.fromGroup = true; | 1140 | msg.fromGroup = true; |
1047 | msg.offline = (byte)0; | 1141 | msg.offline = (byte)0; |
1048 | msg.ParentEstateID = 0; | 1142 | msg.ParentEstateID = 0; |
1049 | msg.Position = Vector3.Zero; | 1143 | msg.Position = Vector3.Zero; |
1050 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1144 | msg.RegionID = regionInfo.RegionID.Guid; |
1051 | msg.binaryBucket = new byte[20]; | 1145 | msg.binaryBucket = new byte[20]; |
1052 | 1146 | ||
1053 | OutgoingInstantMessage(msg, invitedAgentID); | 1147 | OutgoingInstantMessage(msg, invitedAgentID); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d7a629b..7455929 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4151,6 +4151,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4151 | case 4: // DATA_RATING (0,0,0,0,0,0) | 4151 | case 4: // DATA_RATING (0,0,0,0,0,0) |
4152 | reply = "0,0,0,0,0,0"; | 4152 | reply = "0,0,0,0,0,0"; |
4153 | break; | 4153 | break; |
4154 | case 7: // DATA_USERLEVEL (integer) | ||
4155 | reply = account.UserLevel.ToString(); | ||
4156 | break; | ||
4154 | case 8: // DATA_PAYINFO (0|1|2|3) | 4157 | case 8: // DATA_PAYINFO (0|1|2|3) |
4155 | reply = "0"; | 4158 | reply = "0"; |
4156 | break; | 4159 | break; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2ecd890..a5dcba4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2980,5 +2980,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2980 | 2980 | ||
2981 | return String.Empty; | 2981 | return String.Empty; |
2982 | } | 2982 | } |
2983 | |||
2984 | /// <summary> | ||
2985 | /// Invite user to the group this object is set to | ||
2986 | /// </summary> | ||
2987 | /// <param name="agentId"></param> | ||
2988 | /// <returns></returns> | ||
2989 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | ||
2990 | { | ||
2991 | CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); | ||
2992 | m_host.AddScriptLPS(1); | ||
2993 | |||
2994 | UUID agent = new UUID(agentId); | ||
2995 | |||
2996 | // groups module is required | ||
2997 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
2998 | if (groupsModule == null) return ScriptBaseClass.FALSE; | ||
2999 | |||
3000 | // object has to be set to a group, but not group owned | ||
3001 | if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE; | ||
3002 | |||
3003 | // object owner has to be in that group and required permissions | ||
3004 | GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID); | ||
3005 | if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0) return ScriptBaseClass.FALSE; | ||
3006 | |||
3007 | // check if agent is in that group already | ||
3008 | //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent); | ||
3009 | //if (member != null) return ScriptBaseClass.FALSE; | ||
3010 | |||
3011 | // invited agent has to be present in this scene | ||
3012 | if (World.GetScenePresence(agent) == null) return ScriptBaseClass.FALSE; | ||
3013 | |||
3014 | groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero); | ||
3015 | |||
3016 | return ScriptBaseClass.TRUE; | ||
3017 | } | ||
3018 | |||
3019 | /// <summary> | ||
3020 | /// Eject user from the group this object is set to | ||
3021 | /// </summary> | ||
3022 | /// <param name="agentId"></param> | ||
3023 | /// <returns></returns> | ||
3024 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | ||
3025 | { | ||
3026 | CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); | ||
3027 | m_host.AddScriptLPS(1); | ||
3028 | |||
3029 | UUID agent = new UUID(agentId); | ||
3030 | |||
3031 | // groups module is required | ||
3032 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
3033 | if (groupsModule == null) return ScriptBaseClass.FALSE; | ||
3034 | |||
3035 | // object has to be set to a group, but not group owned | ||
3036 | if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE; | ||
3037 | |||
3038 | // object owner has to be in that group and required permissions | ||
3039 | GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID); | ||
3040 | if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0) return ScriptBaseClass.FALSE; | ||
3041 | |||
3042 | // agent has to be in that group | ||
3043 | //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent); | ||
3044 | //if (member == null) return ScriptBaseClass.FALSE; | ||
3045 | |||
3046 | // ejectee can be offline | ||
3047 | |||
3048 | groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent); | ||
3049 | |||
3050 | return ScriptBaseClass.TRUE; | ||
3051 | } | ||
2983 | } | 3052 | } |
2984 | } \ No newline at end of file | 3053 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 8f9efc0..30bd3ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -231,5 +231,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
231 | LSL_String osUnixTimeToTimestamp(long time); | 231 | LSL_String osUnixTimeToTimestamp(long time); |
232 | 232 | ||
233 | LSL_String osGetInventoryDesc(string item); | 233 | LSL_String osGetInventoryDesc(string item); |
234 | |||
235 | LSL_Integer osInviteToGroup(LSL_Key agentId); | ||
236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); | ||
234 | } | 237 | } |
235 | } | 238 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 09e5992..680cefb4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -868,5 +868,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
868 | { | 868 | { |
869 | return m_OSSL_Functions.osGetInventoryDesc(item); | 869 | return m_OSSL_Functions.osGetInventoryDesc(item); |
870 | } | 870 | } |
871 | |||
872 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | ||
873 | { | ||
874 | return m_OSSL_Functions.osInviteToGroup(agentId); | ||
875 | } | ||
876 | |||
877 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | ||
878 | { | ||
879 | return m_OSSL_Functions.osEjectFromGroup(agentId); | ||
880 | } | ||
871 | } | 881 | } |
872 | } | 882 | } |