aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authormingchen2008-05-13 16:22:57 +0000
committermingchen2008-05-13 16:22:57 +0000
commit32785921d0a4a074b92da0f4ec322cf451a4642f (patch)
treeae93cc8fb09a5d7b991e323617e3324042e30a8d /OpenSim
parent* Remove old historical grid inventory code (diff)
downloadopensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.zip
opensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.gz
opensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.bz2
opensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.xz
*Complete redo of the permissions module
*Removed hardcoded permissions checks *Added permissions checks where needed
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Region/Application/OpenSimMainConsole.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs81
-rw-r--r--OpenSim/Region/Environment/Interfaces/IScenePermissions.cs1
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs17
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandObject.cs82
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs818
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs29
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs378
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs2
15 files changed, 858 insertions, 612 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 64b68d9..ec67f9a 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -500,6 +500,8 @@ namespace OpenSim.Framework
500 500
501 public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); 501 public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
502 502
503 public delegate void ParcelAbandonRequest(int local_id, IClientAPI remote_client);
504
503 public delegate void EstateOwnerMessageRequest(LLUUID AgentID, LLUUID SessionID, LLUUID TransactionID, LLUUID Invoice, byte[] Method, byte[][] Parameters, IClientAPI remote_client); 505 public delegate void EstateOwnerMessageRequest(LLUUID AgentID, LLUUID SessionID, LLUUID TransactionID, LLUUID Invoice, byte[] Method, byte[][] Parameters, IClientAPI remote_client);
504 506
505 public delegate void RegionInfoRequest(IClientAPI remote_client); 507 public delegate void RegionInfoRequest(IClientAPI remote_client);
@@ -762,6 +764,7 @@ namespace OpenSim.Framework
762 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 764 event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
763 event ParcelSelectObjects OnParcelSelectObjects; 765 event ParcelSelectObjects OnParcelSelectObjects;
764 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 766 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
767 event ParcelAbandonRequest OnParcelAbandonRequest;
765 event RegionInfoRequest OnRegionInfoRequest; 768 event RegionInfoRequest OnRegionInfoRequest;
766 event EstateCovenantRequest OnEstateCovenantRequest; 769 event EstateCovenantRequest OnEstateCovenantRequest;
767 770
diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs
index f33441f..39f2b7b 100644
--- a/OpenSim/Region/Application/OpenSimMainConsole.cs
+++ b/OpenSim/Region/Application/OpenSimMainConsole.cs
@@ -244,7 +244,6 @@ namespace OpenSim
244 m_console.Notice("force-update - force an update of prims in the scene"); 244 m_console.Notice("force-update - force an update of prims in the scene");
245 m_console.Notice("load-xml [filename] - load prims from XML"); 245 m_console.Notice("load-xml [filename] - load prims from XML");
246 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); 246 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
247 m_console.Notice("permissions [true/false] - turn on/off permissions on the scene");
248 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); 247 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
249 m_console.Notice("remove-region [name] - remove a region"); 248 m_console.Notice("remove-region [name] - remove a region");
250 m_console.Notice("save-xml [filename] - save prims to XML"); 249 m_console.Notice("save-xml [filename] - save prims to XML");
@@ -368,12 +367,6 @@ namespace OpenSim
368 } 367 }
369 break; 368 break;
370 369
371 case "permissions":
372 // Treats each user as a super-admin when disabled
373 bool permissions = Convert.ToBoolean(cmdparams[0]);
374 m_sceneManager.SetBypassPermissionsOnCurrentScene(!permissions);
375 break;
376
377 case "backup": 370 case "backup":
378 m_sceneManager.BackupCurrentScene(); 371 m_sceneManager.BackupCurrentScene();
379 break; 372 break;
@@ -538,7 +531,6 @@ namespace OpenSim
538 } 531 }
539 532
540 break; 533 break;
541
542 default: 534 default:
543 string[] tmpPluginArgs = new string[cmdparams.Length + 1]; 535 string[] tmpPluginArgs = new string[cmdparams.Length + 1];
544 cmdparams.CopyTo(tmpPluginArgs, 1); 536 cmdparams.CopyTo(tmpPluginArgs, 1);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4973c5d..eb415e4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -217,6 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
217 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = null; //OnParcelPropertiesUpdateRequest; 217 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = null; //OnParcelPropertiesUpdateRequest;
218 private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects; 218 private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects;
219 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest; 219 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest;
220 private ParcelAbandonRequest handlerParcelAbandonRequest = null;
220 private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest; 221 private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest;
221 private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest; 222 private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest;
222 private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers; 223 private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers;
@@ -790,7 +791,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
790 public event ParcelJoinRequest OnParcelJoinRequest; 791 public event ParcelJoinRequest OnParcelJoinRequest;
791 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 792 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
792 public event ParcelSelectObjects OnParcelSelectObjects; 793 public event ParcelSelectObjects OnParcelSelectObjects;
793 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 794 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
795 public event ParcelAbandonRequest OnParcelAbandonRequest;
794 public event RegionInfoRequest OnRegionInfoRequest; 796 public event RegionInfoRequest OnRegionInfoRequest;
795 public event EstateCovenantRequest OnEstateCovenantRequest; 797 public event EstateCovenantRequest OnEstateCovenantRequest;
796 798
@@ -945,25 +947,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
945 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp, 947 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp,
946 byte[] binaryBucket) 948 byte[] binaryBucket)
947 { 949 {
948 ImprovedInstantMessagePacket msg 950 if (((Scene)(this.m_scene)).ExternalChecks.ExternalChecksCanInstantMessage(fromAgent, toAgent))
949 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); 951 {
950 952 ImprovedInstantMessagePacket msg
951 msg.AgentData.AgentID = fromAgent; 953 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
952 msg.AgentData.SessionID = fromAgentSession; 954
953 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); 955 msg.AgentData.AgentID = fromAgent;
954 msg.MessageBlock.Dialog = dialog; 956 msg.AgentData.SessionID = fromAgentSession;
955 msg.MessageBlock.FromGroup = false; 957 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
956 msg.MessageBlock.ID = imSessionID; 958 msg.MessageBlock.Dialog = dialog;
957 msg.MessageBlock.Offline = 0; 959 msg.MessageBlock.FromGroup = false;
958 msg.MessageBlock.ParentEstateID = 0; 960 msg.MessageBlock.ID = imSessionID;
959 msg.MessageBlock.Position = new LLVector3(); 961 msg.MessageBlock.Offline = 0;
960 msg.MessageBlock.RegionID = LLUUID.Random(); 962 msg.MessageBlock.ParentEstateID = 0;
961 msg.MessageBlock.Timestamp = timeStamp; 963 msg.MessageBlock.Position = new LLVector3();
962 msg.MessageBlock.ToAgentID = toAgent; 964 msg.MessageBlock.RegionID = LLUUID.Random();
963 msg.MessageBlock.Message = Helpers.StringToField(message); 965 msg.MessageBlock.Timestamp = timeStamp;
964 msg.MessageBlock.BinaryBucket = binaryBucket; 966 msg.MessageBlock.ToAgentID = toAgent;
965 967 msg.MessageBlock.Message = Helpers.StringToField(message);
966 OutPacket(msg, ThrottleOutPacketType.Task); 968 msg.MessageBlock.BinaryBucket = binaryBucket;
969
970 OutPacket(msg, ThrottleOutPacketType.Task);
971 }
967 } 972 }
968 973
969 /// <summary> 974 /// <summary>
@@ -5254,7 +5259,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5254 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 5259 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
5255 } 5260 }
5256 break; 5261 break;
5257 5262 case PacketType.ParcelRelease:
5263 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack;
5264
5265 handlerParcelAbandonRequest = OnParcelAbandonRequest;
5266 if (handlerParcelAbandonRequest != null)
5267 {
5268 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
5269 }
5270 break;
5258 #endregion 5271 #endregion
5259 5272
5260 #region Estate Packets 5273 #region Estate Packets
@@ -5267,13 +5280,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5267 { 5280 {
5268 case "getinfo": 5281 case "getinfo":
5269 5282
5270 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) 5283 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5271 { 5284 {
5272 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); 5285 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
5273 } 5286 }
5274 break; 5287 break;
5275 case "setregioninfo": 5288 case "setregioninfo":
5276 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) 5289 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5277 { 5290 {
5278 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter), 5291 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter),
5279 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), 5292 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
@@ -5286,7 +5299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5286 5299
5287 break; 5300 break;
5288 case "texturebase": 5301 case "texturebase":
5289 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) 5302 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5290 { 5303 {
5291 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5304 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5292 { 5305 {
@@ -5301,7 +5314,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5301 } 5314 }
5302 break; 5315 break;
5303 case "texturedetail": 5316 case "texturedetail":
5304 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) 5317 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5305 { 5318 {
5306 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5319 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5307 { 5320 {
@@ -5319,7 +5332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5319 5332
5320 break; 5333 break;
5321 case "textureheights": 5334 case "textureheights":
5322 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) 5335 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5323 { 5336 {
5324 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5337 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5325 { 5338 {
@@ -5340,7 +5353,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5340 OnCommitEstateTerrainTextureRequest(this); 5353 OnCommitEstateTerrainTextureRequest(this);
5341 break; 5354 break;
5342 case "setregionterrain": 5355 case "setregionterrain":
5343 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) 5356 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5344 { 5357 {
5345 if (messagePacket.ParamList.Length != 9) 5358 if (messagePacket.ParamList.Length != 9)
5346 { 5359 {
@@ -5375,7 +5388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5375 5388
5376 break; 5389 break;
5377 case "restart": 5390 case "restart":
5378 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanRestartSim(this.AgentId)) 5391 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5379 { 5392 {
5380 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. 5393 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
5381 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5394 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
@@ -5389,7 +5402,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5389 } 5402 }
5390 break; 5403 break;
5391 case "estatechangecovenantid": 5404 case "estatechangecovenantid":
5392 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId)) 5405 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5393 { 5406 {
5394 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5407 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5395 { 5408 {
@@ -5399,7 +5412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5399 } 5412 }
5400 break; 5413 break;
5401 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. 5414 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
5402 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) 5415 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5403 { 5416 {
5404 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter)); 5417 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter));
5405 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter))); 5418 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)));
@@ -5407,7 +5420,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5407 } 5420 }
5408 break; 5421 break;
5409 case "simulatormessage": 5422 case "simulatormessage":
5410 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) 5423 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5411 { 5424 {
5412 LLUUID invoice = messagePacket.MethodData.Invoice; 5425 LLUUID invoice = messagePacket.MethodData.Invoice;
5413 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); 5426 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@@ -5418,7 +5431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5418 } 5431 }
5419 break; 5432 break;
5420 case "instantmessage": 5433 case "instantmessage":
5421 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) 5434 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5422 { 5435 {
5423 LLUUID invoice = messagePacket.MethodData.Invoice; 5436 LLUUID invoice = messagePacket.MethodData.Invoice;
5424 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); 5437 LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@@ -5429,7 +5442,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5429 } 5442 }
5430 break; 5443 break;
5431 case "setregiondebug": 5444 case "setregiondebug":
5432 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) 5445 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5433 { 5446 {
5434 LLUUID invoice = messagePacket.MethodData.Invoice; 5447 LLUUID invoice = messagePacket.MethodData.Invoice;
5435 LLUUID SenderID = messagePacket.AgentData.AgentID; 5448 LLUUID SenderID = messagePacket.AgentData.AgentID;
@@ -5441,7 +5454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5441 } 5454 }
5442 break; 5455 break;
5443 case "teleporthomeuser": 5456 case "teleporthomeuser":
5444 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId)) 5457 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
5445 { 5458 {
5446 LLUUID invoice = messagePacket.MethodData.Invoice; 5459 LLUUID invoice = messagePacket.MethodData.Invoice;
5447 LLUUID SenderID = messagePacket.AgentData.AgentID; 5460 LLUUID SenderID = messagePacket.AgentData.AgentID;
diff --git a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs
index 06c6611..bef6b44 100644
--- a/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs
+++ b/OpenSim/Region/Environment/Interfaces/IScenePermissions.cs
@@ -32,6 +32,7 @@ namespace OpenSim.Region.Environment.Interfaces
32 public interface IScenePermissions 32 public interface IScenePermissions
33 { 33 {
34 bool BypassPermissions { get; set; } 34 bool BypassPermissions { get; set; }
35 bool BypassPermissionsValue { get; set; }
35 uint GenerateClientFlags(LLUUID user, LLUUID objID); 36 uint GenerateClientFlags(LLUUID user, LLUUID objID);
36 } 37 }
37} 38}
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs
index 2a28283..b5d5e6e 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs
@@ -400,7 +400,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
400 400
401 //If we are still here, then they are subdividing within one piece of land 401 //If we are still here, then they are subdividing within one piece of land
402 //Check owner 402 //Check owner
403 if (startLandObject.landData.ownerID != attempting_user_id) 403 if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id,startLandObject))
404 { 404 {
405 return; 405 return;
406 } 406 }
@@ -469,7 +469,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
469 { 469 {
470 return; 470 return;
471 } 471 }
472 if (masterLandObject.landData.ownerID != attempting_user_id) 472 if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id, masterLandObject))
473 { 473 {
474 return; 474 return;
475 } 475 }
@@ -655,6 +655,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
655 655
656 public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) 656 public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client)
657 { 657 {
658
658 landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); 659 landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client);
659 } 660 }
660 661
@@ -663,6 +664,18 @@ namespace OpenSim.Region.Environment.Modules.World.Land
663 landList[local_id].sendLandObjectOwners(remote_client); 664 landList[local_id].sendLandObjectOwners(remote_client);
664 } 665 }
665 666
667 public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client)
668 {
669 if (landList.ContainsKey(local_id))
670 {
671 if (m_scene.ExternalChecks.ExternalChecksCanAbandonParcel(remote_client.AgentId, landList[local_id]))
672 {
673 landList[local_id].landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
674 m_scene.Broadcast(SendParcelOverlay);
675 }
676 }
677
678 }
666 #endregion 679 #endregion
667 680
668 #region ILandChannel Members 681 #region ILandChannel Members
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
index a339ebf..2719a20 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
@@ -52,7 +52,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
52 m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; 52 m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
53 m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); 53 m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
54 m_scene.EventManager.OnSignificantClientMovement += landChannel.handleSignificantClientMovement; 54 m_scene.EventManager.OnSignificantClientMovement += landChannel.handleSignificantClientMovement;
55
56 lock (m_scene) 55 lock (m_scene)
57 { 56 {
58 m_scene.LandChannel = (ILandChannel) landChannel; 57 m_scene.LandChannel = (ILandChannel) landChannel;
@@ -70,8 +69,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
70 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(landChannel.handleParcelObjectOwnersRequest); 69 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(landChannel.handleParcelObjectOwnersRequest);
71 client.OnParcelAccessListRequest += new ParcelAccessListRequest(landChannel.handleParcelAccessRequest); 70 client.OnParcelAccessListRequest += new ParcelAccessListRequest(landChannel.handleParcelAccessRequest);
72 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(landChannel.handleParcelAccessUpdateRequest); 71 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(landChannel.handleParcelAccessUpdateRequest);
72 client.OnParcelAbandonRequest += new ParcelAbandonRequest(landChannel.handleParcelAbandonRequest);
73 } 73 }
74 74
75
76
75 public void PostInitialise() 77 public void PostInitialise()
76 { 78 {
77 } 79 }
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs
index 2d3359c..0236e5f 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs
@@ -127,12 +127,19 @@ namespace OpenSim.Region.Environment.Modules.World.Land
127 127
128 public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 128 public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
129 { 129 {
130 if (remote_client.AgentId == landData.ownerID) 130 if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId,this))
131 { 131 {
132 //Needs later group support 132 //Needs later group support
133 LandData newData = landData.Copy(); 133 LandData newData = landData.Copy();
134 134
135 newData.authBuyerID = args.AuthBuyerID; 135 if (args.AuthBuyerID != newData.authBuyerID || args.SalePrice != newData.salePrice)
136 {
137 if (m_scene.ExternalChecks.ExternalChecksCanSellParcel(remote_client.AgentId, this))
138 {
139 newData.authBuyerID = args.AuthBuyerID;
140 newData.salePrice = args.SalePrice;
141 }
142 }
136 newData.category = args.Category; 143 newData.category = args.Category;
137 newData.landDesc = args.Desc; 144 newData.landDesc = args.Desc;
138 newData.groupID = args.GroupID; 145 newData.groupID = args.GroupID;
@@ -145,7 +152,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
145 newData.landFlags = args.ParcelFlags; 152 newData.landFlags = args.ParcelFlags;
146 newData.passHours = args.PassHours; 153 newData.passHours = args.PassHours;
147 newData.passPrice = args.PassPrice; 154 newData.passPrice = args.PassPrice;
148 newData.salePrice = args.SalePrice;
149 newData.snapshotID = args.SnapshotID; 155 newData.snapshotID = args.SnapshotID;
150 newData.userLocation = args.UserLocation; 156 newData.userLocation = args.UserLocation;
151 newData.userLookAt = args.UserLookAt; 157 newData.userLookAt = args.UserLookAt;
@@ -587,27 +593,30 @@ namespace OpenSim.Region.Environment.Modules.World.Land
587 593
588 public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) 594 public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client)
589 { 595 {
590 List<uint> resultLocalIDs = new List<uint>(); 596 if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this))
591 foreach (SceneObjectGroup obj in primsOverMe)
592 { 597 {
593 if (obj.LocalId > 0) 598 List<uint> resultLocalIDs = new List<uint>();
599 foreach (SceneObjectGroup obj in primsOverMe)
594 { 600 {
595 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) 601 if (obj.LocalId > 0)
596 { 602 {
597 resultLocalIDs.Add(obj.LocalId); 603 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID)
598 } 604 {
605 resultLocalIDs.Add(obj.LocalId);
606 }
599 // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support 607 // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support
600 // { 608 // {
601 // } 609 // }
602 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && 610 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER &&
603 obj.OwnerID != remote_client.AgentId) 611 obj.OwnerID != remote_client.AgentId)
604 { 612 {
605 resultLocalIDs.Add(obj.LocalId); 613 resultLocalIDs.Add(obj.LocalId);
614 }
606 } 615 }
607 } 616 }
608 }
609 617
610 remote_client.sendForceClientSelectObjects(resultLocalIDs); 618 remote_client.sendForceClientSelectObjects(resultLocalIDs);
619 }
611 } 620 }
612 621
613 /// <summary> 622 /// <summary>
@@ -620,32 +629,35 @@ namespace OpenSim.Region.Environment.Modules.World.Land
620 /// </param> 629 /// </param>
621 public void sendLandObjectOwners(IClientAPI remote_client) 630 public void sendLandObjectOwners(IClientAPI remote_client)
622 { 631 {
623 Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>(); 632 if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this))
624
625 foreach (SceneObjectGroup obj in primsOverMe)
626 { 633 {
627 try 634 Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
635
636 foreach (SceneObjectGroup obj in primsOverMe)
628 { 637 {
629 if (!primCount.ContainsKey(obj.OwnerID)) 638 try
630 { 639 {
631 primCount.Add(obj.OwnerID, 0); 640 if (!primCount.ContainsKey(obj.OwnerID))
641 {
642 primCount.Add(obj.OwnerID, 0);
643 }
644 }
645 catch (NullReferenceException)
646 {
647 m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel");
648 }
649 try
650 {
651 primCount[obj.OwnerID] += obj.PrimCount;
652 }
653 catch (KeyNotFoundException)
654 {
655 m_log.Error("[LAND]: Unable to match a prim with it's owner.");
632 } 656 }
633 } 657 }
634 catch (NullReferenceException)
635 {
636 m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel");
637 }
638 try
639 {
640 primCount[obj.OwnerID] += obj.PrimCount;
641 }
642 catch (KeyNotFoundException)
643 {
644 m_log.Error("[LAND]: Unable to match a prim with it's owner.");
645 }
646 }
647 658
648 remote_client.sendLandObjectOwners(primCount); 659 remote_client.sendLandObjectOwners(primCount);
660 }
649 } 661 }
650 662
651 public Dictionary<LLUUID, int> getLandObjectOwners() 663 public Dictionary<LLUUID, int> getLandObjectOwners()
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 64b4079..632b7a6 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
216 public event ParcelDivideRequest OnParcelDivideRequest; 216 public event ParcelDivideRequest OnParcelDivideRequest;
217 public event ParcelJoinRequest OnParcelJoinRequest; 217 public event ParcelJoinRequest OnParcelJoinRequest;
218 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 218 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
219 219 public event ParcelAbandonRequest OnParcelAbandonRequest;
220 public event ParcelAccessListRequest OnParcelAccessListRequest; 220 public event ParcelAccessListRequest OnParcelAccessListRequest;
221 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; 221 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
222 public event ParcelSelectObjects OnParcelSelectObjects; 222 public event ParcelSelectObjects OnParcelSelectObjects;
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 4e31ae6..cead2d8 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -27,16 +27,23 @@
27 27
28using libsecondlife; 28using libsecondlife;
29using Nini.Config; 29using Nini.Config;
30 30using System;
31using System.Reflection;
32using log4net;
31using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Modules.Framework;
35using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander;
32using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
33 37
34namespace OpenSim.Region.Environment.Modules.World.Permissions 38namespace OpenSim.Region.Environment.Modules.World.Permissions
35{ 39{
36 public class PermissionsModule : IRegionModule, IScenePermissions 40 public class PermissionsModule : IRegionModule, IScenePermissions, ICommandableModule
37 { 41 {
38 protected Scene m_scene; 42 protected Scene m_scene;
43 private readonly Commander m_commander = new Commander("Permissions");
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39 45
46 #region Constants
40 // These are here for testing. They will be taken out 47 // These are here for testing. They will be taken out
41 48
42 //private uint PERM_ALL = (uint)2147483647; 49 //private uint PERM_ALL = (uint)2147483647;
@@ -45,16 +52,89 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
45 private uint PERM_MOVE = (uint)524288; 52 private uint PERM_MOVE = (uint)524288;
46 //private uint PERM_TRANS = (uint)8192; 53 //private uint PERM_TRANS = (uint)8192;
47 private uint PERM_LOCKED = (uint)540672; 54 private uint PERM_LOCKED = (uint)540672;
48 55
56 #endregion
57
58 #region Bypass Permissions / Debug Permissions Stuff
59
49 // Bypasses the permissions engine 60 // Bypasses the permissions engine
50 private bool m_bypassPermissions = false; 61 private bool m_bypassPermissions = false;
51 62 private bool m_bypassPermissionsValue = true;
63 private bool m_debugPermissions = false;
52 public bool BypassPermissions 64 public bool BypassPermissions
53 { 65 {
54 get { return m_bypassPermissions; } 66 get { return m_bypassPermissions; }
55 set { m_bypassPermissions = value; } 67 set { m_bypassPermissions = value; }
56 } 68 }
57 69
70 public bool BypassPermissionsValue
71 {
72 get { return m_bypassPermissionsValue; }
73 set { m_bypassPermissionsValue = value; }
74 }
75
76 public bool DebugPermissions
77 {
78 get { return m_debugPermissions; }
79 set { m_debugPermissions = value; }
80 }
81 #endregion
82
83 #region ICommandableModule Members
84
85 public ICommander CommandInterface
86 {
87 get { throw new System.NotImplementedException(); }
88 }
89
90
91 private void InterfaceDebugPermissions(Object[] args)
92 {
93 if ((bool)args[0] == true)
94 {
95 m_debugPermissions = true;
96 m_log.Info("[PERMISSIONS]: Permissions Debugging Enabled.");
97 }
98 else
99 {
100 m_debugPermissions = false;
101 m_log.Info("[PERMISSIONS]: Permissions Debugging Disabled.");
102 }
103 }
104
105 private void InterfaceBypassPermissions(Object[] args)
106 {
107 if ((bool)args[0] == true)
108 {
109 m_log.Info("[PERMISSIONS]: Permissions Bypass Enabled.");
110 m_bypassPermissionsValue = (bool)args[1];
111 }
112 else
113 {
114 m_bypassPermissions = false;
115 m_log.Info("[PERMISSIONS]: Permissions Bypass Disabled. Normal Operation.");
116 }
117 }
118
119 /// <summary>
120 /// Processes commandline input. Do not call directly.
121 /// </summary>
122 /// <param name="args">Commandline arguments</param>
123 private void EventManager_OnPluginConsole(string[] args)
124 {
125 if (args[0] == "permissions")
126 {
127 string[] tmpArgs = new string[args.Length - 2];
128 int i;
129 for (i = 2; i < args.Length; i++)
130 tmpArgs[i - 2] = args[i];
131
132 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
133 }
134 }
135
136 #endregion
137
58 #region IRegionModule Members 138 #region IRegionModule Members
59 139
60 public void Initialise(Scene scene, IConfigSource config) 140 public void Initialise(Scene scene, IConfigSource config)
@@ -67,29 +147,52 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
67 147
68 m_scene.RegisterModuleInterface<IScenePermissions>(this); 148 m_scene.RegisterModuleInterface<IScenePermissions>(this);
69 149
70 //Register External Permission Checks! 150 //Register functions with Scene External Checks!
71 m_scene.ExternalChecks.addCheckAbandonParcel(this.CanAbandonParcel); 151 m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED
72 m_scene.ExternalChecks.addCheckCopyObject(this.CanCopyObject); 152 m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED
73 m_scene.ExternalChecks.addCheckDeRezObject(this.CanDeRezObject); 153 m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED
74 m_scene.ExternalChecks.addCheckEditEstateTerrain(this.CanEditEstateTerrain); 154 m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED
75 m_scene.ExternalChecks.addCheckEditObject(this.CanEditObject); 155 m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED
76 m_scene.ExternalChecks.addCheckEditParcel(this.CanEditParcel); 156 m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED
77 m_scene.ExternalChecks.addCheckEditScript(this.CanEditScript); 157 m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
78 m_scene.ExternalChecks.addCheckInstantMessage(this.CanInstantMessage); 158 m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED
79 m_scene.ExternalChecks.addCheckInventoryTransfer(this.CanInventoryTransfer); 159 m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED
80 m_scene.ExternalChecks.addCheckMoveObject(this.CanEditObjectPosition); 160 m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED
81 m_scene.ExternalChecks.addCheckRestartSim(this.CanRestartSim); 161 m_scene.ExternalChecks.addCheckMoveObject(CanMoveObject); //HOPEFULLY FULLY IMPLEMENTED
82 m_scene.ExternalChecks.addCheckReturnObject(this.CanReturnObject); 162 m_scene.ExternalChecks.addCheckObjectEntry(CanObjectEntry); //FULLY IMPLEMENTED
83 m_scene.ExternalChecks.addCheckRezObject(this.CanRezObject); 163 m_scene.ExternalChecks.addCheckReturnObject(CanReturnObject); //NOT YET IMPLEMENTED
84 m_scene.ExternalChecks.addCheckBeGodLike(this.CanBeGodLike); 164 m_scene.ExternalChecks.addCheckRezObject(CanRezObject); //HOPEFULLY FULLY IMPLEMENTED
85 m_scene.ExternalChecks.addCheckRunConsoleCommand(this.CanRunConsoleCommand); 165 m_scene.ExternalChecks.addCheckRunConsoleCommand(CanRunConsoleCommand); //FULLY IMPLEMENTED
86 m_scene.ExternalChecks.addCheckRunScript(this.CanRunScript); 166 m_scene.ExternalChecks.addCheckRunScript(CanRunScript); //NOT YET IMPLEMENTED
87 m_scene.ExternalChecks.addCheckSellParcel(this.CanSellParcel); 167 m_scene.ExternalChecks.addCheckSellParcel(CanSellParcel); //FULLY IMPLEMENTED
88 //m_scene.ExternalChecks.addCheckTakeObject; -- NOT YET IMPLEMENTED 168 m_scene.ExternalChecks.addCheckTakeObject(CanTakeObject); //FULLY IMPLEMENTED
89 m_scene.ExternalChecks.addCheckTerraformLandCommand(this.CanTerraform); 169 m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED
170 m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!)
171 m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED
172
173 //NEEDED PERMS:
174 //CanLinkObject
175 //CanDelinkObject
176 //CanBuyLand
177
178
179 //Register Debug Commands
180 Command bypassCommand = new Command("bypass", InterfaceBypassPermissions, "Force the permissions a specific way to test permissions");
181 bypassCommand.AddArgument("enable_bypass_perms", "true to enable bypassing all perms", "Boolean");
182 bypassCommand.AddArgument("bypass_perms_value", "true/false: true will ignore all perms; false will restrict everything", "Boolean");
183
184 m_commander.RegisterCommand("bypass", bypassCommand);
185
186 Command debugCommand = new Command("debug", InterfaceDebugPermissions, "Force the permissions a specific way to test permissions");
187 debugCommand.AddArgument("enable_debug_perms", "true to enable debugging to console all perms", "Boolean");
188
189 m_commander.RegisterCommand("debug", debugCommand);
190 m_scene.RegisterModuleCommander("CommanderPermissions", m_commander);
90 191
192 m_scene.EventManager.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(EventManager_OnPluginConsole);
91 } 193 }
92 194
195
93 public void PostInitialise() 196 public void PostInitialise()
94 { 197 {
95 } 198 }
@@ -110,18 +213,19 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
110 213
111 #endregion 214 #endregion
112 215
216 #region Helper Functions
113 protected void SendPermissionError(LLUUID user, string reason) 217 protected void SendPermissionError(LLUUID user, string reason)
114 { 218 {
115 m_scene.EventManager.TriggerPermissionError(user, reason); 219 m_scene.EventManager.TriggerPermissionError(user, reason);
116 } 220 }
221 protected void DebugPermissionInformation(string permissionCalled)
222 {
223 if(m_debugPermissions)
224 m_log.Info("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName);
225 }
117 226
118 protected bool IsAdministrator(LLUUID user) 227 protected bool IsAdministrator(LLUUID user)
119 { 228 {
120 if (m_bypassPermissions)
121 {
122 return true;
123 }
124
125 // If there is no master avatar, return false 229 // If there is no master avatar, return false
126 if (m_scene.RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero) 230 if (m_scene.RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero)
127 { 231 {
@@ -133,117 +237,19 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
133 237
134 protected bool IsEstateManager(LLUUID user) 238 protected bool IsEstateManager(LLUUID user)
135 { 239 {
136 if (m_bypassPermissions)
137 {
138 return true;
139 }
140
141 if (user != LLUUID.Zero) 240 if (user != LLUUID.Zero)
142 { 241 {
143 LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers; 242 LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
144 for (int i = 0; i < estatemanagers.Length; i++) 243 foreach(LLUUID estatemanager in estatemanagers)
145 { 244 {
146 if (estatemanagers[i] == user) 245 if (estatemanager == user)
147 return true; 246 return true;
148 } 247 }
149 } 248 }
150 249
151 return false; 250 return false;
152 } 251 }
153 252#endregion
154 protected bool IsGridUser(LLUUID user)
155 {
156 return true;
157 }
158
159 protected bool IsGuest(LLUUID user)
160 {
161 return false;
162 }
163
164 public bool CanRezObject(int objectCount, LLUUID user, LLVector3 position,Scene scene)
165 {
166 bool permission = false;
167
168
169
170 string reason = "Insufficient permission";
171
172 ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y);
173 if (land == null) return false;
174
175 if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
176 (int)Parcel.ParcelFlags.CreateObjects)
177 permission = true;
178
179 //TODO: check for group rights
180
181 if (IsAdministrator(user))
182 {
183 permission = true;
184 }
185 else
186 {
187 reason = "Not an administrator";
188 }
189
190 if (GenericParcelPermission(user, position))
191 {
192 permission = true;
193 }
194 else
195 {
196 reason = "Not the parcel owner";
197 }
198
199 if (!permission)
200 SendPermissionError(user, reason);
201
202 return permission;
203 }
204
205 /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
206 public bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
207 {
208 if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
209 {
210 return true;
211 }
212
213 ILandObject land1 = m_scene.LandChannel.GetLandObject(oldPos.X, oldPos.Y);
214 ILandObject land2 = m_scene.LandChannel.GetLandObject(newPos.X, newPos.Y);
215
216 if (land1 == null || land2 == null)
217 {
218 return false;
219 }
220 if (land2 == null)
221 {
222 // need this for crossing borders
223 return true;
224 }
225
226 if (land1.landData.globalID == land2.landData.globalID)
227 {
228 return true;
229 }
230
231 if ((land2.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
232 {
233 return true;
234 }
235
236 //TODO: check for group rights
237
238 if (GenericParcelPermission(user, newPos))
239 {
240 return true;
241 }
242
243 SendPermissionError(user, "Not allowed to move objects in this parcel!");
244
245 return false;
246 }
247 253
248 #region Object Permissions 254 #region Object Permissions
249 255
@@ -427,302 +433,436 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
427 return permission; 433 return permission;
428 } 434 }
429 435
430 /// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see> 436
431 public bool CanDeRezObject(LLUUID obj,LLUUID user, Scene scene) 437 #endregion
438
439 #region Generic Permissions
440 protected bool GenericCommunicationPermission(LLUUID user, LLUUID target)
432 { 441 {
433 return GenericObjectPermission(user, obj); 442 bool permission = false;
443 string reason = "Only registered users may communicate with another account.";
444
445
446 if (IsAdministrator(user))
447 permission = true;
448
449 if (IsEstateManager(user))
450 permission = true;
451
452 if (!permission)
453 SendPermissionError(user, reason);
454
455 return permission;
434 } 456 }
435 457
436 public bool CanEditObject(LLUUID obj, LLUUID user, Scene scene) 458 public bool GenericEstatePermission(LLUUID user)
437 { 459 {
438 return GenericObjectPermission(user, obj); 460 // Default: deny
461 bool permission = false;
462
463 // Estate admins should be able to use estate tools
464 if (IsEstateManager(user))
465 permission = true;
466
467 // Administrators always have permission
468 if (IsAdministrator(user))
469 permission = true;
470
471 return permission;
439 } 472 }
440 473
441 public bool CanEditObjectPosition(LLUUID obj, LLUUID user, Scene scene) 474 protected bool GenericParcelPermission(LLUUID user, ILandObject parcel)
442 { 475 {
443 bool permission = GenericObjectPermission(user, obj); 476 bool permission = false;
444 if (!permission)
445 {
446 if (!m_scene.Entities.ContainsKey(obj))
447 {
448 return false;
449 }
450 477
451 // The client 478 if (parcel.landData.ownerID == user)
452 // may request to edit linked parts, and therefore, it needs 479 {
453 // to also check for SceneObjectPart 480 permission = true;
481 }
454 482
455 // If it's not an object, we cant edit it. 483 if (parcel.landData.isGroupOwned)
456 if ((!(m_scene.Entities[obj] is SceneObjectGroup))) 484 {
457 { 485 // TODO: Need to do some extra checks here. Requires group code.
458 return false; 486 }
459 }
460 487
488 if (IsEstateManager(user))
489 {
490 permission = true;
491 }
461 492
462 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj]; 493 if (IsAdministrator(user))
494 {
495 permission = true;
496 }
463 497
498 return permission;
499 }
464 500
465 LLUUID taskOwner = null; 501 protected bool GenericParcelPermission(LLUUID user, LLVector3 pos)
466 // Added this because at this point in time it wouldn't be wise for 502 {
467 // the administrator object permissions to take effect. 503 ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
468 LLUUID objectOwner = task.OwnerID; 504 if (parcel == null) return false;
505 return GenericParcelPermission(user, parcel);
506 }
507#endregion
508
509 #region Permission Checks
510 private bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene)
511 {
512 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
513 if (m_bypassPermissions) return m_bypassPermissionsValue;
469 514
470 // Anyone can move 515 return GenericParcelPermission(user, parcel);
471 if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0) 516 }
472 permission = true;
473 517
474 // Locked 518 private bool CanBeGodLike(LLUUID user, Scene scene)
475 if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0) 519 {
476 permission = false; 520 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
521 if (m_bypassPermissions) return m_bypassPermissionsValue;
477 522
523 return IsAdministrator(user);
478 } 524 }
479 else 525
526 private bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition)
480 { 527 {
481 bool locked = false; 528 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
482 if (!m_scene.Entities.ContainsKey(obj)) 529 if (m_bypassPermissions) return m_bypassPermissionsValue;
483 {
484 return false;
485 }
486 530
487 // If it's not an object, we cant edit it. 531 if (!GenericObjectPermission(owner, objectID))
488 if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
489 { 532 {
533 //They can't even edit the object
490 return false; 534 return false;
491 } 535 }
536 //If they can rez, they can duplicate
537 return CanRezObject(objectCount, owner, objectPosition, scene);
538 }
492 539
540 private bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene)
541 {
542 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
543 if (m_bypassPermissions) return m_bypassPermissionsValue;
493 544
494 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[obj]; 545 return GenericObjectPermission(objectID, deleter);
546 }
495 547
496 LLUUID objectOwner = group.OwnerID; 548 private bool CanEditObject(LLUUID objectID, LLUUID editorID, Scene scene)
497 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0); 549 {
550 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
551 if (m_bypassPermissions) return m_bypassPermissionsValue;
498 552
499 553
500 // This is an exception to the generic object permission. 554 return GenericObjectPermission(editorID, objectID);
501 // Administrators who lock their objects should not be able to move them, 555 }
502 // however generic object permission should return true.
503 // This keeps locked objects from being affected by random click + drag actions by accident
504 // and allows the administrator to grab or delete a locked object.
505 556
506 // Administrators and estate managers are still able to click+grab locked objects not 557 private bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene)
507 // owned by them in the scene 558 {
508 // This is by design. 559 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
560 if (m_bypassPermissions) return m_bypassPermissionsValue;
509 561
510 if (locked && (user == objectOwner)) 562 return GenericParcelPermission(user, parcel);
511 return false;
512 } 563 }
513 return permission;
514 }
515 564
516 public bool CanCopyObject(int objectCount, LLUUID obj, LLUUID user, Scene scene, LLVector3 objectPosition) 565 private bool CanEditScript(LLUUID script, LLUUID user, Scene scene)
517 {
518 bool permission = GenericObjectPermission(user, obj);
519 if (permission)
520 { 566 {
521 if (!m_scene.Entities.ContainsKey(obj)) 567 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
522 { 568 if (m_bypassPermissions) return m_bypassPermissionsValue;
523 return false;
524 }
525 569
526 // If it's not an object, we cant edit it. 570 return true;
527 if (!(m_scene.Entities[obj] is SceneObjectGroup)) 571 }
528 {
529 return false;
530 }
531 572
532 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj]; 573 private bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene)
533 LLUUID taskOwner = null; 574 {
534 // Added this because at this point in time it wouldn't be wise for 575 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
535 // the administrator object permissions to take effect. 576 if (m_bypassPermissions) return m_bypassPermissionsValue;
536 LLUUID objectOwner = task.OwnerID; 577
578
579 return GenericCommunicationPermission(user, target);
580 }
537 581
582 private bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene startScene)
583 {
584 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
585 if (m_bypassPermissions) return m_bypassPermissionsValue;
538 586
539 if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) 587 return GenericCommunicationPermission(user, target);
540 permission = true;
541 } 588 }
542 return permission;
543 }
544 589
545 public bool CanReturnObject(LLUUID obj, LLUUID user, Scene scene) 590 private bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene)
546 { 591 {
547 return GenericObjectPermission(user, obj); 592 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
548 } 593 if (m_bypassPermissions) return m_bypassPermissionsValue;
549 594
550 #endregion 595 return GenericEstatePermission(user);
596 }
551 597
552 #region Communication Permissions 598 private bool CanMoveObject(LLUUID objectID, LLUUID moverID, Scene scene)
599 {
600 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
601 if (m_bypassPermissions) return m_bypassPermissionsValue;
553 602
554 protected bool GenericCommunicationPermission(LLUUID user, LLUUID target) 603 bool permission = GenericObjectPermission(moverID, objectID);
555 { 604 if (!permission)
556 bool permission = false; 605 {
557 string reason = "Only registered users may communicate with another account."; 606 if (!m_scene.Entities.ContainsKey(objectID))
607 {
608 return false;
609 }
558 610
559 if (IsGridUser(user)) 611 // The client
560 permission = true; 612 // may request to edit linked parts, and therefore, it needs
613 // to also check for SceneObjectPart
561 614
562 if (!IsGridUser(user)) 615 // If it's not an object, we cant edit it.
563 { 616 if ((!(m_scene.Entities[objectID] is SceneObjectGroup)))
564 permission = false; 617 {
565 reason = "The person that you are messaging is not a registered user."; 618 return false;
566 } 619 }
567 if (IsAdministrator(user))
568 permission = true;
569 620
570 if (IsEstateManager(user))
571 permission = true;
572 621
573 if (!permission) 622 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
574 SendPermissionError(user, reason);
575 623
576 return permission;
577 }
578 624
579 public bool CanInstantMessage(LLUUID user, LLUUID target, Scene scene) 625 LLUUID taskOwner = null;
580 { 626 // Added this because at this point in time it wouldn't be wise for
581 return GenericCommunicationPermission(user, target); 627 // the administrator object permissions to take effect.
582 } 628 LLUUID objectOwner = task.OwnerID;
583 629
584 public bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene scene) 630 // Anyone can move
585 { 631 if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
586 return GenericCommunicationPermission(user, target); 632 permission = true;
587 }
588 633
589 #endregion 634 // Locked
635 if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
636 permission = false;
590 637
591 public bool CanEditScript(LLUUID script, LLUUID user, Scene scene) 638 }
592 { 639 else
593 return IsAdministrator(user); 640 {
594 } 641 bool locked = false;
642 if (!m_scene.Entities.ContainsKey(objectID))
643 {
644 return false;
645 }
595 646
596 public bool CanRunScript(LLUUID script, LLUUID user, Scene scene) 647 // If it's not an object, we cant edit it.
597 { 648 if ((!(m_scene.Entities[objectID] is SceneObjectGroup)))
598 return IsAdministrator(user); 649 {
599 } 650 return false;
651 }
600 652
601 public bool CanRunConsoleCommand(LLUUID user, Scene scene)
602 {
603 return IsAdministrator(user);
604 }
605 653
606 public bool CanTerraform(LLUUID user, LLVector3 position, Scene scene) 654 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objectID];
607 {
608 bool permission = false;
609 655
610 // Estate override 656 LLUUID objectOwner = group.OwnerID;
611 if (GenericEstatePermission(user)) 657 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
612 permission = true;
613 658
614 float X = position.X;
615 float Y = position.Y;
616
617 if (X > 255)
618 X = 255;
619 if (Y > 255)
620 Y = 255;
621 if (X < 0)
622 X = 0;
623 if (Y < 0)
624 Y = 0;
625
626 // Land owner can terraform too
627 ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
628 if (parcel != null && GenericParcelPermission(user, parcel))
629 permission = true;
630 659
631 if (!permission) 660 // This is an exception to the generic object permission.
632 SendPermissionError(user, "Not authorized to terraform at this location."); 661 // Administrators who lock their objects should not be able to move them,
662 // however generic object permission should return true.
663 // This keeps locked objects from being affected by random click + drag actions by accident
664 // and allows the administrator to grab or delete a locked object.
633 665
634 return permission; 666 // Administrators and estate managers are still able to click+grab locked objects not
635 } 667 // owned by them in the scene
668 // This is by design.
636 669
637 #region Estate Permissions 670 if (locked && (moverID == objectOwner))
671 return false;
672 }
673 return permission;
674 }
638 675
639 public bool GenericEstatePermission(LLUUID user) 676 private bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene)
640 { 677 {
641 // Default: deny 678 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
642 bool permission = false; 679 if (m_bypassPermissions) return m_bypassPermissionsValue;
643 680
644 // Estate admins should be able to use estate tools 681 if ((newPoint.X > 257f || newPoint.X < -1f || newPoint.Y > 257f || newPoint.Y < -1f))
645 if (IsEstateManager(user)) 682 {
646 permission = true; 683 return true;
684 }
647 685
648 // Administrators always have permission 686 ILandObject land = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
649 if (IsAdministrator(user))
650 permission = true;
651 687
652 return permission; 688 if (land == null)
653 } 689 {
690 return false;
691 }
654 692
655 public bool CanEditEstateTerrain(LLUUID user, Scene scene) 693 if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
656 { 694 {
657 return GenericEstatePermission(user); 695 return true;
658 } 696 }
659 697
660 public bool CanRestartSim(LLUUID user, Scene scene) 698 //TODO: check for group rights
661 {
662 // Since this is potentially going on a grid...
663 699
664 return GenericEstatePermission(user); 700 if (!m_scene.Entities.ContainsKey(objectID))
665 //return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; 701 {
666 } 702 return false;
703 }
667 704
668 public bool CanBeGodLike(LLUUID user, Scene scene) 705 // If it's not an object, we cant edit it.
669 { 706 if (!(m_scene.Entities[objectID] is SceneObjectGroup))
670 return GenericEstatePermission(user); 707 {
671 } 708 return false;
709 }
672 710
673 #endregion 711 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
674 712
675 #region Parcel Permissions 713 if (GenericParcelPermission(task.OwnerID, newPoint))
714 {
715 return true;
716 }
676 717
677 protected bool GenericParcelPermission(LLUUID user, ILandObject parcel) 718 //Otherwise, false!
678 { 719 return false;
679 bool permission = false; 720 }
680 721
681 if (parcel.landData.ownerID == user) 722 private bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene)
682 { 723 {
683 permission = true; 724 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
725 if (m_bypassPermissions) return m_bypassPermissionsValue;
726
727 return GenericObjectPermission(returnerID, objectID);
684 } 728 }
685 729
686 if (parcel.landData.isGroupOwned) 730 private bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene)
687 { 731 {
688 // TODO: Need to do some extra checks here. Requires group code. 732 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
733 if (m_bypassPermissions) return m_bypassPermissionsValue;
734
735 bool permission = false;
736
737 ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
738 if (land == null) return false;
739
740 if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
741 (int)Parcel.ParcelFlags.CreateObjects)
742 permission = true;
743
744 //TODO: check for group rights
745
746 if (IsAdministrator(owner))
747 {
748 permission = true;
749 }
750
751 if (GenericParcelPermission(owner, objectPosition))
752 {
753 permission = true;
754 }
755
756 return permission;
689 } 757 }
690 758
691 if (IsEstateManager(user)) 759 private bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene)
692 { 760 {
693 permission = true; 761 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
762 if (m_bypassPermissions) return m_bypassPermissionsValue;
763
764
765 return IsAdministrator(user);
694 } 766 }
695 767
696 if (IsAdministrator(user)) 768 private bool CanRunScript(LLUUID script, LLUUID user, Scene scene)
697 { 769 {
698 permission = true; 770 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
771 if (m_bypassPermissions) return m_bypassPermissionsValue;
772
773 return true;
699 } 774 }
700 775
701 return permission; 776 private bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene)
702 } 777 {
778 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
779 if (m_bypassPermissions) return m_bypassPermissionsValue;
703 780
704 protected bool GenericParcelPermission(LLUUID user, LLVector3 pos) 781 return GenericParcelPermission(user, parcel);
705 { 782 }
706 ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
707 if (parcel == null) return false;
708 return GenericParcelPermission(user, parcel);
709 }
710 783
711 public bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene) 784 private bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene)
712 { 785 {
713 return GenericParcelPermission(user, parcel); 786 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
714 } 787 if (m_bypassPermissions) return m_bypassPermissionsValue;
715 788
716 public bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene) 789 return GenericObjectPermission(stealer,objectID);
717 { 790 }
718 return GenericParcelPermission(user, parcel);
719 }
720 791
721 public bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene) 792 private bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene)
722 { 793 {
723 return GenericParcelPermission(user, parcel); 794 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
724 } 795 if (m_bypassPermissions) return m_bypassPermissionsValue;
796
797 bool permission = GenericObjectPermission(userID, objectID);
798 if (permission)
799 {
800 if (!m_scene.Entities.ContainsKey(objectID))
801 {
802 return false;
803 }
804
805 // If it's not an object, we cant edit it.
806 if (!(m_scene.Entities[objectID] is SceneObjectGroup))
807 {
808 return false;
809 }
810
811 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
812 LLUUID taskOwner = null;
813 // Added this because at this point in time it wouldn't be wise for
814 // the administrator object permissions to take effect.
815 LLUUID objectOwner = task.OwnerID;
816
817
818 if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
819 permission = true;
820 }
821 return permission;
822 }
823
824 private bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene)
825 {
826 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
827 if (m_bypassPermissions) return m_bypassPermissionsValue;
828
829 bool permission = false;
830
831 // Estate override
832 if (GenericEstatePermission(user))
833 permission = true;
725 834
835 float X = position.X;
836 float Y = position.Y;
837
838 if (X > 255)
839 X = 255;
840 if (Y > 255)
841 Y = 255;
842 if (X < 0)
843 X = 0;
844 if (Y < 0)
845 Y = 0;
846
847 // Land owner can terraform too
848 ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
849 if (parcel != null && GenericParcelPermission(user, parcel))
850 permission = true;
851
852
853 return permission;
854 }
855
856 private bool CanViewScript(LLUUID script, LLUUID user, Scene scene)
857 {
858 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
859 if (m_bypassPermissions) return m_bypassPermissionsValue;
860
861 return true;
862 }
726 #endregion 863 #endregion
864
865
727 } 866 }
867
728} 868}
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 9dba398..8b9b888 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -288,8 +288,11 @@ namespace OpenSim.Region.Environment.Scenes
288 { 288 {
289 if (((SceneObjectGroup)obj).LocalId == localID) 289 if (((SceneObjectGroup)obj).LocalId == localID)
290 { 290 {
291 m_parentScene.RemoveEntity((SceneObjectGroup)obj); 291 if (m_parentScene.ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)obj).UUID, avatar_deleter))
292 m_numPrim--; 292 {
293 m_parentScene.RemoveEntity((SceneObjectGroup)obj);
294 m_numPrim--;
295 }
293 return; 296 return;
294 } 297 }
295 } 298 }
@@ -998,12 +1001,11 @@ namespace OpenSim.Region.Environment.Scenes
998 if (group != null) 1001 if (group != null)
999 { 1002 {
1000 LLVector3 oldPos = group.AbsolutePosition; 1003 LLVector3 oldPos = group.AbsolutePosition;
1001 //FIXME: ObjectEntry is not in ExternalChecks! 1004 if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment)
1002 //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) 1005 {
1003 //{
1004 group.SendGroupTerseUpdate(); 1006 group.SendGroupTerseUpdate();
1005 //return; 1007 return;
1006 //} 1008 }
1007 if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) 1009 if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
1008 { 1010 {
1009 group.UpdateSinglePosition(pos, localID); 1011 group.UpdateSinglePosition(pos, localID);
@@ -1030,12 +1032,11 @@ namespace OpenSim.Region.Environment.Scenes
1030 } 1032 }
1031 else 1033 else
1032 { 1034 {
1033 //FIXME: ObjectEntry not in ExternalChecks! 1035 if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment)
1034 //if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) 1036 {
1035 //{
1036 group.SendGroupTerseUpdate(); 1037 group.SendGroupTerseUpdate();
1037 // return; 1038 return;
1038 //} 1039 }
1039 if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment) 1040 if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment)
1040 { 1041 {
1041 group.UpdateGroupPosition(pos); 1042 group.UpdateGroupPosition(pos);
@@ -1055,7 +1056,7 @@ namespace OpenSim.Region.Environment.Scenes
1055 SceneObjectGroup group = GetGroupByPrim(localID); 1056 SceneObjectGroup group = GetGroupByPrim(localID);
1056 if (group != null) 1057 if (group != null)
1057 { 1058 {
1058 if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID,remoteClient.AgentId)) 1059 if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,remoteClient.AgentId))
1059 { 1060 {
1060 group.UpdateTextureEntry(localID, texture); 1061 group.UpdateTextureEntry(localID, texture);
1061 } 1062 }
@@ -1378,7 +1379,7 @@ namespace OpenSim.Region.Environment.Scenes
1378 1379
1379 if (originPrim != null) 1380 if (originPrim != null)
1380 { 1381 {
1381 if (m_parentScene.ExternalChecks.ExternalChecksCanCopyObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition)) 1382 if (m_parentScene.ExternalChecks.ExternalChecksCanDuplicateObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition))
1382 { 1383 {
1383 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); 1384 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
1384 copy.AbsolutePosition = copy.AbsolutePosition + offset; 1385 copy.AbsolutePosition = copy.AbsolutePosition + offset;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 782d5b4..cbb3a7d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -988,17 +988,28 @@ namespace OpenSim.Region.Environment.Scenes
988 } 988 }
989 if (selectedEnt != null) 989 if (selectedEnt != null)
990 { 990 {
991 bool permission; 991 bool permissionToTake = false;
992 if (DeRezPacket.AgentBlock.Destination == 1) 992 bool permissionToDelete = false;
993 { // Take Copy 993 if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy
994 permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); 994 {
995 permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
996 permissionToDelete = false; //Just taking copy!
997
995 } 998 }
996 else 999 else if(DeRezPacket.AgentBlock.Destination == 4) //Take
997 { // Take 1000 {
998 permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); 1001 // Take
1002 permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
1003 permissionToDelete = permissionToTake; //If they can take, they can delete!
1004 }
1005
1006 else if (DeRezPacket.AgentBlock.Destination == 6) //Delete
1007 {
1008 permissionToTake = false;
1009 permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
999 } 1010 }
1000 1011
1001 if (permission) 1012 if (permissionToTake)
1002 { 1013 {
1003 SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt; 1014 SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt;
1004 string sceneObjectXml = objectGroup.ToXmlString(); 1015 string sceneObjectXml = objectGroup.ToXmlString();
@@ -1044,8 +1055,7 @@ namespace OpenSim.Region.Environment.Scenes
1044 remoteClient.SendInventoryItemCreateUpdate(item); 1055 remoteClient.SendInventoryItemCreateUpdate(item);
1045 } 1056 }
1046 1057
1047 // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy 1058 if (permissionToDelete)
1048 if (DeRezPacket.AgentBlock.Destination != 1)
1049 { 1059 {
1050 DeleteSceneObjectGroup(objectGroup); 1060 DeleteSceneObjectGroup(objectGroup);
1051 } 1061 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f0a0921..faa595f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1146,13 +1146,20 @@ namespace OpenSim.Region.Environment.Scenes
1146 m_log.Info("[SCENE]: Loading land objects from storage"); 1146 m_log.Info("[SCENE]: Loading land objects from storage");
1147 List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); 1147 List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID);
1148 1148
1149 if (landData.Count == 0) 1149 if (LandChannel != null)
1150 { 1150 {
1151 LandChannel.NoLandDataFromStorage(); 1151 if (landData.Count == 0)
1152 {
1153 LandChannel.NoLandDataFromStorage();
1154 }
1155 else
1156 {
1157 LandChannel.IncomingLandObjectsFromStorage(landData);
1158 }
1152 } 1159 }
1153 else 1160 else
1154 { 1161 {
1155 LandChannel.IncomingLandObjectsFromStorage(landData); 1162 m_log.Error("[SCENE]: Land Channel is not defined. Cannot load from storage!");
1156 } 1163 }
1157 } 1164 }
1158 1165
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index e7e4caf..285ee0d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -74,24 +74,24 @@ namespace OpenSim.Region.Environment.Scenes
74 74
75 #endregion 75 #endregion
76 76
77 #region DEREZ OBJECT 77 #region DELETE OBJECT
78 public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene); 78 public delegate bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene);
79 private List<CanDeRezObject> CanDeRezObjectCheckFunctions = new List<CanDeRezObject>(); 79 private List<CanDeleteObject> CanDeleteObjectCheckFunctions = new List<CanDeleteObject>();
80 80
81 public void addCheckDeRezObject(CanDeRezObject delegateFunc) 81 public void addCheckDeleteObject(CanDeleteObject delegateFunc)
82 { 82 {
83 if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc)) 83 if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
84 CanDeRezObjectCheckFunctions.Add(delegateFunc); 84 CanDeleteObjectCheckFunctions.Add(delegateFunc);
85 } 85 }
86 public void removeCheckDeRezObject(CanDeRezObject delegateFunc) 86 public void removeCheckDeleteObject(CanDeleteObject delegateFunc)
87 { 87 {
88 if (CanDeRezObjectCheckFunctions.Contains(delegateFunc)) 88 if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
89 CanDeRezObjectCheckFunctions.Remove(delegateFunc); 89 CanDeleteObjectCheckFunctions.Remove(delegateFunc);
90 } 90 }
91 91
92 public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter) 92 public bool ExternalChecksCanDeleteObject(LLUUID objectID, LLUUID deleter)
93 { 93 {
94 foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions) 94 foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions)
95 { 95 {
96 if (check(objectID,deleter,m_scene) == false) 96 if (check(objectID,deleter,m_scene) == false)
97 { 97 {
@@ -132,24 +132,53 @@ namespace OpenSim.Region.Environment.Scenes
132 132
133 #endregion 133 #endregion
134 134
135 #region COPY OBJECT 135 #region TAKE COPY OBJECT
136 public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); 136 public delegate bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene);
137 private List<CanCopyObject> CanCopyObjectCheckFunctions = new List<CanCopyObject>(); 137 private List<CanTakeCopyObject> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObject>();
138 138
139 public void addCheckCopyObject(CanCopyObject delegateFunc) 139 public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
140 { 140 {
141 if (!CanCopyObjectCheckFunctions.Contains(delegateFunc)) 141 if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
142 CanCopyObjectCheckFunctions.Add(delegateFunc); 142 CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
143 } 143 }
144 public void removeCheckCopyObject(CanCopyObject delegateFunc) 144 public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
145 { 145 {
146 if (CanCopyObjectCheckFunctions.Contains(delegateFunc)) 146 if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
147 CanCopyObjectCheckFunctions.Remove(delegateFunc); 147 CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
148 } 148 }
149 149
150 public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) 150 public bool ExternalChecksCanTakeCopyObject(LLUUID objectID, LLUUID userID)
151 { 151 {
152 foreach (CanCopyObject check in CanCopyObjectCheckFunctions) 152 foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions)
153 {
154 if (check(objectID,userID,m_scene) == false)
155 {
156 return false;
157 }
158 }
159 return true;
160 }
161
162 #endregion
163
164 #region DUPLICATE OBJECT
165 public delegate bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition);
166 private List<CanDuplicateObject> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObject>();
167
168 public void addCheckDuplicateObject(CanDuplicateObject delegateFunc)
169 {
170 if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
171 CanDuplicateObjectCheckFunctions.Add(delegateFunc);
172 }
173 public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc)
174 {
175 if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
176 CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
177 }
178
179 public bool ExternalChecksCanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition)
180 {
181 foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions)
153 { 182 {
154 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) 183 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
155 { 184 {
@@ -219,6 +248,35 @@ namespace OpenSim.Region.Environment.Scenes
219 248
220 #endregion 249 #endregion
221 250
251 #region OBJECT ENTRY
252 public delegate bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene);
253 private List<CanObjectEntry> CanObjectEntryCheckFunctions = new List<CanObjectEntry>();
254
255 public void addCheckObjectEntry(CanObjectEntry delegateFunc)
256 {
257 if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
258 CanObjectEntryCheckFunctions.Add(delegateFunc);
259 }
260 public void removeCheckObjectEntry(CanObjectEntry delegateFunc)
261 {
262 if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
263 CanObjectEntryCheckFunctions.Remove(delegateFunc);
264 }
265
266 public bool ExternalChecksCanObjectEntry(LLUUID objectID, LLVector3 newPoint)
267 {
268 foreach (CanObjectEntry check in CanObjectEntryCheckFunctions)
269 {
270 if (check(objectID, newPoint, m_scene) == false)
271 {
272 return false;
273 }
274 }
275 return true;
276 }
277
278 #endregion
279
222 #region RETURN OBJECT 280 #region RETURN OBJECT
223 public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene); 281 public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene);
224 private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>(); 282 private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>();
@@ -248,10 +306,6 @@ namespace OpenSim.Region.Environment.Scenes
248 306
249 #endregion 307 #endregion
250 308
251 #endregion
252
253 #region Misc Permission Checks
254
255 #region INSTANT MESSAGE 309 #region INSTANT MESSAGE
256 public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); 310 public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene);
257 private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>(); 311 private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>();
@@ -271,7 +325,7 @@ namespace OpenSim.Region.Environment.Scenes
271 { 325 {
272 foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) 326 foreach (CanInstantMessage check in CanInstantMessageCheckFunctions)
273 { 327 {
274 if (check(user,target,m_scene) == false) 328 if (check(user, target, m_scene) == false)
275 { 329 {
276 return false; 330 return false;
277 } 331 }
@@ -310,6 +364,35 @@ namespace OpenSim.Region.Environment.Scenes
310 364
311 #endregion 365 #endregion
312 366
367 #region VIEW SCRIPT
368 public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene);
369 private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>();
370
371 public void addCheckViewScript(CanViewScript delegateFunc)
372 {
373 if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
374 CanViewScriptCheckFunctions.Add(delegateFunc);
375 }
376 public void removeCheckViewScript(CanViewScript delegateFunc)
377 {
378 if (CanViewScriptCheckFunctions.Contains(delegateFunc))
379 CanViewScriptCheckFunctions.Remove(delegateFunc);
380 }
381
382 public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user)
383 {
384 foreach (CanViewScript check in CanViewScriptCheckFunctions)
385 {
386 if (check(script, user, m_scene) == false)
387 {
388 return false;
389 }
390 }
391 return true;
392 }
393
394 #endregion
395
313 #region EDIT SCRIPT 396 #region EDIT SCRIPT
314 public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); 397 public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene);
315 private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); 398 private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>();
@@ -369,23 +452,23 @@ namespace OpenSim.Region.Environment.Scenes
369 #endregion 452 #endregion
370 453
371 #region TERRAFORM LAND 454 #region TERRAFORM LAND
372 public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene); 455 public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
373 private List<CanTerraformLandCommand> CanTerraformLandCommandCheckFunctions = new List<CanTerraformLandCommand>(); 456 private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();
374 457
375 public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) 458 public void addCheckTerraformLand(CanTerraformLand delegateFunc)
376 { 459 {
377 if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) 460 if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
378 CanTerraformLandCommandCheckFunctions.Add(delegateFunc); 461 CanTerraformLandCheckFunctions.Add(delegateFunc);
379 } 462 }
380 public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) 463 public void removeCheckTerraformLand(CanTerraformLand delegateFunc)
381 { 464 {
382 if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) 465 if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
383 CanTerraformLandCommandCheckFunctions.Remove(delegateFunc); 466 CanTerraformLandCheckFunctions.Remove(delegateFunc);
384 } 467 }
385 468
386 public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) 469 public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos)
387 { 470 {
388 foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions) 471 foreach (CanTerraformLand check in CanTerraformLandCheckFunctions)
389 { 472 {
390 if (check(user, pos, m_scene) == false) 473 if (check(user, pos, m_scene) == false)
391 { 474 {
@@ -426,6 +509,34 @@ namespace OpenSim.Region.Environment.Scenes
426 509
427 #endregion 510 #endregion
428 511
512 #region CAN ISSUE ESTATE COMMAND
513 public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene);
514 private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>();
515
516 public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
517 {
518 if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
519 CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
520 }
521 public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
522 {
523 if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
524 CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
525 }
526
527 public bool ExternalChecksCanIssueEstateCommand(LLUUID user)
528 {
529 foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions)
530 {
531 if (check(user, m_scene) == false)
532 {
533 return false;
534 }
535 }
536 return true;
537 }
538 #endregion
539
429 #region CAN BE GODLIKE 540 #region CAN BE GODLIKE
430 public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene); 541 public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene);
431 private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>(); 542 private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>();
@@ -452,154 +563,95 @@ namespace OpenSim.Region.Environment.Scenes
452 } 563 }
453 return true; 564 return true;
454 } 565 }
455
456 #endregion 566 #endregion
457 567
458 #endregion 568 #region EDIT PARCEL
459 569 public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene);
460 #region Parcel and Estate Permission Checks 570 private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>();
461 #region EDIT ESTATE TERRAIN
462 public delegate bool CanEditEstateTerrain(LLUUID user, Scene scene);
463 private List<CanEditEstateTerrain> CanEditEstateTerrainCheckFunctions = new List<CanEditEstateTerrain>();
464
465 public void addCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc)
466 {
467 if (!CanEditEstateTerrainCheckFunctions.Contains(delegateFunc))
468 CanEditEstateTerrainCheckFunctions.Add(delegateFunc);
469 }
470 public void removeCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc)
471 {
472 if (CanEditEstateTerrainCheckFunctions.Contains(delegateFunc))
473 CanEditEstateTerrainCheckFunctions.Remove(delegateFunc);
474 }
475
476 public bool ExternalChecksCanEditEstateTerrain(LLUUID user)
477 {
478 foreach (CanEditEstateTerrain check in CanEditEstateTerrainCheckFunctions)
479 {
480 if (check(user, m_scene) == false)
481 {
482 return false;
483 }
484 }
485 return true;
486 }
487
488 #endregion
489 571
490 #region RESTART SIM 572 public void addCheckEditParcel(CanEditParcel delegateFunc)
491 public delegate bool CanRestartSim(LLUUID user, Scene scene); 573 {
492 private List<CanRestartSim> CanRestartSimCheckFunctions = new List<CanRestartSim>(); 574 if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
493 575 CanEditParcelCheckFunctions.Add(delegateFunc);
494 public void addCheckRestartSim(CanRestartSim delegateFunc) 576 }
495 { 577 public void removeCheckEditParcel(CanEditParcel delegateFunc)
496 if (!CanRestartSimCheckFunctions.Contains(delegateFunc)) 578 {
497 CanRestartSimCheckFunctions.Add(delegateFunc); 579 if (CanEditParcelCheckFunctions.Contains(delegateFunc))
498 } 580 CanEditParcelCheckFunctions.Remove(delegateFunc);
499 public void removeCheckRestartSim(CanRestartSim delegateFunc) 581 }
500 {
501 if (CanRestartSimCheckFunctions.Contains(delegateFunc))
502 CanRestartSimCheckFunctions.Remove(delegateFunc);
503 }
504 582
505 public bool ExternalChecksCanRestartSim(LLUUID user) 583 public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel)
584 {
585 foreach (CanEditParcel check in CanEditParcelCheckFunctions)
506 { 586 {
507 foreach (CanRestartSim check in CanRestartSimCheckFunctions) 587 if (check(user, parcel, m_scene) == false)
508 { 588 {
509 if (check(user, m_scene) == false) 589 return false;
510 {
511 return false;
512 }
513 } 590 }
514 return true;
515 } 591 }
592 return true;
593 }
516 #endregion 594 #endregion
517 595
518 #region EDIT PARCEL 596 #region SELL PARCEL
519 public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); 597 public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene);
520 private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>(); 598 private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>();
521
522 public void addCheckEditParcel(CanEditParcel delegateFunc)
523 {
524 if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
525 CanEditParcelCheckFunctions.Add(delegateFunc);
526 }
527 public void removeCheckEditParcel(CanEditParcel delegateFunc)
528 {
529 if (CanEditParcelCheckFunctions.Contains(delegateFunc))
530 CanEditParcelCheckFunctions.Remove(delegateFunc);
531 }
532 599
533 public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) 600 public void addCheckSellParcel(CanSellParcel delegateFunc)
534 { 601 {
535 foreach (CanEditParcel check in CanEditParcelCheckFunctions) 602 if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
536 { 603 CanSellParcelCheckFunctions.Add(delegateFunc);
537 if (check(user, parcel, m_scene) == false) 604 }
538 { 605 public void removeCheckSellParcel(CanSellParcel delegateFunc)
539 return false; 606 {
540 } 607 if (CanSellParcelCheckFunctions.Contains(delegateFunc))
541 } 608 CanSellParcelCheckFunctions.Remove(delegateFunc);
542 return true; 609 }
543 }
544 #endregion
545
546 #region SELL PARCEL
547 public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene);
548 private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>();
549
550 public void addCheckSellParcel(CanSellParcel delegateFunc)
551 {
552 if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
553 CanSellParcelCheckFunctions.Add(delegateFunc);
554 }
555 public void removeCheckSellParcel(CanSellParcel delegateFunc)
556 {
557 if (CanSellParcelCheckFunctions.Contains(delegateFunc))
558 CanSellParcelCheckFunctions.Remove(delegateFunc);
559 }
560 610
561 public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) 611 public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel)
612 {
613 foreach (CanSellParcel check in CanSellParcelCheckFunctions)
614 {
615 if (check(user, parcel, m_scene) == false)
562 { 616 {
563 foreach (CanSellParcel check in CanSellParcelCheckFunctions) 617 return false;
564 {
565 if (check(user, parcel, m_scene) == false)
566 {
567 return false;
568 }
569 }
570 return true;
571 } 618 }
572 #endregion 619 }
620 return true;
621 }
622 #endregion
573 623
574 #region ABANDON PARCEL 624 #region ABANDON PARCEL
575 public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); 625 public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene);
576 private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>(); 626 private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>();
577 627
578 public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) 628 public void addCheckAbandonParcel(CanAbandonParcel delegateFunc)
579 { 629 {
580 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) 630 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
581 CanAbandonParcelCheckFunctions.Add(delegateFunc); 631 CanAbandonParcelCheckFunctions.Add(delegateFunc);
582 } 632 }
583 public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) 633 public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc)
584 { 634 {
585 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) 635 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
586 CanAbandonParcelCheckFunctions.Remove(delegateFunc); 636 CanAbandonParcelCheckFunctions.Remove(delegateFunc);
587 } 637 }
588 638
589 public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) 639 public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel)
640 {
641 foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions)
642 {
643 if (check(user, parcel, m_scene) == false)
590 { 644 {
591 foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) 645 return false;
592 {
593 if (check(user, parcel, m_scene) == false)
594 {
595 return false;
596 }
597 }
598 return true;
599 } 646 }
600 #endregion 647 }
648 return true;
649 }
601 #endregion 650 #endregion
602 651
652 #endregion
653
603 654
604 } 655 }
605} 656}
657 \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 56d3494..4fa1302 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.Examples.SimpleModule
145 public event ParcelDivideRequest OnParcelDivideRequest; 145 public event ParcelDivideRequest OnParcelDivideRequest;
146 public event ParcelJoinRequest OnParcelJoinRequest; 146 public event ParcelJoinRequest OnParcelJoinRequest;
147 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 147 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
148 148 public event ParcelAbandonRequest OnParcelAbandonRequest;
149 public event ParcelAccessListRequest OnParcelAccessListRequest; 149 public event ParcelAccessListRequest OnParcelAccessListRequest;
150 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; 150 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
151 public event ParcelSelectObjects OnParcelSelectObjects; 151 public event ParcelSelectObjects OnParcelSelectObjects;
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
index 401042a..5c7f862 100644
--- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs
@@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Common
281 public int osRegionRestart(double seconds) 281 public int osRegionRestart(double seconds)
282 { 282 {
283 m_host.AddScriptLPS(1); 283 m_host.AddScriptLPS(1);
284 if (World.ExternalChecks.ExternalChecksCanRestartSim(m_host.OwnerID)) 284 if (World.ExternalChecks.ExternalChecksCanIssueEstateCommand(m_host.OwnerID))
285 { 285 {
286 World.Restart((float)seconds); 286 World.Restart((float)seconds);
287 return 1; 287 return 1;